[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170919233745.15343-2-miguel.bernal.marin@linux.intel.com>
Date: Tue, 19 Sep 2017 18:37:40 -0500
From: Miguel Bernal Marin <miguel.bernal.marin@...ux.intel.com>
To: Josh Poimboeuf <jpoimboe@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
"H . Peter Anvin" <hpa@...or.com>
Cc: linux-kernel@...r.kernel.org, x86@...nel.org
Subject: [PATCH v3 1/6] locking/rwsem/x86: Add stack frame dependency for __up_read()
kernel/locking/rwsem.o: warning: objtool: up_read()+0x11: call without frame pointer save/setup
The warning means gcc 7.2.0 placed the __up_read() inline asm (and its
call instruction) before the frame pointer setup in up_read(),
which breaks frame pointer convention and can result in incorrect
stack traces.
Force a stack frame to be created before the call instruction by listing
the stack pointer as an output operand in the inline asm statement.
Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@...ux.intel.com>
---
arch/x86/include/asm/rwsem.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/x86/include/asm/rwsem.h b/arch/x86/include/asm/rwsem.h
index a34e0d4b957d..762167afaec0 100644
--- a/arch/x86/include/asm/rwsem.h
+++ b/arch/x86/include/asm/rwsem.h
@@ -166,14 +166,16 @@ static inline bool __down_write_trylock(struct rw_semaphore *sem)
static inline void __up_read(struct rw_semaphore *sem)
{
long tmp;
+ register void *__sp asm(_ASM_SP);
+
asm volatile("# beginning __up_read\n\t"
- LOCK_PREFIX " xadd %1,(%2)\n\t"
+ LOCK_PREFIX " xadd %1,(%3)\n\t"
/* subtracts 1, returns the old value */
" jns 1f\n\t"
" call call_rwsem_wake\n" /* expects old value in %edx */
"1:\n"
"# ending __up_read\n"
- : "+m" (sem->count), "=d" (tmp)
+ : "+m" (sem->count), "=d" (tmp), "+r" (__sp)
: "a" (sem), "1" (-RWSEM_ACTIVE_READ_BIAS)
: "memory", "cc");
}
--
2.14.1
Powered by blists - more mailing lists