Commit 6c22c986 authored by Heiko Carstens's avatar Heiko Carstens Committed by Martin Schwidefsky

s390: avoid extable collisions

We have some inline assemblies where the extable entry points to a
label at the end of an inline assembly which is not followed by an
instruction.

On the other hand we have also inline assemblies where the extable
entry points to the first instruction of an inline assembly.

If a first type inline asm (extable point to empty label at the end)
would be directly followed by a second type inline asm (extable points
to first instruction) then we would have two different extable entries
that point to the same instruction but would have a different target
address.

This can lead to quite random behaviour, depending on sorting order.

I verified that we currently do not have such collisions within the
kernel. However to avoid such subtle bugs add a couple of nop
instructions to those inline assemblies which contain an extable that
points to an empty label.
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent ee64baf4
...@@ -344,7 +344,7 @@ static inline int __diag204(unsigned long subcode, unsigned long size, void *add ...@@ -344,7 +344,7 @@ static inline int __diag204(unsigned long subcode, unsigned long size, void *add
asm volatile( asm volatile(
" diag %2,%0,0x204\n" " diag %2,%0,0x204\n"
"0:\n" "0: nopr %%r7\n"
EX_TABLE(0b,0b) EX_TABLE(0b,0b)
: "+d" (_subcode), "+d" (_size) : "d" (addr) : "memory"); : "+d" (_subcode), "+d" (_size) : "d" (addr) : "memory");
if (_subcode) if (_subcode)
......
...@@ -70,7 +70,7 @@ static int diag2fc(int size, char* query, void *addr) ...@@ -70,7 +70,7 @@ static int diag2fc(int size, char* query, void *addr)
diag_stat_inc(DIAG_STAT_X2FC); diag_stat_inc(DIAG_STAT_X2FC);
asm volatile( asm volatile(
" diag %0,%1,0x2fc\n" " diag %0,%1,0x2fc\n"
"0:\n" "0: nopr %%r7\n"
EX_TABLE(0b,0b) EX_TABLE(0b,0b)
: "=d" (residual_cnt), "+d" (rc) : "0" (&parm_list) : "memory"); : "=d" (residual_cnt), "+d" (rc) : "0" (&parm_list) : "memory");
......
...@@ -49,7 +49,7 @@ static inline void diag10_range(unsigned long start_pfn, unsigned long num_pfn) ...@@ -49,7 +49,7 @@ static inline void diag10_range(unsigned long start_pfn, unsigned long num_pfn)
diag_stat_inc(DIAG_STAT_X010); diag_stat_inc(DIAG_STAT_X010);
asm volatile( asm volatile(
"0: diag %0,%1,0x10\n" "0: diag %0,%1,0x10\n"
"1:\n" "1: nopr %%r7\n"
EX_TABLE(0b, 1b) EX_TABLE(0b, 1b)
EX_TABLE(1b, 1b) EX_TABLE(1b, 1b)
: : "a" (start_addr), "a" (end_addr)); : : "a" (start_addr), "a" (end_addr));
......
...@@ -174,7 +174,7 @@ static inline int __diag308(unsigned long subcode, void *addr) ...@@ -174,7 +174,7 @@ static inline int __diag308(unsigned long subcode, void *addr)
asm volatile( asm volatile(
" diag %0,%2,0x308\n" " diag %0,%2,0x308\n"
"0:\n" "0: nopr %%r7\n"
EX_TABLE(0b,0b) EX_TABLE(0b,0b)
: "+d" (_addr), "+d" (_rc) : "+d" (_addr), "+d" (_rc)
: "d" (subcode) : "cc", "memory"); : "d" (subcode) : "cc", "memory");
......
...@@ -624,7 +624,7 @@ void pfault_fini(void) ...@@ -624,7 +624,7 @@ void pfault_fini(void)
diag_stat_inc(DIAG_STAT_X258); diag_stat_inc(DIAG_STAT_X258);
asm volatile( asm volatile(
" diag %0,0,0x258\n" " diag %0,0,0x258\n"
"0:\n" "0: nopr %%r7\n"
EX_TABLE(0b,0b) EX_TABLE(0b,0b)
: : "a" (&refbk), "m" (refbk) : "cc"); : : "a" (&refbk), "m" (refbk) : "cc");
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment