All of lore.kernel.org
 help / color / mirror / Atom feed
From: "tip-bot2 for Peter Zijlstra" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Randy Dunlap <rdunlap@infradead.org>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	broonie@kernel.org, sfr@canb.auug.org.au,
	akpm@linux-foundation.org, mhocko@suse.cz,
	Ingo Molnar <mingo@kernel.org>, Borislav Petkov <bp@alien8.de>,
	linux-kernel@vger.kernel.org
Subject: [tip: x86/urgent] x86/uaccess: Don't leak the AC flags into __get_user() argument evaluation
Date: Mon, 02 Sep 2019 12:34:45 -0000	[thread overview]
Message-ID: <156742768563.30370.14506895450404848829.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20190829082445.GM2369@hirez.programming.kicks-ass.net>

The following commit has been merged into the x86/urgent branch of tip:

Commit-ID:     9b8bd476e78e89c9ea26c3b435ad0201c3d7dbf5
Gitweb:        https://git.kernel.org/tip/9b8bd476e78e89c9ea26c3b435ad0201c3d7dbf5
Author:        Peter Zijlstra <peterz@infradead.org>
AuthorDate:    Thu, 29 Aug 2019 10:24:45 +02:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Mon, 02 Sep 2019 14:22:38 +02:00

x86/uaccess: Don't leak the AC flags into __get_user() argument evaluation

Identical to __put_user(); the __get_user() argument evalution will too
leak UBSAN crud into the __uaccess_begin() / __uaccess_end() region.
While uncommon this was observed to happen for:

  drivers/xen/gntdev.c: if (__get_user(old_status, batch->status[i]))

where UBSAN added array bound checking.

This complements commit:

  6ae865615fc4 ("x86/uaccess: Dont leak the AC flag into __put_user() argument evaluation")

Tested-by Sedat Dilek <sedat.dilek@gmail.com>
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Cc: broonie@kernel.org
Cc: sfr@canb.auug.org.au
Cc: akpm@linux-foundation.org
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: mhocko@suse.cz
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://lkml.kernel.org/r/20190829082445.GM2369@hirez.programming.kicks-ass.net
---
 arch/x86/include/asm/uaccess.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h
index 9c44353..35c225e 100644
--- a/arch/x86/include/asm/uaccess.h
+++ b/arch/x86/include/asm/uaccess.h
@@ -444,8 +444,10 @@ __pu_label:							\
 ({									\
 	int __gu_err;							\
 	__inttype(*(ptr)) __gu_val;					\
+	__typeof__(ptr) __gu_ptr = (ptr);				\
+	__typeof__(size) __gu_size = (size);				\
 	__uaccess_begin_nospec();					\
-	__get_user_size(__gu_val, (ptr), (size), __gu_err, -EFAULT);	\
+	__get_user_size(__gu_val, __gu_ptr, __gu_size, __gu_err, -EFAULT);	\
 	__uaccess_end();						\
 	(x) = (__force __typeof__(*(ptr)))__gu_val;			\
 	__builtin_expect(__gu_err, 0);					\

  parent reply	other threads:[~2019-09-02 12:35 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-28  3:40 mmotm 2019-08-27-20-39 uploaded akpm
2019-08-28 16:58 ` mmotm 2019-08-27-20-39 uploaded (objtool: xen) Randy Dunlap
2019-08-28 17:19   ` Josh Poimboeuf
2019-08-28 17:56     ` Randy Dunlap
2019-08-28 20:01       ` Josh Poimboeuf
2019-08-29  8:24         ` Peter Zijlstra
2019-08-29 23:37           ` Josh Poimboeuf
2019-08-30  4:10             ` Sedat Dilek
2019-08-30  4:10               ` Sedat Dilek
2019-09-02 12:34           ` tip-bot2 for Peter Zijlstra [this message]
2019-08-28 17:59 ` mmotm 2019-08-27-20-39 uploaded (gpu/drm/amd/display/) Randy Dunlap
2019-08-28 18:53   ` Alex Deucher
2019-08-28 18:53     ` Alex Deucher
2019-08-28 18:30 ` mmotm 2019-08-27-20-39 uploaded (sound/hda/intel-nhlt.c) Randy Dunlap
2019-08-28 19:28   ` Pierre-Louis Bossart
2019-08-28 21:06     ` Randy Dunlap
2019-08-28 22:20       ` Pierre-Louis Bossart
2019-08-28 22:45         ` Pierre-Louis Bossart
2019-08-28 22:59           ` Randy Dunlap
2019-08-29  2:26             ` Randy Dunlap
2019-08-29 15:08           ` [alsa-devel] " Takashi Iwai
2019-08-29 15:08             ` Takashi Iwai
2019-08-29 16:22             ` Pierre-Louis Bossart

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=156742768563.30370.14506895450404848829.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=broonie@kernel.org \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mhocko@suse.cz \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rdunlap@infradead.org \
    --cc=sfr@canb.auug.org.au \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.