From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.72 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1792714646; b=rEznNvzlKM5+TQtW4yR8ny9v9sTD+H6UYfejGfD/x/uUmvKueqSPUL6WnH3SP/MKBaIO r9jNOn8+dcfDRPPLuUOtajIdiORgm1aP/Wltyn1Jy7eOOoE4ZZSHWOuxW25lZQn3A2Lob T3pGucywOsbVapbBNm/2NNSWW3HbGhD873NQF3dX/aAtWjKceT41omZHE7w8Knx+pKDRa 40G/d+QpuAfj+ckRbBl6T8IGrPYKrAiL5EuD7OhsHISHq8Y+4HBRbaB/5jB8XpMkfHrDf pAt7gqNR/sibzxnRTGbhcRB2RGNuoWpUXzyjjQGJ6x0Ev6IBZB/uC7zoK8h40t1fqAA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792714646; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:Date:In-Reply-To: Mime-Version:References:X-Mailer:Message-ID:Subject:From:To:Cc: Content-Type; bh=oBYxcbD5svbaTalp54IT3TgPIj7U31fwSGEAMAykp6g=; b=WCc8B53I0ibhE6zeS7CrQxWZ0JL+7aGAoIMqfU+6f0Qr0rpDmAy/0IhyBvPKXK8bf23V orutb9ePmsEYwxTZSDSXU+9lM2vLesHFGxuY6n/UEE+XdEdbhMcCHXPpk3rkex2jkqp/Y OsYP+7cHFlKz1MphrhwoeagYF2qS3jGmxaKnCZ3AMviJlyDSZ2vXnSFisTaTwtKsxNM1x OrwBRSWTyXe2jWh7iP4cDlECEIghfktrmM2hQN4+zJzX9CUOmVm09EqbWFyBn1aWbNNwc 7YYlqthMKi9xNTylqGHgFrCz9na216G9g4RdMsf1D5vdo+uE63ctPv9sgGGrFSjMNAQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=flex--wusamuel.bounces.google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20251104 header.b=Uzdjs9XQ; arc=none smtp.remote-ip=74.125.82.72 Received: from mail-dl1-f72.google.com (mail-dl1-f72.google.com [74.125.82.72]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 79A8E606A31B for ; Fri, 23 Oct 2026 00:17:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 79A8E606A31B Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--wusamuel.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20251104 header.b=Uzdjs9XQ Received: by mail-dl1-f72.google.com with SMTP id a92af1059eb24-151ba226e1bso743019c88.0 for ; Thu, 22 Oct 2026 17:17:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1792714646; x=1793319446; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=oBYxcbD5svbaTalp54IT3TgPIj7U31fwSGEAMAykp6g=; b=Uzdjs9XQVOgnkMzwfBYWvjzVPffgDZiQPHuB7ca4I04DBEfMxl+SZG2cJaTPfFOhwN t+g5y1oKjg1juaBKzo9njVVZJwP1DJtyBkRQhBQXvBsLQXvF6LgBncxC7JQJr0vDXhqi CP+7nNAOsooUIFkJ0iptaqUyOkBz2hNfRdjSz3rpEsqCnLeLg8kxvKWrxsIoAJdogkmB YPBpTk4CFBJKy6jXMT3L+7yw5RplJVA6nAlT+WJPWHicaHslH4es3yLeBG+O8C+XiPme h0pgfg4n0lRqt+1SwqQjKxolYOTGP0Wh3MRm5Hl8ntmbsGJ7Tz94WD2BVli+bR96kugY DEUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792714646; x=1793319446; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=oBYxcbD5svbaTalp54IT3TgPIj7U31fwSGEAMAykp6g=; b=AjyBkveRstkZm6p0OlXCp7Jnz/K26ZJgn1DLPnoQg1CVMWmjYAZ/G0J12naQJzVkTC ydq7XJkHN43bOytxjUQQYTiV5TUSw986766F0BFIovUbMAuR82hYQfaDTQk8dH2Jwvph DFEwWx6Xp96uPAKNX5611EoOuRvaaCRzQdZW17XHSr8IraDbHAejcBRrbj7sqIcpACH4 IApJYoxuDdZoQvh4rTPm3XJF5ISdGF9MKYQFhhJ6QaJ4oR/HXnte1eSaTBE2BTcYmQn1 lFl2ulpN4aYbrdS/BdTkDchqMde8tM5mjH2hDPa5jgMVU6TxuK3Cg7WWx5xfYbt+f6e7 3T8w== X-Forwarded-Encrypted: i=1; AKwUvBxpH9HJ1fgfZgegr03te28tTba3rcethz4sIFZVBItqHJPbRwmfhoenooE3QKYn07ltvT3TlO1GdcY=@vger.kernel.org X-Gm-Message-State: AFq9FYJO2zAH4YO8FuJHnCLpb0L3OeKHY90bxJHFnctdBAn1fCztJaR6 p9Pt0SGPjbRngX50DqNWrJGx0Pk4ZOYp0mJ56tDYIFPuj9AOM7jz27mIKRte7owxcfBF3cDvo9P 7IC1lP+1kN0ZY3Q== X-Received: from dlbps4.prod.google.com ([2002:a05:7023:884:b0:191:327b:5758]) (user=wusamuel job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:4184:b0:16c:ff3a:d72e with SMTP id a92af1059eb24-195c6b29320mr1346079c88.20.1792714645130; Thu, 22 Oct 2026 17:17:25 -0700 (PDT) Date: Thu, 22 Oct 2026 17:16:03 -0700 In-Reply-To: <20261023001603.560210-8-wusamuel@google.com> X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 References: <20261023001603.560210-8-wusamuel@google.com> X-Mailer: git-send-email 2.56.0.257.gf7497c7d27-goog Message-ID: <20261023001603.560210-10-wusamuel@google.com> Subject: [PATCH bpf-next v2 2/6] tools: Copy KALLSYMS_QUERY definitions to linux/fs.h From: Samuel Wu To: Jonathan Corbet , Shuah Khan , Randy Dunlap , Alexander Viro , Christian Brauner , Jan Kara , Andrii Nakryiko , Eduard Zingerman , Ihor Solodrai , Alexei Starovoitov , Daniel Borkmann , Kumar Kartikeya Dwivedi , Martin KaFai Lau , Song Liu , Yonghong Song , Jiri Olsa , Emil Tsalapatis , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt Cc: Samuel Wu , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-doc@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, llvm@lists.linux.dev Content-Type: text/plain; charset="UTF-8" Copy the KALLSYMS_QUERY ioctl definitions from include/uapi/linux/fs.h to tools/include/uapi/linux/fs.h for libbpf and the proc and bpf selftests. Only the new definitions are copied; other differences between the two headers are left alone. Signed-off-by: Samuel Wu --- tools/include/uapi/linux/fs.h | 41 +++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tools/include/uapi/linux/fs.h b/tools/include/uapi/linux/fs.h index f0a26309b6d5..d224516e6d6e 100644 --- a/tools/include/uapi/linux/fs.h +++ b/tools/include/uapi/linux/fs.h @@ -567,4 +567,45 @@ struct procmap_query { __u64 build_id_addr; /* in */ }; +/* /proc/kallsyms ioctl */ +#define KALLSYMS_QUERY _IOWR(PROCFS_IOCTL_MAGIC, 18, struct kallsyms_query) + +/* Exactly one query mode must be set in query_flags. */ +enum kallsyms_query_flags { + /* + * Look up a symbol in vmlinux or loaded modules (vmlinux first; BPF + * and ftrace symbols are not searched) by exact NUL-terminated name + * at sym_name_addr and return sym_addr. sym_addr and sym_name_size + * must be 0 on input. + */ + KALLSYMS_QUERY_BY_SYMBOL = 0x01, + /* + * Look up the symbol covering sym_addr and write its NUL-terminated + * name to the sym_name_addr buffer of sym_name_size bytes. The same + * symbols as %pS are searched: vmlinux, loaded modules, BPF JIT + * images, and freed module init functions still tracked by ftrace. + * A buffer of KSYM_NAME_LEN (512 at the time of writing) bytes is + * always enough. On success, sym_name_size is set to the number of + * bytes written (including the terminating NUL). + */ + KALLSYMS_QUERY_BY_ADDR = 0x02, +}; + +/* + * Returns -ENOENT if no symbol matches, -EADDRNOTAVAIL if the name maps to + * more than one address, -ENAMETOOLONG if the name does not fit in + * KSYM_NAME_LEN (512 at the time of writing) or sym_name_size bytes, and + * -EPERM if kallsyms addresses are hidden from the opener of /proc/kallsyms + * (e.g. kptr_restrict). + */ +struct kallsyms_query { + __u64 size; /* in - struct size for compatibility */ + __u64 query_flags; /* in - query mode (enum kallsyms_query_flags) */ + __u64 sym_name_addr; /* in - address of symbol name buffer */ + __u64 sym_addr; /* out (BY_SYMBOL) / in (BY_ADDR) */ + __u64 sym_name_size; /* in/out - name buffer size / bytes written */ +}; + +#define KALLSYMS_QUERY_SIZE_VER0 40 /* sizeof first published struct */ + #endif /* _UAPI_LINUX_FS_H */ -- 2.56.0.257.gf7497c7d27-goog