Skip to content

Commit 1fe4002

Browse files
Peter Zijlstraingomolnar
authored andcommitted
x86/ptrace: Always inline trivial accessors
A KASAN build bloats these single load/store helpers such that it fails to inline them: vmlinux.o: error: objtool: irqentry_exit+0x5e8: call to instruction_pointer_set() with UACCESS enabled Make sure the compiler isn't allowed to do stupid. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://patch.msgid.link/20251031105435.GU4068168@noisy.programming.kicks-ass.net
1 parent 323d93f commit 1fe4002

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

arch/x86/include/asm/ptrace.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,12 @@ convert_ip_to_linear(struct task_struct *child, struct pt_regs *regs);
187187
extern void send_sigtrap(struct pt_regs *regs, int error_code, int si_code);
188188

189189

190-
static inline unsigned long regs_return_value(struct pt_regs *regs)
190+
static __always_inline unsigned long regs_return_value(struct pt_regs *regs)
191191
{
192192
return regs->ax;
193193
}
194194

195-
static inline void regs_set_return_value(struct pt_regs *regs, unsigned long rc)
195+
static __always_inline void regs_set_return_value(struct pt_regs *regs, unsigned long rc)
196196
{
197197
regs->ax = rc;
198198
}
@@ -277,34 +277,34 @@ static __always_inline bool ip_within_syscall_gap(struct pt_regs *regs)
277277
}
278278
#endif
279279

280-
static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
280+
static __always_inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
281281
{
282282
return regs->sp;
283283
}
284284

285-
static inline unsigned long instruction_pointer(struct pt_regs *regs)
285+
static __always_inline unsigned long instruction_pointer(struct pt_regs *regs)
286286
{
287287
return regs->ip;
288288
}
289289

290-
static inline void instruction_pointer_set(struct pt_regs *regs,
291-
unsigned long val)
290+
static __always_inline
291+
void instruction_pointer_set(struct pt_regs *regs, unsigned long val)
292292
{
293293
regs->ip = val;
294294
}
295295

296-
static inline unsigned long frame_pointer(struct pt_regs *regs)
296+
static __always_inline unsigned long frame_pointer(struct pt_regs *regs)
297297
{
298298
return regs->bp;
299299
}
300300

301-
static inline unsigned long user_stack_pointer(struct pt_regs *regs)
301+
static __always_inline unsigned long user_stack_pointer(struct pt_regs *regs)
302302
{
303303
return regs->sp;
304304
}
305305

306-
static inline void user_stack_pointer_set(struct pt_regs *regs,
307-
unsigned long val)
306+
static __always_inline
307+
void user_stack_pointer_set(struct pt_regs *regs, unsigned long val)
308308
{
309309
regs->sp = val;
310310
}

0 commit comments

Comments
 (0)