mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Smith <dsmith@redhat.com>
To: David Howells <dhowells@redhat.com>
Cc: jmorris@namei.org, linux-kernel@vger.kernel.org,
	roland@redhat.com, fche@redhat.com, oleg@redhat.com,
	linux-security-module@vger.kernel.org
Subject: Re: [PATCH] CRED: Fix SUID exec regression
Date: Fri, 06 Feb 2009 10:32:19 -0600	[thread overview]
Message-ID: <498C6613.1030400@redhat.com> (raw)
In-Reply-To: <20090206114546.4255.74054.stgit@warthog.procyon.org.uk>

David Howells wrote:
> The patch:
> 
> 	commit a6f76f23d297f70e2a6b3ec607f7aeeea9e37e8d
> 	CRED: Make execve() take advantage of copy-on-write credentials
> 
> moved the place in which the 'safeness' of a SUID/SGID exec was performed to
> before de_thread() was called.  This means that LSM_UNSAFE_SHARE is now
> calculated incorrectly.  This flag is set if any of the usage counts for
> fs_struct, files_struct and sighand_struct are greater than 1 at the time the
> determination is made.  All of which are true for threads created by the
> pthread library.
> 
> However, since we wish to make the security calculation before irrevocably
> damaging the process so that we can return it an error code in the case where
> we decide we want to reject the exec request on this basis, we have to make the
> determination before calling de_thread().
> 
> So, instead, we count up the number of threads (CLONE_THREAD) that are sharing
> our fs_struct (CLONE_FS), files_struct (CLONE_FILES) and sighand_structs
> (CLONE_SIGHAND/CLONE_THREAD) with us.  These will be killed by de_thread() and
> so can be discounted by check_unsafe_exec().

...

> Reported-by: David Smith <dsmith@redhat.com>
> Signed-off-by: David Howells <dhowells@redhat.com>

I've tested this patch (applied on top of v2.6.29-rc3-634-g9be260a) and
it applies correctly and fixes the problem.  David, thanks for fixing this.

Acked-by: David Smith <dsmith@redhat.com>

-- 
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)

      reply	other threads:[~2009-02-06 16:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-06 11:45 David Howells
2009-02-06 16:32 ` David Smith [this message]

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=498C6613.1030400@redhat.com \
    --to=dsmith@redhat.com \
    --cc=dhowells@redhat.com \
    --cc=fche@redhat.com \
    --cc=jmorris@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=roland@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®