Re: [PATCH v2] unix: properly account for FDs passed over unix sockets

From: Linus Torvalds
Date: Tue Feb 02 2016 - 15:53:27 EST


On Tue, Feb 2, 2016 at 12:49 PM, Willy Tarreau <w@xxxxxx> wrote:
> On Tue, Feb 02, 2016 at 12:44:54PM -0800, Linus Torvalds wrote:
>>
>> Umm. I think the "struct cred" may change in between, can't it?
>
> You mean for example in case of setuid() or something like this ?

Yeah. I'd be worried about looking up the creds or user structure
later, and possibly getting a different one.

I'd much rather look it up at attach time, and just carry an extra
pointer around. That seems to be an inherently safer model where
there's no worry about "what happens if the user does X in the
meantime".

Linus