From: Takashi Iwai <tiwai@suse.de>
To: Meng Xu <meng.xu@gatech.edu>
Cc: Meng Xu <mengxu.gatech@gmail.com>,
alsa-devel@alsa-project.org, perex@perex.cz,
vlad@tsyrklevich.net, linux-kernel@vger.kernel.org,
sanidhya@gatech.edu, taesoo@gatech.edu
Subject: Re: [PATCH] ALSA: asihpi: fix a potential double-fetch bug when copying puhm
Date: Tue, 19 Sep 2017 22:04:55 +0200 [thread overview]
Message-ID: <s5hzi9qe9p4.wl-tiwai@suse.de> (raw)
In-Reply-To: <8b2e7d4a-6b77-ffed-176f-257219b9ecb5@gatech.edu>
On Tue, 19 Sep 2017 15:54:22 +0200,
Meng Xu wrote:
>
> Hi Takashi,
>
> Thanks for the reply. In my opinion, many security issues
> are in fact unhandled corner cases and this could be one.
>
> In the first fetch, get_user(hm->h.size, (u16 __user *)puhm),
> only 2 bytes from puhm are copied in and later it is ensured
> that hm->h.size (which is also hm->m0.size given hm is a union)
> is no larger than sizeof(*hm). However, this relation is broken
> after the second fetch, copy_from_user(hm, puhm, hm->h.size).
>
> As a concrete example, a user could put 0x000A when the first
> fetch happens which make hm->h.size <= sizeof(*hm) and later
> races to change it to 0xFFFF in the second fetch. What makes it
> even worse is this call: hpi_send_recv_f(&hm->m0, &hr->r0, file),
> which sends &hm->m0 to a lot of destinations. If any of the
> downstream functions assumes that hm->m0.size <= sizeof(*hm)
> which is actually not, an exploit can be constructed.
>
> In fact, similar issues have caused vulnerabilities before as in
> https://bugzilla.kernel.org/show_bug.cgi?id=116651
> https://bugzilla.kernel.org/show_bug.cgi?id=120131,
> and more recently the fix in sched/perf
> https://marc.info/?l=linux-kernel&m=150401225812533&w=2
>
> Feel free to let us know your opinion.
OK, now it's clearer, it's about the overwrite by the second
copy_from_user() call. I took the patch as is now.
thanks,
Takashi
prev parent reply other threads:[~2017-09-19 20:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-19 5:21 Meng Xu
2017-09-19 7:27 ` Takashi Iwai
2017-09-19 13:54 ` Meng Xu
2017-09-19 20:04 ` Takashi Iwai [this message]
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=s5hzi9qe9p4.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=linux-kernel@vger.kernel.org \
--cc=meng.xu@gatech.edu \
--cc=mengxu.gatech@gmail.com \
--cc=perex@perex.cz \
--cc=sanidhya@gatech.edu \
--cc=taesoo@gatech.edu \
--cc=vlad@tsyrklevich.net \
/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®