mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kumar Kartikeya Dwivedi <memxor@gmail.com>
To: bpf@vger.kernel.org
Cc: Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Eduard Zingerman <eddyz87@gmail.com>,
	Emil Tsalapatis <emil@etsalapatis.com>,
	Ihor Solodrai <ihor.solodrai@linux.dev>,
	kkd@meta.com, kernel-team@meta.com,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Andy Lutomirski <luto@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	Puranjay Mohan <puranjay@kernel.org>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH bpf-next v1 1/3] compiler_types: Emit a BTF type tag for __iomem
Date: Sat, 28 Nov 2026 03:53:15 +0100	[thread overview]
Message-ID: <c4f497b6646542ba7d856ddec7d912b680b017bf.1795834380.git.memxor@gmail.com> (raw)
In-Reply-To: <cover.1795834380.git.memxor@gmail.com>

__user, __percpu and __rcu pointers carry a BTF type tag, which tells the
BPF verifier what they point to. __iomem pointers do not: outside of sparse
the annotation expands to nothing, and in BTF such a pointer looks like any
other.

Define __iomem as BTF_TYPE_TAG(iomem), so that BTF records which pointers
hold the address of a device register. The next patch uses it.

As for the other three, the tag is only emitted with CONFIG_DEBUG_INFO_BTF,
a pahole that supports type tags and a compiler that has the btf_type_tag
attribute. The attribute does not take part in type checking. With the
config of the BPF selftests, vmlinux BTF grows by 892 bytes for 27 tagged
types.

Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
---
 include/linux/compiler_types.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h
index c5921f139007..8cfa555664e9 100644
--- a/include/linux/compiler_types.h
+++ b/include/linux/compiler_types.h
@@ -67,7 +67,7 @@ static inline void __chk_io_ptr(const volatile void __iomem *ptr) { }
 # else
 #  define __user	BTF_TYPE_TAG(user)
 # endif
-# define __iomem
+# define __iomem	BTF_TYPE_TAG(iomem)
 # define __percpu	__percpu_qual BTF_TYPE_TAG(percpu)
 # define __rcu		BTF_TYPE_TAG(rcu)
 
-- 
2.53.1-Meta


  reply	other threads:[~2026-11-28  2:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-28  2:53 [PATCH bpf-next v1 0/3] bpf: Do not follow __iomem pointers Kumar Kartikeya Dwivedi
2026-11-28  2:53 ` Kumar Kartikeya Dwivedi [this message]
2026-11-28  2:53 ` [PATCH bpf-next v1 2/3] bpf: Treat __iomem pointers as scalars Kumar Kartikeya Dwivedi
2026-11-28  2:53 ` [PATCH bpf-next v1 3/3] selftests/bpf: Test loads through __iomem pointers Kumar Kartikeya Dwivedi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c4f497b6646542ba7d856ddec7d912b680b017bf.1795834380.git.memxor@gmail.com \
    --to=memxor@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bp@alien8.de \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=dave.hansen@linux.intel.com \
    --cc=eddyz87@gmail.com \
    --cc=emil@etsalapatis.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=kernel-team@meta.com \
    --cc=kkd@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=puranjay@kernel.org \
    --cc=tglx@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®