Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1264736
| From | Kees Cook <keescook@chromium.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC] namei: prevent sgid-hardlinks for unmapped gids |
| Date | 2015-11-07 06:10 +0100 |
| Message-ID | <qs3Vf-6iB-1@gated-at.bofh.it> (permalink) |
| References | (7 earlier) <qrXd8-1Iu-23@gated-at.bofh.it> <qrXPP-2cX-11@gated-at.bofh.it> <qrZoB-3h8-1@gated-at.bofh.it> <qrZoC-3h8-13@gated-at.bofh.it> <qrZRD-3rI-15@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, Nov 6, 2015 at 4:48 PM, Andy Lutomirski <luto@amacapital.net> wrote: > On Fri, Nov 6, 2015 at 4:16 PM, Kees Cook <keescook@chromium.org> wrote: >> On Fri, Nov 6, 2015 at 4:11 PM, Kees Cook <keescook@chromium.org> wrote: >>> On Fri, Nov 6, 2015 at 2:30 PM, Andy Lutomirski <luto@amacapital.net> wrote: >>>> On Fri, Nov 6, 2015 at 1:59 PM, Kees Cook <keescook@chromium.org> wrote: >>>>> Adding Ted, who might know how this all hooks together. (The context >>>>> is that a write() or truncate() on a setgid file clears the setgid, >>>>> but mmap writes don't.) >>>>> >>>>> On Wed, Nov 4, 2015 at 9:59 AM, Andy Lutomirski <luto@amacapital.net> wrote: >>>>>> 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(). >>>>> >>>>> file_remove_privs() seems to be the right entry point. >>>>> __generic_file_write_iter in mm/filemap.c calls it, though. Are these >>>>> callbacks not used for mmap writes? >>>> >>>> They're certainly not used early enough -- we need to remove suid when >>>> the page becomes writable via mmap (wp_page_shared), not when >>>> writeback happens, or at least not only when writeback happens. >>> >>> Well, I'm shy about the change there. For example, we don't strip in >>> on open(RDWR), just on write(). >> >> I take it back. Hooking wp_page_shared looks expensive. :) Maybe we do >> need to hook the mmap? > > But file_update_time already pokes at the same (or nearby) cachelines, > I think -- why would it be expensive? The whole thing could be > guarded by if (unlikely(is setuid)), right? Yeah, true. I added file_remove_privs calls near all the file_update_time calls, to no effect. Added to wp_page_shared too, nothing. Hmmm. -- Kees Cook Chrome OS Security -- 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 | Next — Previous in thread | Next in thread | Find similar | Unroll 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