Skip to content

Commit 7b84543

Browse files
benzearichardweinberger
authored andcommitted
um: Always inline stub functions
The stub executable page is remapped to a different location in the userland process. As these functions may be used by the stub, they really need to be always inlined rather than permitting the compiler to emit a function. Signed-off-by: Benjamin Berg <benjamin@sipsolutions.net> Signed-off-by: Richard Weinberger <richard@nod.at>
1 parent 6d64095 commit 7b84543

2 files changed

Lines changed: 20 additions & 18 deletions

File tree

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

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#define STUB_MMAP_NR __NR_mmap2
1313
#define MMAP_OFFSET(o) ((o) >> UM_KERN_PAGE_SHIFT)
1414

15-
static inline long stub_syscall0(long syscall)
15+
static __always_inline long stub_syscall0(long syscall)
1616
{
1717
long ret;
1818

@@ -21,7 +21,7 @@ static inline long stub_syscall0(long syscall)
2121
return ret;
2222
}
2323

24-
static inline long stub_syscall1(long syscall, long arg1)
24+
static __always_inline long stub_syscall1(long syscall, long arg1)
2525
{
2626
long ret;
2727

@@ -30,7 +30,7 @@ static inline long stub_syscall1(long syscall, long arg1)
3030
return ret;
3131
}
3232

33-
static inline long stub_syscall2(long syscall, long arg1, long arg2)
33+
static __always_inline long stub_syscall2(long syscall, long arg1, long arg2)
3434
{
3535
long ret;
3636

@@ -40,7 +40,8 @@ static inline long stub_syscall2(long syscall, long arg1, long arg2)
4040
return ret;
4141
}
4242

43-
static inline long stub_syscall3(long syscall, long arg1, long arg2, long arg3)
43+
static __always_inline long stub_syscall3(long syscall, long arg1, long arg2,
44+
long arg3)
4445
{
4546
long ret;
4647

@@ -50,8 +51,8 @@ static inline long stub_syscall3(long syscall, long arg1, long arg2, long arg3)
5051
return ret;
5152
}
5253

53-
static inline long stub_syscall4(long syscall, long arg1, long arg2, long arg3,
54-
long arg4)
54+
static __always_inline long stub_syscall4(long syscall, long arg1, long arg2,
55+
long arg3, long arg4)
5556
{
5657
long ret;
5758

@@ -61,8 +62,8 @@ static inline long stub_syscall4(long syscall, long arg1, long arg2, long arg3,
6162
return ret;
6263
}
6364

64-
static inline long stub_syscall5(long syscall, long arg1, long arg2, long arg3,
65-
long arg4, long arg5)
65+
static __always_inline long stub_syscall5(long syscall, long arg1, long arg2,
66+
long arg3, long arg4, long arg5)
6667
{
6768
long ret;
6869

@@ -72,12 +73,12 @@ static inline long stub_syscall5(long syscall, long arg1, long arg2, long arg3,
7273
return ret;
7374
}
7475

75-
static inline void trap_myself(void)
76+
static __always_inline void trap_myself(void)
7677
{
7778
__asm("int3");
7879
}
7980

80-
static inline void remap_stack_and_trap(void)
81+
static __always_inline void remap_stack_and_trap(void)
8182
{
8283
__asm__ volatile (
8384
"movl %%esp,%%ebx ;"

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#define __syscall_clobber "r11","rcx","memory"
1717
#define __syscall "syscall"
1818

19-
static inline long stub_syscall0(long syscall)
19+
static __always_inline long stub_syscall0(long syscall)
2020
{
2121
long ret;
2222

@@ -27,7 +27,7 @@ static inline long stub_syscall0(long syscall)
2727
return ret;
2828
}
2929

30-
static inline long stub_syscall2(long syscall, long arg1, long arg2)
30+
static __always_inline long stub_syscall2(long syscall, long arg1, long arg2)
3131
{
3232
long ret;
3333

@@ -38,7 +38,8 @@ static inline long stub_syscall2(long syscall, long arg1, long arg2)
3838
return ret;
3939
}
4040

41-
static inline long stub_syscall3(long syscall, long arg1, long arg2, long arg3)
41+
static __always_inline long stub_syscall3(long syscall, long arg1, long arg2,
42+
long arg3)
4243
{
4344
long ret;
4445

@@ -50,7 +51,7 @@ static inline long stub_syscall3(long syscall, long arg1, long arg2, long arg3)
5051
return ret;
5152
}
5253

53-
static inline long stub_syscall4(long syscall, long arg1, long arg2, long arg3,
54+
static __always_inline long stub_syscall4(long syscall, long arg1, long arg2, long arg3,
5455
long arg4)
5556
{
5657
long ret;
@@ -64,8 +65,8 @@ static inline long stub_syscall4(long syscall, long arg1, long arg2, long arg3,
6465
return ret;
6566
}
6667

67-
static inline long stub_syscall5(long syscall, long arg1, long arg2, long arg3,
68-
long arg4, long arg5)
68+
static __always_inline long stub_syscall5(long syscall, long arg1, long arg2,
69+
long arg3, long arg4, long arg5)
6970
{
7071
long ret;
7172

@@ -78,12 +79,12 @@ static inline long stub_syscall5(long syscall, long arg1, long arg2, long arg3,
7879
return ret;
7980
}
8081

81-
static inline void trap_myself(void)
82+
static __always_inline void trap_myself(void)
8283
{
8384
__asm("int3");
8485
}
8586

86-
static inline void remap_stack_and_trap(void)
87+
static __always_inline void remap_stack_and_trap(void)
8788
{
8889
__asm__ volatile (
8990
"movq %0,%%rax ;"

0 commit comments

Comments
 (0)