All of lore.kernel.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Arvid Brodin <Arvid.Brodin@xdin.com>
Cc: "linux-kernel\@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Cyrill Gorcunov <gorcunov@openvz.org>,
	"David Rientjes" <rientjes@google.com>
Subject: Re: fs/proc/base.c: text md5sums; tgid vs tid; and INF vs ONE?
Date: Tue, 30 Oct 2012 15:45:35 -0700	[thread overview]
Message-ID: <87ip9refzk.fsf@xmission.com> (raw)
In-Reply-To: <50904066.4060404@xdin.com> (Arvid Brodin's message of "Tue, 30 Oct 2012 21:02:33 +0000")

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

  parent reply	other threads:[~2012-10-30 22:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-30 21:02 fs/proc/base.c: text md5sums; tgid vs tid; and INF vs ONE? Arvid Brodin
2012-10-30 21:22 ` Al Viro
2012-11-01 20:22   ` Arvid Brodin
2012-10-30 21:23 ` Cyrill Gorcunov
2012-10-30 22:45 ` Eric W. Biederman [this message]
2012-11-01 20:29   ` Arvid Brodin
2012-11-02 22:49     ` Arvid Brodin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ip9refzk.fsf@xmission.com \
    --to=ebiederm@xmission.com \
    --cc=Arvid.Brodin@xdin.com \
    --cc=akpm@linux-foundation.org \
    --cc=gorcunov@openvz.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rientjes@google.com \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.