Commit 5cf53f3ce3b9 for kernel

commit 5cf53f3ce3b9ff5321b56f9ed9d90d59307be7d0
Author: Elena Petrova <>
Date:   Thu Oct 15 20:13:35 2020 -0700

    sched.h: drop in_ubsan field when UBSAN is in trap mode

    in_ubsan field of task_struct is only used in lib/ubsan.c, which in its
    turn is used only `ifneq ($(CONFIG_UBSAN_TRAP),y)`.

    Removing unnecessary field from a task_struct will help preserve the ABI
    between vanilla and CONFIG_UBSAN_TRAP'ed kernels.  In particular, this
    will help enabling bounds sanitizer transparently for Android's GKI.

    Signed-off-by: Elena Petrova <>
    Signed-off-by: Andrew Morton <>
    Acked-by: Kees Cook <>
    Cc: Jann Horn <>
    Signed-off-by: Linus Torvalds <>

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 9030f3abd969..063cd120b459 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1013,7 +1013,7 @@ struct task_struct {
 	struct held_lock		held_locks[MAX_LOCK_DEPTH];

+#if defined(CONFIG_UBSAN) && !defined(CONFIG_UBSAN_TRAP)
 	unsigned int			in_ubsan;