Linux-Next Archive on lore.kernel.org
 help / color / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Randy Dunlap <rdunlap@infradead.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>,
	Linux Next Mailing List <linux-next@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	linux@rasmusvillemoes.dk, cyphar@cyphar.com,
	keescook@chromium.org, christian.brauner@ubuntu.com
Subject: Re: linux-next: Tree for Oct 18 (objtool)
Date: Mon, 21 Oct 2019 15:11:49 +0200
Message-ID: <20191021131149.GA19358@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20191021123549.GC1817@hirez.programming.kicks-ass.net>

On Mon, Oct 21, 2019 at 02:35:49PM +0200, Peter Zijlstra wrote:
> On Fri, Oct 18, 2019 at 08:33:11AM -0700, Randy Dunlap wrote:
> > On 10/18/19 12:03 AM, Stephen Rothwell wrote:
> > > Hi all,
> > > 
> > > Changes since 20191017:
> > > 
> > 
> > on x86_64:
> > lib/usercopy.o: warning: objtool: check_zeroed_user()+0x35f: call to __ubsan_handle_shift_out_of_bounds() with UACCESS enabled
> 
> Blergh... I suppose the below will fix that. I'm a bit conflicted on it
> though, the alternative is annotating more ubsan crud.

By popular request; here's that alternative. Completely untested :-)

---
 lib/ubsan.c           | 5 ++++-
 tools/objtool/check.c | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/ubsan.c b/lib/ubsan.c
index 39d5952c4273..0dce3ff45b5b 100644
--- a/lib/ubsan.c
+++ b/lib/ubsan.c
@@ -359,9 +359,10 @@ void __ubsan_handle_shift_out_of_bounds(struct shift_out_of_bounds_data *data,
 	struct type_descriptor *lhs_type = data->lhs_type;
 	char rhs_str[VALUE_LENGTH];
 	char lhs_str[VALUE_LENGTH];
+	unsigned long flags = user_access_save();
 
 	if (suppress_report(&data->location))
-		return;
+		goto out;
 
 	ubsan_prologue(&data->location);
 
@@ -387,6 +388,8 @@ void __ubsan_handle_shift_out_of_bounds(struct shift_out_of_bounds_data *data,
 			lhs_type->type_name);
 
 	ubsan_epilogue();
+out:
+	user_access_restore(flags);
 }
 EXPORT_SYMBOL(__ubsan_handle_shift_out_of_bounds);
 
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 543c068096b1..4768d91c6d68 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -482,6 +482,7 @@ static const char *uaccess_safe_builtin[] = {
 	"ubsan_type_mismatch_common",
 	"__ubsan_handle_type_mismatch",
 	"__ubsan_handle_type_mismatch_v1",
+	"__ubsan_handle_shift_out_of_bounds",
 	/* misc */
 	"csum_partial_copy_generic",
 	"__memcpy_mcsafe",

  reply index

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-18  7:03 linux-next: Tree for Oct 18 Stephen Rothwell
2019-10-18 15:33 ` linux-next: Tree for Oct 18 (objtool) Randy Dunlap
2019-10-21 12:35   ` Peter Zijlstra
2019-10-21 13:11     ` Peter Zijlstra [this message]
2019-10-21 13:19       ` Christian Brauner
2019-10-21 13:47         ` Peter Zijlstra
2019-10-21 19:36           ` Christian Brauner
2019-10-22  7:40             ` Peter Zijlstra
2019-10-22  8:02               ` Christian Brauner
2019-10-21 15:59       ` Randy Dunlap

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=20191021131149.GA19358@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=christian.brauner@ubuntu.com \
    --cc=cyphar@cyphar.com \
    --cc=jpoimboe@redhat.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=rdunlap@infradead.org \
    --cc=sfr@canb.auug.org.au \
    /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

Linux-Next Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-next/0 linux-next/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-next linux-next/ https://lore.kernel.org/linux-next \
		linux-next@vger.kernel.org
	public-inbox-index linux-next

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-next


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git