lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue,  4 May 2021 22:54:29 -0500
From:   Josh Poimboeuf <jpoimboe@...hat.com>
To:     Al Viro <viro@...iv.linux.org.uk>
Cc:     x86@...nel.org, linux-kernel@...r.kernel.org,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Will Deacon <will@...nel.org>,
        Dan Williams <dan.j.williams@...el.com>,
        Andrea Arcangeli <aarcange@...hat.com>,
        Waiman Long <longman@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Andrew Cooper <andrew.cooper3@...rix.com>,
        Andy Lutomirski <luto@...nel.org>,
        Christoph Hellwig <hch@....de>,
        David Laight <David.Laight@...lab.com>,
        Mark Rutland <mark.rutland@....com>,
        Borislav Petkov <bp@...en8.de>, Arnd Bergmann <arnd@...db.de>,
        Stephen Rothwell <sfr@...b.auug.org.au>,
        Sami Tolvanen <samitolvanen@...gle.com>
Subject: [PATCH v4 1/4] uaccess: Always inline strn*_user() helper functions

CONFIG_DEBUG_SECTION_MISMATCH uses -fno-inline-functions-called-once,
causing these single-called helper functions to not get inlined:

  lib/strncpy_from_user.o: warning: objtool: strncpy_from_user()+0xa3: call to do_strncpy_from_user() with UACCESS enabled
  lib/strnlen_user.o: warning: objtool: strnlen_user()+0x73: call to do_strnlen_user() with UACCESS enabled

Always inline them regardless.

Reported-by: Arnd Bergmann <arnd@...db.de>
Reported-by: Stephen Rothwell <sfr@...b.auug.org.au>
Reported-by: Sami Tolvanen <samitolvanen@...gle.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@...hat.com>
---
 lib/strncpy_from_user.c | 6 ++++--
 lib/strnlen_user.c      | 4 +++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/strncpy_from_user.c b/lib/strncpy_from_user.c
index 122d8d0e253c..388539951116 100644
--- a/lib/strncpy_from_user.c
+++ b/lib/strncpy_from_user.c
@@ -25,8 +25,10 @@
  * hit it), 'max' is the address space maximum (and we return
  * -EFAULT if we hit it).
  */
-static inline long do_strncpy_from_user(char *dst, const char __user *src,
-					unsigned long count, unsigned long max)
+static __always_inline long do_strncpy_from_user(char *dst,
+						 const char __user *src,
+						 unsigned long count,
+						 unsigned long max)
 {
 	const struct word_at_a_time constants = WORD_AT_A_TIME_CONSTANTS;
 	unsigned long res = 0;
diff --git a/lib/strnlen_user.c b/lib/strnlen_user.c
index 1616710b8a82..378744e96039 100644
--- a/lib/strnlen_user.c
+++ b/lib/strnlen_user.c
@@ -20,7 +20,9 @@
  * if it fits in a aligned 'long'. The caller needs to check
  * the return value against "> max".
  */
-static inline long do_strnlen_user(const char __user *src, unsigned long count, unsigned long max)
+static __always_inline long do_strnlen_user(const char __user *src,
+					    unsigned long count,
+					    unsigned long max)
 {
 	const struct word_at_a_time constants = WORD_AT_A_TIME_CONSTANTS;
 	unsigned long align, res = 0;
-- 
2.31.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ