lkml.org 
[lkml]   [2015]   [Nov]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [RFC] namei: prevent sgid-hardlinks for unmapped gids
On Tue, Nov 3, 2015 at 10:58 PM, Willy Tarreau <w@1wt.eu> wrote:
> On Tue, Nov 03, 2015 at 03:29:55PM -0800, Kees Cook wrote:
>> Using "write" does kill the set-gid bit. I haven't looked at
>> why.
>> Al or anyone else, is there a meaningful distinction here?
>
> I remember this one, I got caught once while trying to put a shell into
> a suid-writable file to get some privileges someone forgot to offer me :-)
>
> It's done by should_remove_suid() which is called upon write() and truncate().
>
>> Should the
>> mmap MAP_SHARED-write trigger the loss of the set-gid bit too? While
>> holding the file open with either open or mmap, I get a Text-in-use
>> error, so I would kind of expect the same behavior between either
>> close() and munmap(). I wonder if this is a bug, and if so, then your
>> link patch is indeed useful again. :)
>
> I don't see how this could be done with mmap(). Maybe we have a way to know
> when the first write is performed via this path, I have no idea.

do_wp_page might be a decent bet.

--Andy


\
 
 \ /
  Last update: 2015-11-04 19:21    [W:0.080 / U:0.356 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site