lkml.org 
[lkml]   [2018]   [Jun]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] sys: don't hold uts_sem while accessing userspace memory
On Tue, Jun 26, 2018 at 7:43 PM Ben Hutchings <ben@decadent.org.uk> wrote:
>
> On Mon, 2018-06-25 at 20:16 +0200, Jann Horn wrote:
> > On Mon, Jun 25, 2018 at 6:41 PM Al Viro <viro@zeniv.linux.org.uk> wrote:
> > >
> > > On Mon, Jun 25, 2018 at 06:34:10PM +0200, Jann Horn wrote:
> > >
> > > > + char tmp[32];
> > > >
> > > > - if (namelen > 32)
> > > > + if (namelen < 0 || namelen > 32)
> > > > namelen = 32;
> > > >
> > > > down_read(&uts_sem);
> > > > kname = utsname()->domainname;
> > > > len = strnlen(kname, namelen);
> > > > - if (copy_to_user(name, kname, min(len + 1, namelen)))
> > > > - err = -EFAULT;
> > > > + len = min(len + 1, namelen);
> > > > + memcpy(tmp, kname, len);
> > > > up_read(&uts_sem);
> > > >
> > > > - return err;
> > > > + if (copy_to_user(name, tmp, len))
> > > > + return -EFAULT;
> > >
> > > Infoleak, and similar in a lot of other places.
> >
> > I don't see a problem. copy_to_user() copies "len" bytes from "tmp".
> [...]
> > Can you please explain why there is an infoleak here?
>
> I think you're *fixing* information leaks in the Alpha syscalls,
> because a negative value of namelen used to result in a huge length
> argument to copy_to_user().

Ah, you're right. Looks like this was previously fixed in commit
21c5977a836e ("alpha: fix several security issues", first in v3.0),
and then un-fixed in commit 9ba3eb5103cf ("osf_getdomainname(): use
copy_to_user()", first in v4.13).

\
 
 \ /
  Last update: 2018-06-27 14:30    [W:0.063 / U:0.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site