lkml.org 
[lkml]   [2017]   [Sep]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/3] locking/rwsem/x86: Add stack frame dependency for __downgrade_write()
Date
kernel/locking/rwsem.o: warning: objtool: downgrade_write()+0x22: call without frame pointer save/setup

The warning means gcc 7.2.0 placed the __downgrade_write() inline asm (and
its call instruction) before the frame pointer setup in downgrade_write(),
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@linux.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 d26b6916b935..a749dc6a3103 100644
--- a/arch/x86/include/asm/rwsem.h
+++ b/arch/x86/include/asm/rwsem.h
@@ -205,8 +205,10 @@ static inline void __up_write(struct rw_semaphore *sem)
*/
static inline void __downgrade_write(struct rw_semaphore *sem)
{
+ register void *__sp asm(_ASM_SP);
+
asm volatile("# beginning __downgrade_write\n\t"
- LOCK_PREFIX _ASM_ADD "%2,(%1)\n\t"
+ LOCK_PREFIX _ASM_ADD "%2,(%2)\n\t"
/*
* transitions 0xZZZZ0001 -> 0xYYYY0001 (i386)
* 0xZZZZZZZZ00000001 -> 0xYYYYYYYY00000001 (x86_64)
@@ -215,7 +217,7 @@ static inline void __downgrade_write(struct rw_semaphore *sem)
" call call_rwsem_downgrade_wake\n"
"1:\n\t"
"# ending __downgrade_write\n"
- : "+m" (sem->count)
+ : "+m" (sem->count), "+r" (__sp)
: "a" (sem), "er" (-RWSEM_WAITING_BIAS)
: "memory", "cc");
}
--
2.14.1
\
 
 \ /
  Last update: 2017-09-06 07:28    [W:0.122 / U:32.916 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site