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


Groups > linux.kernel > #1262490

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

From Willy Tarreau <w@1wt.eu>
Newsgroups linux.kernel
Subject Re: [RFC] namei: prevent sgid-hardlinks for unmapped gids
Date 2015-11-04 19:30 +0100
Message-ID <qraYN-411-15@gated-at.bofh.it> (permalink)
References (4 earlier) <qqTlg-Z8-13@gated-at.bofh.it> <qr0d4-5pG-9@gated-at.bofh.it> <qraFr-3T7-1@gated-at.bofh.it> <qraP7-3Xl-9@gated-at.bofh.it> <qraP7-3Xl-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Nov 04, 2015 at 10:17:06AM -0800, Andy Lutomirski wrote:
> > That said I never feel completely comfortable with changing a file's
> > permissions this way, I always fear it could break backup/restore
> > applications. Let's imagine for a minute that a restore does this :
> >
> >  extract(const char *file_name, int file_perms) {
> >    fd = open(".tmpfile", O_CREAT, file_perms);
> >    mmap(fd);
> >    /* actually write file */
> >    close(fd);
> >    unlink(real_file_name);
> >    rename(".tmpfile", file_name);
> >  }
> >
> > Yes I know it's not safe to do the chmod before writing to the file
> > but we could imagine some situations where it makes sense to be done
> > this way (eg: if the file is put into a protected directory), and
> > anyway this possibility is provided by open() and creat() so it is
> > legitimate to imagine these ones could exist.
> >
> > Such a change would slightly modify semantics and affect such use cases
> > *if they exist*, just like using write() instead of mmap() would fail.
> > We could imagine having a sysctl to disable this strengthening, but it
> > is probably not the best solution for the long term either.
> 
> I'd say that this is an acceptable breakage risk.

Yes probably.

> In any event, the
> potential for data loss is limited to a bit of the file mode,

When this bit is the one sudo's setuid, it becomes one of the most important
bits on the whole system :-)

> and
> restore apps like that really don't deserve to work in the first
> place.

I absolutely agree for this specific case. I just wanted to raise this
case so that we're sure not to oversee anything related to other similar
but more justified use cases.

Willy

--
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