Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

cleanup: Always inline everything

KASAN bloat caused cleanup helper functions to not get inlined:

vmlinux.o: error: objtool: irqentry_exit+0x323: call to class_user_rw_access_destructor() with UACCESS enabled

Force inline all the cleanup helpers like they already are on normal
builds.

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

authored by

Peter Zijlstra and committed by
Ingo Molnar
323d93f0 32034df6

+15 -15
+15 -15
include/linux/cleanup.h
··· 208 208 */ 209 209 210 210 #define DEFINE_FREE(_name, _type, _free) \ 211 - static inline void __free_##_name(void *p) { _type _T = *(_type *)p; _free; } 211 + static __always_inline void __free_##_name(void *p) { _type _T = *(_type *)p; _free; } 212 212 213 213 #define __free(_name) __cleanup(__free_##_name) 214 214 ··· 220 220 __val; \ 221 221 }) 222 222 223 - static inline __must_check 223 + static __always_inline __must_check 224 224 const volatile void * __must_check_fn(const volatile void *val) 225 225 { return val; } 226 226 ··· 274 274 275 275 #define DEFINE_CLASS(_name, _type, _exit, _init, _init_args...) \ 276 276 typedef _type class_##_name##_t; \ 277 - static inline void class_##_name##_destructor(_type *p) \ 277 + static __always_inline void class_##_name##_destructor(_type *p) \ 278 278 { _type _T = *p; _exit; } \ 279 - static inline _type class_##_name##_constructor(_init_args) \ 279 + static __always_inline _type class_##_name##_constructor(_init_args) \ 280 280 { _type t = _init; return t; } 281 281 282 282 #define EXTEND_CLASS(_name, ext, _init, _init_args...) \ 283 283 typedef class_##_name##_t class_##_name##ext##_t; \ 284 - static inline void class_##_name##ext##_destructor(class_##_name##_t *p)\ 284 + static __always_inline void class_##_name##ext##_destructor(class_##_name##_t *p) \ 285 285 { class_##_name##_destructor(p); } \ 286 - static inline class_##_name##_t class_##_name##ext##_constructor(_init_args) \ 286 + static __always_inline class_##_name##_t class_##_name##ext##_constructor(_init_args) \ 287 287 { class_##_name##_t t = _init; return t; } 288 288 289 289 #define CLASS(_name, var) \ ··· 347 347 }) 348 348 349 349 #define __DEFINE_GUARD_LOCK_PTR(_name, _exp) \ 350 - static inline void *class_##_name##_lock_ptr(class_##_name##_t *_T) \ 350 + static __always_inline void *class_##_name##_lock_ptr(class_##_name##_t *_T) \ 351 351 { \ 352 352 void *_ptr = (void *)(__force unsigned long)*(_exp); \ 353 353 if (IS_ERR(_ptr)) { \ ··· 355 355 } \ 356 356 return _ptr; \ 357 357 } \ 358 - static inline int class_##_name##_lock_err(class_##_name##_t *_T) \ 358 + static __always_inline int class_##_name##_lock_err(class_##_name##_t *_T) \ 359 359 { \ 360 360 long _rc = (__force unsigned long)*(_exp); \ 361 361 if (!_rc) { \ ··· 384 384 EXTEND_CLASS(_name, _ext, \ 385 385 ({ void *_t = _T; int _RET = (_lock); if (_T && !(_cond)) _t = ERR_PTR(_RET); _t; }), \ 386 386 class_##_name##_t _T) \ 387 - static inline void * class_##_name##_ext##_lock_ptr(class_##_name##_t *_T) \ 387 + static __always_inline void * class_##_name##_ext##_lock_ptr(class_##_name##_t *_T) \ 388 388 { return class_##_name##_lock_ptr(_T); } \ 389 - static inline int class_##_name##_ext##_lock_err(class_##_name##_t *_T) \ 389 + static __always_inline int class_##_name##_ext##_lock_err(class_##_name##_t *_T) \ 390 390 { return class_##_name##_lock_err(_T); } 391 391 392 392 /* ··· 466 466 __VA_ARGS__; \ 467 467 } class_##_name##_t; \ 468 468 \ 469 - static inline void class_##_name##_destructor(class_##_name##_t *_T) \ 469 + static __always_inline void class_##_name##_destructor(class_##_name##_t *_T) \ 470 470 { \ 471 471 if (!__GUARD_IS_ERR(_T->lock)) { _unlock; } \ 472 472 } \ ··· 474 474 __DEFINE_GUARD_LOCK_PTR(_name, &_T->lock) 475 475 476 476 #define __DEFINE_LOCK_GUARD_1(_name, _type, _lock) \ 477 - static inline class_##_name##_t class_##_name##_constructor(_type *l) \ 477 + static __always_inline class_##_name##_t class_##_name##_constructor(_type *l) \ 478 478 { \ 479 479 class_##_name##_t _t = { .lock = l }, *_T = &_t; \ 480 480 _lock; \ ··· 482 482 } 483 483 484 484 #define __DEFINE_LOCK_GUARD_0(_name, _lock) \ 485 - static inline class_##_name##_t class_##_name##_constructor(void) \ 485 + static __always_inline class_##_name##_t class_##_name##_constructor(void) \ 486 486 { \ 487 487 class_##_name##_t _t = { .lock = (void*)1 }, \ 488 488 *_T __maybe_unused = &_t; \ ··· 508 508 if (_T->lock && !(_cond)) _T->lock = ERR_PTR(_RET);\ 509 509 _t; }), \ 510 510 typeof_member(class_##_name##_t, lock) l) \ 511 - static inline void * class_##_name##_ext##_lock_ptr(class_##_name##_t *_T) \ 511 + static __always_inline void * class_##_name##_ext##_lock_ptr(class_##_name##_t *_T) \ 512 512 { return class_##_name##_lock_ptr(_T); } \ 513 - static inline int class_##_name##_ext##_lock_err(class_##_name##_t *_T) \ 513 + static __always_inline int class_##_name##_ext##_lock_err(class_##_name##_t *_T) \ 514 514 { return class_##_name##_lock_err(_T); } 515 515 516 516 #define DEFINE_LOCK_GUARD_1_COND_3(_name, _ext, _lock) \