Linux-Next Archive on lore.kernel.org
 help / color / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Randy Dunlap <rdunlap@infradead.org>
Cc: akpm@linux-foundation.org, broonie@kernel.org, mhocko@suse.cz,
	sfr@canb.auug.org.au, linux-next@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, mm-commits@vger.kernel.org,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	viro@zeniv.linux.org.uk
Subject: Re: mmotm 2020-06-25-20-36 uploaded (objtool warning)
Date: Tue, 30 Jun 2020 11:59:20 +0200
Message-ID: <20200630095920.GU4817@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <ec31a586-92d0-8b91-bd61-03e53a5bab34@infradead.org>

On Fri, Jun 26, 2020 at 04:35:08PM -0700, Randy Dunlap wrote:
> arch/x86/kernel/sys_ia32.o: warning: objtool: cp_stat64()+0x57: call to new_encode_dev() with UACCESS enabled

That's c120f3b81ede ("x86: switch cp_stat64() to unsafe_put_user()").

Where __put_user() made sure evaluate 'x' before doing
__uaccess_begin(), the new code has no such choice.

The simplest fix is probably something like this.

---
 include/linux/kdev_t.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/kdev_t.h b/include/linux/kdev_t.h
index 85b5151911cf..a840ffef7c19 100644
--- a/include/linux/kdev_t.h
+++ b/include/linux/kdev_t.h
@@ -36,7 +36,7 @@ static inline dev_t old_decode_dev(u16 val)
 	return MKDEV((val >> 8) & 255, val & 255);
 }
 
-static inline u32 new_encode_dev(dev_t dev)
+static __always_inline u32 new_encode_dev(dev_t dev)
 {
 	unsigned major = MAJOR(dev);
 	unsigned minor = MINOR(dev);
@@ -50,7 +50,7 @@ static inline dev_t new_decode_dev(u32 dev)
 	return MKDEV(major, minor);
 }
 
-static inline u64 huge_encode_dev(dev_t dev)
+static __always_inline u64 huge_encode_dev(dev_t dev)
 {
 	return new_encode_dev(dev);
 }

  reply index

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-26  3:37 mmotm 2020-06-25-20-36 uploaded akpm
2020-06-26 16:28 ` mmotm 2020-06-25-20-36 uploaded (mm/slab.c) Randy Dunlap
2020-06-26 20:02   ` Kees Cook
2020-06-26 22:09 ` mmotm 2020-06-25-20-36 uploaded (mm/memory-failure.c) Randy Dunlap
2020-06-27  3:41   ` Andrew Morton
2020-06-26 23:35 ` mmotm 2020-06-25-20-36 uploaded (objtool warning) Randy Dunlap
2020-06-30  9:59   ` Peter Zijlstra [this message]
2020-06-30 15:29     ` 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=20200630095920.GU4817@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=broonie@kernel.org \
    --cc=jpoimboe@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-next@vger.kernel.org \
    --cc=mhocko@suse.cz \
    --cc=mm-commits@vger.kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=sfr@canb.auug.org.au \
    --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

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