Skip to content

Commit 4b24356

Browse files
samitolvanenkees
authored andcommitted
treewide: Drop WARN_ON_FUNCTION_MISMATCH
CONFIG_CFI_CLANG no longer breaks cross-module function address equality, which makes WARN_ON_FUNCTION_MISMATCH unnecessary. Remove the definition and switch back to WARN_ON_ONCE. Signed-off-by: Sami Tolvanen <[email protected]> Reviewed-by: Kees Cook <[email protected]> Tested-by: Kees Cook <[email protected]> Tested-by: Nathan Chancellor <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Tested-by: Peter Zijlstra (Intel) <[email protected]> Signed-off-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 607289a commit 4b24356

File tree

3 files changed

+2
-19
lines changed

3 files changed

+2
-19
lines changed

include/asm-generic/bug.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -220,22 +220,6 @@ extern __printf(1, 2) void __warn_printk(const char *fmt, ...);
220220
# define WARN_ON_SMP(x) ({0;})
221221
#endif
222222

223-
/*
224-
* WARN_ON_FUNCTION_MISMATCH() warns if a value doesn't match a
225-
* function address, and can be useful for catching issues with
226-
* callback functions, for example.
227-
*
228-
* With CONFIG_CFI_CLANG, the warning is disabled because the
229-
* compiler replaces function addresses taken in C code with
230-
* local jump table addresses, which breaks cross-module function
231-
* address equality.
232-
*/
233-
#if defined(CONFIG_CFI_CLANG) && defined(CONFIG_MODULES)
234-
# define WARN_ON_FUNCTION_MISMATCH(x, fn) ({ 0; })
235-
#else
236-
# define WARN_ON_FUNCTION_MISMATCH(x, fn) WARN_ON_ONCE((x) != (fn))
237-
#endif
238-
239223
#endif /* __ASSEMBLY__ */
240224

241225
#endif

kernel/kthread.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,8 +1050,7 @@ static void __kthread_queue_delayed_work(struct kthread_worker *worker,
10501050
struct timer_list *timer = &dwork->timer;
10511051
struct kthread_work *work = &dwork->work;
10521052

1053-
WARN_ON_FUNCTION_MISMATCH(timer->function,
1054-
kthread_delayed_work_timer_fn);
1053+
WARN_ON_ONCE(timer->function != kthread_delayed_work_timer_fn);
10551054

10561055
/*
10571056
* If @delay is 0, queue @dwork->work immediately. This is for

kernel/workqueue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1651,7 +1651,7 @@ static void __queue_delayed_work(int cpu, struct workqueue_struct *wq,
16511651
struct work_struct *work = &dwork->work;
16521652

16531653
WARN_ON_ONCE(!wq);
1654-
WARN_ON_FUNCTION_MISMATCH(timer->function, delayed_work_timer_fn);
1654+
WARN_ON_ONCE(timer->function != delayed_work_timer_fn);
16551655
WARN_ON_ONCE(timer_pending(timer));
16561656
WARN_ON_ONCE(!list_empty(&work->entry));
16571657

0 commit comments

Comments
 (0)