[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5260F469.5060601@redhat.com>
Date: Fri, 18 Oct 2013 10:42:17 +0200
From: Daniel Borkmann <dborkman@...hat.com>
To: David Laight <David.Laight@...LAB.COM>
CC: davem@...emloft.net, netdev@...r.kernel.org,
Eric Dumazet <edumazet@...gle.com>,
"Eric W. Biederman" <ebiederm@...ssion.com>
Subject: Re: [PATCH net] net: unix: inherit SOCK_PASS{CRED,SEC} flags from
socket to fix race
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
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists