[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87ip9refzk.fsf@xmission.com>
Date: Tue, 30 Oct 2012 15:45:35 -0700
From: ebiederm@...ssion.com (Eric W. Biederman)
To: Arvid Brodin <Arvid.Brodin@...n.com>
Cc: "linux-kernel\@vger.kernel.org" <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Al Viro <viro@...iv.linux.org.uk>,
Cyrill Gorcunov <gorcunov@...nvz.org>,
"David Rientjes" <rientjes@...gle.com>
Subject: Re: fs/proc/base.c: text md5sums; tgid vs tid; and INF vs ONE?
Arvid Brodin <Arvid.Brodin@...n.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists