From: Ben Hutchings <ben@decadent.org.uk>
To: Jann Horn <jannh@google.com>, Al Viro <viro@zeniv.linux.org.uk>
Cc: rth@twiddle.net, ink@jurassic.park.msu.ru, mattst88@gmail.com,
"David S. Miller" <davem@davemloft.net>,
kernel list <linux-kernel@vger.kernel.org>,
"Eric W. Biederman" <ebiederm@xmission.com>,
linux-alpha@vger.kernel.org, sparclinux@vger.kernel.org,
security@kernel.org, Christoph Hellwig <hch@infradead.org>,
"Serge E. Hallyn" <serge@hallyn.com>
Subject: Re: [PATCH] sys: don't hold uts_sem while accessing userspace memory
Date: Tue, 26 Jun 2018 18:43:10 +0100 [thread overview]
Message-ID: <d23cd44b1e2e1521cedb1c514d392263ed976dca.camel@decadent.org.uk> (raw)
In-Reply-To: <CAG48ez2i2Dpy5TLTjtLiGKdkFDYLGURqAGoTDbETaBGf5SgxPw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1281 bytes --]
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().
Ben.
--
Ben Hutchings
Once a job is fouled up, anything done to improve it makes it worse.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2018-06-26 17:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-25 16:34 Jann Horn
2018-06-25 16:41 ` Al Viro
2018-06-25 18:16 ` Jann Horn
2018-06-26 17:43 ` Ben Hutchings [this message]
2018-06-27 12:29 ` Jann Horn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d23cd44b1e2e1521cedb1c514d392263ed976dca.camel@decadent.org.uk \
--to=ben@decadent.org.uk \
--cc=davem@davemloft.net \
--cc=ebiederm@xmission.com \
--cc=hch@infradead.org \
--cc=ink@jurassic.park.msu.ru \
--cc=jannh@google.com \
--cc=linux-alpha@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mattst88@gmail.com \
--cc=rth@twiddle.net \
--cc=security@kernel.org \
--cc=serge@hallyn.com \
--cc=sparclinux@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®