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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 29 Aug 2022 11:22:08 +0530
From:   Sathvika Vasireddy <sv@...ux.ibm.com>
To:     linuxppc-dev@...ts.ozlabs.org
Cc:     jpoimboe@...hat.com, peterz@...radead.org,
        linux-kernel@...r.kernel.org, aik@...abs.ru, mpe@...erman.id.au,
        mingo@...hat.com, christophe.leroy@...roup.eu, rostedt@...dmis.org,
        mbenes@...e.cz, npiggin@...il.com, chenzhongjin@...wei.com,
        naveen.n.rao@...ux.vnet.ibm.com, sv@...ux.ibm.com
Subject: [PATCH v2 01/16] powerpc: Replace unreachable() with it's builtin variant in __WARN_FLAGS()

objtool is throwing *unannotated intra-function call* warnings in
.c files with a few instructions that are marked unreachable. The
problem comes from the annotate_unreachable() macro that is
called by unreachable(). This annotation is adding a call to a
function with size 0, and objtool does not add such symbols
to the rbtree. Due to this reason, find_call_destination() function
is not able to find the destination symbol for that call.

With the annotation (annotate_unreachable()), gcc seems to
generate a 'bl' to unreachable symbol with size 0. But with
the builtin variant of unreachable (__builtin_unreachable()),
gcc does not emit calls to such symbols and the warnings
go away. Given that the codegen remains same, and that
there are no 'bl' instructions to such symbols emitted, fix
these warnings by replacing unreachable() with it's builtin
variant in __WARN_FLAGS().

Also, add barrier_before_unreachable() before __builtin_unreachable()
to work around a gcc bug [1], for the problem reported at [2].

[1]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106751
[2]: https://lkml.org/lkml/2022/8/25/418

Signed-off-by: Sathvika Vasireddy <sv@...ux.ibm.com>
---
 arch/powerpc/include/asm/bug.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/bug.h b/arch/powerpc/include/asm/bug.h
index 61a4736355c2..ef42adb44aa3 100644
--- a/arch/powerpc/include/asm/bug.h
+++ b/arch/powerpc/include/asm/bug.h
@@ -99,7 +99,8 @@
 	__label__ __label_warn_on;				\
 								\
 	WARN_ENTRY("twi 31, 0, 0", BUGFLAG_WARNING | (flags), __label_warn_on); \
-	unreachable();						\
+	barrier_before_unreachable();				\
+	__builtin_unreachable();				\
 								\
 __label_warn_on:						\
 	break;							\
-- 
2.31.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ