[PATCH] kasan: include <linux/instruction_pointer.h> for _RET_IP_

1 view
Skip to first unread message

Tao Cui

unread,
Jul 1, 2026, 3:06:13 AMJul 1
to Andrey Ryabinin, Alexander Potapenko, Andrey Konovalov, Dmitry Vyukov, Vincenzo Frascino, Steven Rostedt, mhir...@kernel.org, kasa...@googlegroups.com, linux-...@vger.kernel.org, cui...@kylinos.cn, cui...@linux.dev, kernel test robot
From: Tao Cui <cui...@kylinos.cn>

kasan.h uses _RET_IP_ but relied on <linux/trace_printk.h>, included via
<linux/kernel.h>, to provide it. Commit 9cbc3d9806d3 ("tracing: Remove
trace_printk.h from kernel.h") dropped that transitive include, so files
that don't otherwise get instruction_pointer.h no longer build, e.g.
kernel/scs.c on arm64 KASAN:

include/linux/kasan.h:199:43: error: use of undeclared identifier '_RET_IP_'

Include <linux/instruction_pointer.h> directly to make the dependency
explicit.

Fixes: 9cbc3d9806d3 ("tracing: Remove trace_printk.h from kernel.h")
Reported-by: kernel test robot <l...@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202606301759...@intel.com/
Signed-off-by: Tao Cui <cui...@kylinos.cn>
---
include/linux/kasan.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/include/linux/kasan.h b/include/linux/kasan.h
index bf233bde68c7..d5159c8033e8 100644
--- a/include/linux/kasan.h
+++ b/include/linux/kasan.h
@@ -3,6 +3,7 @@
#define _LINUX_KASAN_H

#include <linux/bug.h>
+#include <linux/instruction_pointer.h>
#include <linux/kasan-enabled.h>
#include <linux/kasan-tags.h>
#include <linux/kernel.h>
--
2.43.0

Alexander Potapenko

unread,
Jul 1, 2026, 4:00:03 AMJul 1
to Tao Cui, Andrey Ryabinin, Andrey Konovalov, Dmitry Vyukov, Vincenzo Frascino, Steven Rostedt, mhir...@kernel.org, kasa...@googlegroups.com, linux-...@vger.kernel.org, cui...@kylinos.cn, kernel test robot
On Wed, Jul 1, 2026 at 9:06 AM Tao Cui <cui...@linux.dev> wrote:
>
> From: Tao Cui <cui...@kylinos.cn>
>
> kasan.h uses _RET_IP_ but relied on <linux/trace_printk.h>, included via
> <linux/kernel.h>, to provide it. Commit 9cbc3d9806d3 ("tracing: Remove
> trace_printk.h from kernel.h") dropped that transitive include, so files
> that don't otherwise get instruction_pointer.h no longer build, e.g.
> kernel/scs.c on arm64 KASAN:
>
> include/linux/kasan.h:199:43: error: use of undeclared identifier '_RET_IP_'
>
> Include <linux/instruction_pointer.h> directly to make the dependency
> explicit.
>
> Fixes: 9cbc3d9806d3 ("tracing: Remove trace_printk.h from kernel.h")
> Reported-by: kernel test robot <l...@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202606301759...@intel.com/
> Signed-off-by: Tao Cui <cui...@kylinos.cn>
Reviewed-by: Alexander Potapenko <gli...@google.com>

Vincenzo Frascino

unread,
Jul 1, 2026, 11:07:48 AMJul 1
to Tao Cui, Andrey Ryabinin, Alexander Potapenko, Andrey Konovalov, Dmitry Vyukov, Steven Rostedt, mhir...@kernel.org, kasa...@googlegroups.com, linux-...@vger.kernel.org, cui...@kylinos.cn, kernel test robot


On 01/07/2026 08:04, Tao Cui wrote:
> From: Tao Cui <cui...@kylinos.cn>
>
> kasan.h uses _RET_IP_ but relied on <linux/trace_printk.h>, included via
> <linux/kernel.h>, to provide it. Commit 9cbc3d9806d3 ("tracing: Remove
> trace_printk.h from kernel.h") dropped that transitive include, so files
> that don't otherwise get instruction_pointer.h no longer build, e.g.
> kernel/scs.c on arm64 KASAN:
>
> include/linux/kasan.h:199:43: error: use of undeclared identifier '_RET_IP_'
>
> Include <linux/instruction_pointer.h> directly to make the dependency
> explicit.
>
> Fixes: 9cbc3d9806d3 ("tracing: Remove trace_printk.h from kernel.h")
> Reported-by: kernel test robot <l...@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202606301759...@intel.com/
> Signed-off-by: Tao Cui <cui...@kylinos.cn>

Reviewed-by: Vincenzo Frascino <vincenzo...@arm.com>

> ---
> include/linux/kasan.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/include/linux/kasan.h b/include/linux/kasan.h
> index bf233bde68c7..d5159c8033e8 100644
> --- a/include/linux/kasan.h
> +++ b/include/linux/kasan.h
> @@ -3,6 +3,7 @@
> #define _LINUX_KASAN_H
>
> #include <linux/bug.h>
> +#include <linux/instruction_pointer.h>
> #include <linux/kasan-enabled.h>
> #include <linux/kasan-tags.h>
> #include <linux/kernel.h>

--
Regards,
Vincenzo

Reply all
Reply to author
Forward
0 new messages