Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1262472

Re: [RFC] namei: prevent sgid-hardlinks for unmapped gids

From Andy Lutomirski <luto@amacapital.net>
Newsgroups linux.kernel
Subject Re: [RFC] namei: prevent sgid-hardlinks for unmapped gids
Date 2015-11-04 19:10 +0100
Message-ID <qraFr-3T7-1@gated-at.bofh.it> (permalink)
References (1 earlier) <qqxXr-3T2-3@gated-at.bofh.it> <qqOvg-6ox-15@gated-at.bofh.it> <qqTbz-V1-13@gated-at.bofh.it> <qqTlg-Z8-13@gated-at.bofh.it> <qr0d4-5pG-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH] namei: permit linking with CAP_FOWNER in userns Dirk Steinmetz <public@rsjtdrjgfuzkfg.com> - 2015-11-02 16:20 +0100
  Re: [PATCH] namei: permit linking with CAP_FOWNER in userns Serge Hallyn <serge.hallyn@ubuntu.com> - 2015-11-02 19:10 +0100
    Re: [PATCH] namei: permit linking with CAP_FOWNER in userns Andy Lutomirski <luto@amacapital.net> - 2015-11-02 21:00 +0100
      [RFC] namei: prevent sgid-hardlinks for unmapped gids Dirk Steinmetz <public@rsjtdrjgfuzkfg.com> - 2015-11-03 01:50 +0100
        Re: [RFC] namei: prevent sgid-hardlinks for unmapped gids Serge Hallyn <serge.hallyn@ubuntu.com> - 2015-11-03 16:50 +0100
        Re: [RFC] namei: prevent sgid-hardlinks for unmapped gids Kees Cook <keescook@chromium.org> - 2015-11-03 19:30 +0100
          Re: [RFC] namei: prevent sgid-hardlinks for unmapped gids Dirk Steinmetz <public@rsjtdrjgfuzkfg.com> - 2015-11-04 00:30 +0100
            Re: [RFC] namei: prevent sgid-hardlinks for unmapped gids Kees Cook <keescook@chromium.org> - 2015-11-04 00:40 +0100
              Re: [RFC] namei: prevent sgid-hardlinks for unmapped gids Willy Tarreau <w@1wt.eu> - 2015-11-04 08:00 +0100
                Re: [RFC] namei: prevent sgid-hardlinks for unmapped gids Andy Lutomirski <luto@amacapital.net> - 2015-11-04 19:10 +0100
                Re: [RFC] namei: prevent sgid-hardlinks for unmapped gids Andy Lutomirski <luto@amacapital.net> - 2015-11-04 19:20 +0100
                Re: [RFC] namei: prevent sgid-hardlinks for unmapped gids Willy Tarreau <w@1wt.eu> - 2015-11-04 19:30 +0100
                Re: [RFC] namei: prevent sgid-hardlinks for unmapped gids Willy Tarreau <w@1wt.eu> - 2015-11-04 19:20 +0100
                Re: [RFC] namei: prevent sgid-hardlinks for unmapped gids Kees Cook <keescook@chromium.org> - 2015-11-06 23:00 +0100
                Re: [RFC] namei: prevent sgid-hardlinks for unmapped gids Andy Lutomirski <luto@amacapital.net> - 2015-11-06 23:40 +0100
                Re: [RFC] namei: prevent sgid-hardlinks for unmapped gids Kees Cook <keescook@chromium.org> - 2015-11-07 01:20 +0100
                Re: [RFC] namei: prevent sgid-hardlinks for unmapped gids Kees Cook <keescook@chromium.org> - 2015-11-07 01:20 +0100
                Re: [RFC] namei: prevent sgid-hardlinks for unmapped gids Andy Lutomirski <luto@amacapital.net> - 2015-11-07 01:50 +0100
                Re: [RFC] namei: prevent sgid-hardlinks for unmapped gids Kees Cook <keescook@chromium.org> - 2015-11-07 06:10 +0100
                Re: [RFC] namei: prevent sgid-hardlinks for unmapped gids Theodore Ts'o <tytso@mit.edu> - 2015-11-08 03:10 +0100
                Re: [RFC] namei: prevent sgid-hardlinks for unmapped gids Jan Kara <jack@suse.cz> - 2015-11-10 16:10 +0100
          Re: [RFC] namei: prevent sgid-hardlinks for unmapped gids "Serge E. Hallyn" <serge@hallyn.com> - 2015-11-04 15:50 +0100

csiph-web