From: Daniel Borkmann <dborkman@redhat.com>
To: David Laight <David.Laight@ACULAB.COM>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
Eric Dumazet <edumazet@google.com>,
"Eric W. Biederman" <ebiederm@xmission.com>
Subject: Re: [PATCH net] net: unix: inherit SOCK_PASS{CRED,SEC} flags from socket to fix race
Date: Fri, 18 Oct 2013 10:42:17 +0200 [thread overview]
Message-ID: <5260F469.5060601@redhat.com> (raw)
In-Reply-To: <AE90C24D6B3A694183C094C60CF0A2F6026B7395@saturn3.aculab.com>
On 10/18/2013 10:26 AM, David Laight wrote:
>> Subject: [PATCH net] net: unix: inherit SOCK_PASS{CRED,SEC} flags from socket to fix race
>>
>> In the case of credentials passing in unix stream sockets (dgram
>> sockets seem not affected), we get a rather sparse race after
>> commit 16e5726 ("af_unix: dont send SCM_CREDENTIALS by default").
> ...
>> +static void unix_sock_inherit_flags(const struct socket *old,
>> + struct socket *new)
>> +{
>> + if (test_bit(SOCK_PASSCRED, &old->flags))
>> + set_bit(SOCK_PASSCRED, &new->flags);
>> + if (test_bit(SOCK_PASSSEC, &old->flags))
>> + set_bit(SOCK_PASSSEC, &new->flags);
>> +}
>> +
>
> Isn't that just:
> new->flags |= old->flags & (PASSCRED | SOCK_PASSSEC);
Nope, please have a look at the individual test_bit() etc
implementations under arch/, and the definitions of
SOCK_PASSCRED and SOCK_PASSSEC.
I though about just setting new->flags = old->flags, but that
would probably be _not_ a good idea, as we actually do not want
to pass other flags than these two relevant ones onwards.
> David
next prev parent reply other threads:[~2013-10-18 8:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1382042286.git.dborkman@redhat.com>
2013-10-17 20:51 ` [PATCH net] net: unix: inherit SOCK_PASS{CRED,SEC} flags from socket to fix race Daniel Borkmann
2013-10-18 8:26 ` David Laight
2013-10-18 8:42 ` Daniel Borkmann [this message]
2013-10-19 22:50 ` David Miller
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=5260F469.5060601@redhat.com \
--to=dborkman@redhat.com \
--cc=David.Laight@ACULAB.COM \
--cc=davem@davemloft.net \
--cc=ebiederm@xmission.com \
--cc=edumazet@google.com \
--cc=netdev@vger.kernel.org \
/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.