public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: ebiederm@xmission•com (Eric W. Biederman)
To: Andy Lutomirski <luto@amacapital•net>
Cc: netdev@vger•kernel.org, containers@lists•linux-foundation.org
Subject: Re: [PATCH 1/3] net: Clean up SCM_CREDENTIALS code
Date: Wed, 20 Mar 2013 23:54:05 -0700	[thread overview]
Message-ID: <87k3p1z1iq.fsf@xmission.com> (raw)
In-Reply-To: <3d7ffb6d9b73971f1a526fc490ef84ef7a33eecc.1363815201.git.luto@amacapital.net> (Andy Lutomirski's message of "Wed, 20 Mar 2013 14:38:38 -0700")

Andy Lutomirski <luto@amacapital•net> writes:

> I was curious whether the uids, gids, and pids passed around worked
> correctly in the presence of multiple namespaces.  I gave up trying
> to figure it out: there are two copies of the pid (one of which has
> type u32, which is odd), a struct cred * (!), and a separate kuid
> and kgid.  IOW, all of the relevant data is stored twice, and it's
> unclear which copy is used when.
>
> I also wondered what prevented a SO_CREDENTIALS message from being
> recieved when the credentials weren't filled out.  Answer: not very
> much (and there have been serious security bugs here in the past).
>
> So just rewrite the thing to store a pid_t relative to the init pid
> ns, a kuid, and a kgid, and to explicitly track whether the data is
> filled out.
>
> I haven't played with the secid code.  I have no idea whether it has
> similar problems.
>
> I haven't benchmarked this, but it should be a respectable speedup
> in the cases where the credentials are in use.

The basic principle of no longer passing the struct cred we can
certainly do.

I am less convinced about the struct pid, but arguably that is the
proper approach.

A patch that proclaims that you didn't understand what the code was
doing but you changed it anyway, suggests there are subtle bugs
in there that you overlooked.

Certainly killing NETLINK_CB(sbk).ssk is a bug.

I do think there is a lot of good stuff in here and if you break this up
into smaller patches simpler patches, and keep an eye on the speed of
sending things messages without credentials.  I am pretty certain you
can cook up something that is mergable.

Eric

  parent reply	other threads:[~2013-03-21  6:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-20 21:38 [PATCH 0/3] Clean up and fix SCM_CREDENTIALS code Andy Lutomirski
     [not found] ` <cover.1363815201.git.luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org>
2013-03-20 21:38   ` [PATCH 1/3] net: Clean up " Andy Lutomirski
2013-03-21  2:15     ` James Morris
2013-03-21  6:54     ` Eric W. Biederman [this message]
     [not found]       ` <87k3p1z1iq.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2013-03-21 17:52         ` Andy Lutomirski
2013-03-20 21:38   ` [PATCH 2/3] netlink: Remove an unused pointer in netlink_skb_parms Andy Lutomirski
     [not found]     ` <a8766c8b116b5e6fcaa932fe94f84a584554b98f.1363815201.git.luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org>
2013-03-21  6:36       ` Eric W. Biederman
     [not found]         ` <87d2ut1cpj.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2013-03-21 17:41           ` Andy Lutomirski
2013-03-20 21:38 ` [PATCH 3/3] net: Remove sock_iocb.scm Andy Lutomirski

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=87k3p1z1iq.fsf@xmission.com \
    --to=ebiederm@xmission$(echo .)com \
    --cc=containers@lists$(echo .)linux-foundation.org \
    --cc=luto@amacapital$(echo .)net \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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