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


Groups > linux.kernel > #1690349

Re: [PATCH] replace incorrect strscpy use in FORTIFY_SOURCE

From "J . Bruce Fields" <bfields@fieldses.org>
Newsgroups linux.kernel
Subject Re: [PATCH] replace incorrect strscpy use in FORTIFY_SOURCE
Date 2017-07-18 17:00 +0200
Message-ID <u4C8H-3FU-23@gated-at.bofh.it> (permalink)
References <u3gjU-H8-21@gated-at.bofh.it> <u3iF4-28N-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Jul 14, 2017 at 04:51:31PM -0700, Kees Cook wrote:
> On Fri, Jul 14, 2017 at 2:28 PM, Daniel Micay <danielmicay@gmail.com> wrote:
> > Using strscpy was wrong because FORTIFY_SOURCE is passing the maximum
> > possible size of the outermost object, but strscpy defines the count
> > parameter as the exact buffer size, so this could copy past the end of
> > the source. This would still be wrong with the planned usage of
> > __builtin_object_size(p, 1) for intra-object overflow checks since it's
> > the maximum possible size of the specified object with no guarantee of
> > it being that large.
> >
> > Reuse of the fortified functions like this currently makes the runtime
> > error reporting less precise but that can be improved later on.
> >
> > Signed-off-by: Daniel Micay <danielmicay@gmail.com>
> 
> Thanks for fixing this! Linus, do you want to take this directly or
> have it go via -mm where fortify landed originally?
> 
> Acked-by: Kees Cook <keescook@chromium.org>
> 
> As far as testing goes, was the NFS tree not in -next, or was a test
> not running against -next? I'm curious why it took until the NFS tree
> landed in Linus's tree for this to get noticed. Fortify was in -next
> for a while...

There was a last-minute rebase of that tree.  I don't see anything
relevant there.  The code in question has been the same for ages.  But I
most be overlooking something....  I guess it could be interesting to
bisect to figure out when the warning started.

--b.

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


Thread

[PATCH] replace incorrect strscpy use in FORTIFY_SOURCE Daniel Micay <danielmicay@gmail.com> - 2017-07-14 23:30 +0200
  Re: [PATCH] replace incorrect strscpy use in FORTIFY_SOURCE Kees Cook <keescook@chromium.org> - 2017-07-15 02:00 +0200
    Re: [PATCH] replace incorrect strscpy use in FORTIFY_SOURCE Daniel Micay <danielmicay@gmail.com> - 2017-07-15 02:30 +0200
    Re: [PATCH] replace incorrect strscpy use in FORTIFY_SOURCE "J . Bruce Fields" <bfields@fieldses.org> - 2017-07-18 17:00 +0200

csiph-web