Skip to content

Commit 83aec96

Browse files
benzearichardweinberger
authored andcommitted
um: Mark 32bit syscall helpers as clobbering memory
The 64bit helper are marked to clobber the memory, but the 32bit ones are not. Add the appropriate clobber to the 32bit helper routines so that the compiler cannot do invalid optimizations. Signed-off-by: Benjamin Berg <benjamin@sipsolutions.net> Signed-off-by: Richard Weinberger <richard@nod.at>
1 parent 1e41c41 commit 83aec96

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

arch/x86/um/shared/sysdep/stub_32.h

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ static __always_inline long stub_syscall0(long syscall)
1616
{
1717
long ret;
1818

19-
__asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall));
19+
__asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall)
20+
: "memory");
2021

2122
return ret;
2223
}
@@ -25,7 +26,8 @@ static __always_inline long stub_syscall1(long syscall, long arg1)
2526
{
2627
long ret;
2728

28-
__asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1));
29+
__asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1)
30+
: "memory");
2931

3032
return ret;
3133
}
@@ -35,7 +37,8 @@ static __always_inline long stub_syscall2(long syscall, long arg1, long arg2)
3537
long ret;
3638

3739
__asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1),
38-
"c" (arg2));
40+
"c" (arg2)
41+
: "memory");
3942

4043
return ret;
4144
}
@@ -46,7 +49,8 @@ static __always_inline long stub_syscall3(long syscall, long arg1, long arg2,
4649
long ret;
4750

4851
__asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1),
49-
"c" (arg2), "d" (arg3));
52+
"c" (arg2), "d" (arg3)
53+
: "memory");
5054

5155
return ret;
5256
}
@@ -57,7 +61,8 @@ static __always_inline long stub_syscall4(long syscall, long arg1, long arg2,
5761
long ret;
5862

5963
__asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1),
60-
"c" (arg2), "d" (arg3), "S" (arg4));
64+
"c" (arg2), "d" (arg3), "S" (arg4)
65+
: "memory");
6166

6267
return ret;
6368
}
@@ -68,7 +73,8 @@ static __always_inline long stub_syscall5(long syscall, long arg1, long arg2,
6873
long ret;
6974

7075
__asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1),
71-
"c" (arg2), "d" (arg3), "S" (arg4), "D" (arg5));
76+
"c" (arg2), "d" (arg3), "S" (arg4), "D" (arg5)
77+
: "memory");
7278

7379
return ret;
7480
}

0 commit comments

Comments
 (0)