lkml.org 
[lkml]   [2012]   [Oct]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: fs/proc/base.c: text md5sums; tgid vs tid; and INF vs ONE?
Arvid Brodin <Arvid.Brodin@xdin.com> writes:

> Hi,
>
> Below is a patch that adds a file /proc/PID/text_md5sum which when read returns the md5
> checksum of a process' text segment. (This would be used e.g. to make sure a process'
> code hasn't been tampered with.)
>
> However, I have a few questions:
>
> * What's the difference between the tgid_base_stuff and tid_base_stuff arrays? (One for
> processes and one for the process' threads? I haven't been able to find any info about
> this so I'm guessing.)

Yes. One for thread groups and one for threads.

> * When should I use the INF ("read") vs the ONE ("show") macro?

proc_read depends on the caller to allocate a 4k buffer, instead of
sizing the buffer based upon the size of the text being written. Which
makes proc_read an error prone and ultimately deprecated way of handling
things.

Using some variant on seq_file is preferred for new files.

> * Any other comments about the code?

There are known successful attacks against md5 so using md5 for
something new and security related is a bad idea.

Userspace can just as easily compute a security hash itself you don't
need kernel support.


I recommend you checkout the code in security/ima/ looks like it can
already do what you are trying to do.

Eric


\
 
 \ /
  Last update: 2012-10-31 00:21    [W:1.482 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site