From nobody Thu Apr 9 21:51:26 2026 Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 249DF3D7D9C for ; Thu, 5 Mar 2026 16:55:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772729723; cv=none; b=Y1FQja0sYNBU5OQs45o7hpXT2crAtkk8T4v2aw0M+svDdSixRw4wZx2QIWEczelEHyhLP12g0n43EsGDV84qZic6ZC9t9Lht2oRubGHZGdd20BolsnFLKGJV41uUFIu8BT97r2QhuMvH30lEt9f3npBozYSRbAOwztOz4rx6EqY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772729723; c=relaxed/simple; bh=Bb1KMrLqycT1mJTEbsbAR/yPkfis88j4rK2phU3dd5U=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=SkES4xoFVpsN2Rr66pXb5FLfrThggz22i8Gh2uP7OXPu5rwBl7jtYnB+9wegGgrxxNAihAuA8eG/6SIIwv8n1Y63KUvid0jI8/WatP+0x2jIbErshtD3FTrK/hc5myPBpQms4WTsERL+7jfp0n2T1kmedcLXc4CpI7CIpYfuYig= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--sidnayyar.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=GeTWH3E5; arc=none smtp.client-ip=209.85.128.73 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--sidnayyar.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="GeTWH3E5" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-48378df3469so57387555e9.1 for ; Thu, 05 Mar 2026 08:55:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772729720; x=1773334520; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=dBYdKguW4OR7832WAjw0ax/pGR/ObsDBsVmddi7GUko=; b=GeTWH3E58TZXYykT+YTk2W0CvHwg+oB/gc7GKfkDBBtS23oyRdK68pKoGKN0Z+mlx0 msULwJ/u6BQitz9M3oru+4V3K241i3+M7Pv2fNELKKS0lYR3ZwL13CVHivLAN5dfXkNh MXzdKB5arkDjyHB8aDApNS1eKVacpaJphSO/Yfd3Lxc/MlWfispc+4Hv0YrLOntkcTnB rrBRTIXqNH0LbpvU6KiqoEF/nlSijgjABuMX2f1pcV9hIrPS+v5szMCYhMz5FKXgk4Yc pqyjf482QCLyICY4AjbvaYxuaHQi6ZHNDxo+KnhI0x92IAfKl6pcFKppG3EVelLvn+ud AFuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772729720; x=1773334520; h=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; bh=dBYdKguW4OR7832WAjw0ax/pGR/ObsDBsVmddi7GUko=; b=Tp3wKFpZ9p+6lFFLeIIrLAlc0H7yr3Cc5a1FfPC8BMWOuJphYc4vbxOvYyQA7JqPxX 0N5hxsbxYXo+165W6z12IHN8ceDvaBqTvSzLJbyFzM4A4gRYRIR8ehEMfX5AF9PicGXQ 9ScU9U+IwxsgylUfQBSSMHLE6O7bZ5SM93idAdZcbAjrgVdtftO+MPRBSR9sqof8V9Vx 9csbdhaKQGbqVuUBWao6Gagg4jW8EuRAa6SGlGXjyQCTk/S3GwjplIeCGfxiX2YtzcSL UWfwvAi68VAdti/eO1Nm9c/OZmk9iJaN3xp7kK18X6PHfjRhURi19lfekrNwh7pdIUkB GJEw== X-Forwarded-Encrypted: i=1; AJvYcCVnQTNZi06aSOoubSq1Two/0uOEJvz/TH4xN9eDAmZ8GHJ3abz3RsbHUfM6C/PtY+jKhdueGoL1SHfX1EQ=@vger.kernel.org X-Gm-Message-State: AOJu0YxWnABkFp+eixV+XvHaTSVLdTOBTa1qQsIxdqw82nisUftSg2vz H3bqM6+Ntf7CU3mpa8m8mrBa9EdkTT4Bsy//+YOL0w9w64IslcOzYRMkhChfn8nQ3NP7smQPZN6 /ieTbG15fnXTBbCxMZw== X-Received: from wmbd24.prod.google.com ([2002:a05:600c:58d8:b0:483:248b:3e95]) (user=sidnayyar job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:6814:b0:475:ddad:c3a9 with SMTP id 5b1f17b1804b1-4851ee9c2admr52391175e9.13.1772729720453; Thu, 05 Mar 2026 08:55:20 -0800 (PST) Date: Thu, 05 Mar 2026 16:55:17 +0000 In-Reply-To: <20260305-kflagstab-v4-0-6a76bf8b83c7@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260305-kflagstab-v4-0-6a76bf8b83c7@google.com> X-Mailer: b4 0.14.3 Message-ID: <20260305-kflagstab-v4-1-6a76bf8b83c7@google.com> Subject: [PATCH v4 1/8] define ksym_flags enumeration to represent kernel symbol flags From: Siddharth Nayyar To: Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Arnd Bergmann , Nathan Chancellor , Nicolas Schier , Jonathan Corbet , Shuah Khan Cc: linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-doc@vger.kernel.org, Siddharth Nayyar , maennich@google.com, gprocida@google.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Symbol flags is an enumeration used to represent flags as a bitset, for example a flag to tell if a symbol is GPL only. The said bitset is introduced in subsequent patches and will contain values of kernel symbol flags. These bitset will then be used to infer flag values rather than fragmenting ksymtab for separating symbols with different flag values, thereby eliminating the need to fragment the ksymtab. Signed-off-by: Siddharth Nayyar Reviewed-by: Petr Pavlu --- include/linux/module_symbol.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/module_symbol.h b/include/linux/module_symbol.h index 77c9895b9ddb..574609aced99 100644 --- a/include/linux/module_symbol.h +++ b/include/linux/module_symbol.h @@ -2,6 +2,11 @@ #ifndef _LINUX_MODULE_SYMBOL_H #define _LINUX_MODULE_SYMBOL_H =20 +/* Kernel symbol flags bitset. */ +enum ksym_flags { + KSYM_FLAG_GPL_ONLY =3D 1 << 0, +}; + /* This ignores the intensely annoying "mapping symbols" found in ELF file= s. */ static inline bool is_mapping_symbol(const char *str) { --=20 2.53.0.473.g4a7958ca14-goog From nobody Thu Apr 9 21:51:26 2026 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 53A9F3DBD45 for ; Thu, 5 Mar 2026 16:55:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772729724; cv=none; b=dVg+md3zRWfEIlDhImBf3VYfCHC1E+ROkEjF1z1RWgDCnLihKe08lL12rdJpboERzuhtRCnjteW9VwG4ssO101idDBwoWDlAEu7mLFTFrFJixdyz5pKZzyabi8MHpxS8erBG21RpTxqUuyPzqqBhZmfyV2bBeuY0fIOVdACo1kc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772729724; c=relaxed/simple; bh=P86ac5my1fDlI8n2GQxcGL87lpW9m2344uJNQZ3J/J4=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Y+oJeD88B5MXPF+a/7Us8M58wXTgbtkQiUxuD/poen73qSeO+7h/s/HUAw3Qf/WQ4SSUgN5Pu5s2NE9vxg/gpx+GX8XMOObbfxDx0Y03nfzkrRbGhM4P7rrKWitY/+f9I6lPs2rzV3V/XZulSl2c9dzN68kfZ01nx5rhlVzJ/iA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--sidnayyar.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=wJ5moOhk; arc=none smtp.client-ip=209.85.128.74 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--sidnayyar.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="wJ5moOhk" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-4830e7c6131so87716395e9.2 for ; Thu, 05 Mar 2026 08:55:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772729722; x=1773334522; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=DbFvhwKwxof5OBDT/AFQVHeuEBUcV4eoWuedVaHu8Hg=; b=wJ5moOhkHhAluxzc6h3ZQyxsF7siY/ARwflQr9ed1NaQ4Q5AEVQ/62VjwYxdUr9U5A mUZt1PQT9io84xRQjcl0yWz61IXktnKud4f2oh4zN0O1rKNJRgVg+9Ge6ZpoKzqP8G/X 6Bp3ULIUA1wg6Gr1xITfCTcsw9ilkAA+C/+3iJFv8WWC2YXDHV9Kzz3kyKNf4k2W2hAn TxZnTTaXYXTlEF5ynh5DPzRXQCClaHH6gUOJcCFCSFJZUPk9lxARJ0pul15hbptY/0Xf xl6N6utSOnq+Wy7VqaK52I5raH0D+rJGprP15dQazA2qjCeYiVZWzcutmT9set8Ai1vx b7nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772729722; x=1773334522; h=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; bh=DbFvhwKwxof5OBDT/AFQVHeuEBUcV4eoWuedVaHu8Hg=; b=vCfqoevZ35Wnte00Brgzhr01ZJ3xdUBF8v/9M+I0jhSyQXKm9VtwQwycewRK1scyIg hV4rcOsKnue1p3faTabF7p13YnIzA8Zxud1SgXcfHO7cdh9Jh9bHqTmdV2t8XgVjNnvp WlMkt851QzhLdQjvCwP58cuSx7usiz4DUaPo1j0+Kyw5PwPYygN5G8R+4kCXfm8C64Zo D1DTWRMOOr3NwFMYhzyV7sGDxs3JCjg7x9dqsMzuNdhu2HqOpLREA7Auk00Ku42mt6I+ VlwZOwXNd4uWJiiHn6RaIq5YPvfe883K7tfGiTb1T8AkgKvCKWDqAcSyLd9Gl7Y9m4IE keng== X-Forwarded-Encrypted: i=1; AJvYcCXxLeHePu0WHZ00kWDwBVYmtJSqh0wnSM3NWiyT2ILsuxQLWIlujvkuNlxRAznOPGUBvZCdXtpSB3qs1KM=@vger.kernel.org X-Gm-Message-State: AOJu0Yy4cSCLx6CGSJHZKq1tLXE5AM4oszCOQqxOI5W31l7R4kU6W115 MA/N+EnPiHi950TxvpZHR3rWY44jaaK/DPlzRH2Et1AOH9CLyBo/GQPvrwxVOy0lSHvMTRVsfiS FN5RlZR1f/21iipOpvw== X-Received: from wmlc20.prod.google.com ([2002:a7b:c854:0:b0:480:6bde:d3b3]) (user=sidnayyar job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:8b26:b0:485:17a7:ba18 with SMTP id 5b1f17b1804b1-485198a6fd6mr101191895e9.30.1772729721708; Thu, 05 Mar 2026 08:55:21 -0800 (PST) Date: Thu, 05 Mar 2026 16:55:18 +0000 In-Reply-To: <20260305-kflagstab-v4-0-6a76bf8b83c7@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260305-kflagstab-v4-0-6a76bf8b83c7@google.com> X-Mailer: b4 0.14.3 Message-ID: <20260305-kflagstab-v4-2-6a76bf8b83c7@google.com> Subject: [PATCH v4 2/8] linker: add kflagstab section to vmlinux and modules From: Siddharth Nayyar To: Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Arnd Bergmann , Nathan Chancellor , Nicolas Schier , Jonathan Corbet , Shuah Khan Cc: linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-doc@vger.kernel.org, Siddharth Nayyar , maennich@google.com, gprocida@google.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable This section will contain read-only data for values of kernel symbol flags in the form of an 8-bit bitsets for each kernel symbol. Each bit in the bitset represents a flag value defined by ksym_flags enumeration. The kflagstab section introduces a 1-byte overhead for each symbol exported in the ksymtab. Given that typical kernel builds contain roughly a few thousand exported symbols, the resulting memory increase is negligible. Signed-off-by: Siddharth Nayyar Reviewed-by: Petr Pavlu --- include/asm-generic/vmlinux.lds.h | 7 +++++++ scripts/module.lds.S | 1 + 2 files changed, 8 insertions(+) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinu= x.lds.h index eeb070f330bd..8f825dcbfae4 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -536,6 +536,13 @@ __stop___kcrctab_gpl =3D .; \ } \ \ + /* Kernel symbol flags table */ \ + __kflagstab : AT(ADDR(__kflagstab) - LOAD_OFFSET) { \ + __start___kflagstab =3D .; \ + KEEP(*(SORT(___kflagstab+*))) \ + __stop___kflagstab =3D .; \ + } \ + \ /* Kernel symbol table: strings */ \ __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \ *(__ksymtab_strings) \ diff --git a/scripts/module.lds.S b/scripts/module.lds.S index 054ef99e8288..d7a8ba278dfc 100644 --- a/scripts/module.lds.S +++ b/scripts/module.lds.S @@ -23,6 +23,7 @@ SECTIONS { __ksymtab_gpl 0 : ALIGN(8) { *(SORT(___ksymtab_gpl+*)) } __kcrctab 0 : ALIGN(4) { *(SORT(___kcrctab+*)) } __kcrctab_gpl 0 : ALIGN(4) { *(SORT(___kcrctab_gpl+*)) } + __kflagstab 0 : ALIGN(1) { *(SORT(___kflagstab+*)) } =20 .ctors 0 : ALIGN(8) { *(SORT(.ctors.*)) *(.ctors) } .init_array 0 : ALIGN(8) { *(SORT(.init_array.*)) *(.init_array) } --=20 2.53.0.473.g4a7958ca14-goog From nobody Thu Apr 9 21:51:26 2026 Received: from mail-wr1-f73.google.com (mail-wr1-f73.google.com [209.85.221.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9AA1E3DEAC0 for ; Thu, 5 Mar 2026 16:55:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772729726; cv=none; b=Quw2D4US7Nb4IVz8MfFwoYSUovdAVZCSnTTWxMpczKztAlVOv7sRijlFBvqkpjW+t5EgUrLgPagOOsGzT2y/kKerSAu22t+iTw4mEDlB0sQHdk/ktsB2ogA/BzHQIeNTxm8tFIHDqYjnXN2I3hL/DV/m9LnqW5kVmvdxc7E6hhE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772729726; c=relaxed/simple; bh=A4U/FoOHtW+MFUPt0VllbbGZtdckI6pJiFlzK0SEzrc=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=dhOay6YJWcNftjNFoTpYmPQ8Dn8ohE3XHaTvTFxKZXVqDJa/TP5JzUEhKgl3j0/A84KwkdAuke8qmzWP18uYetz33XpCFCKNhOefUa7+2QM3XaA0BR9RM7l/AG79CnlQOpYV0dUa0PfCNZ6wFaraZYA0QJW0VGd58v0NycHxNGo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--sidnayyar.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=faBc76hZ; arc=none smtp.client-ip=209.85.221.73 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--sidnayyar.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="faBc76hZ" Received: by mail-wr1-f73.google.com with SMTP id ffacd0b85a97d-439b8bc43aeso3357986f8f.1 for ; Thu, 05 Mar 2026 08:55:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772729723; x=1773334523; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=V+WoAPEi01xLPG9zvw+lWYQpkS4zZIu+aKoCdLedeNs=; b=faBc76hZf7er+kQakhk31TRbyvy5B52oCxLafSwDTcLqrzNBQn5ErtfD/DbLutxbQR BBZLZWvNzqqWOPQm4R4j3sk41iVqWM+nGGkFajiGYagdbShoHWoJcqWmEggJGgcS5hTo MjrKpwegdhJHKUDT+1mXN2jSEjwNEyLFEfex84n6EIkyTDy+Anjgv7xstIMtPjm8SARe VCLbO/1Sf10UquBdbNP68mp3NyTrcH5aB0YEs+rpmFlMKtLzS6wepp4fry0VnNJFLYMO RzhcvOZXyx6UBEMD3FWKn+8j8vS4YYatbIa71SAhZVtMb3/c2h96McD9g5BudVEWpZGK x1bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772729723; x=1773334523; h=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; bh=V+WoAPEi01xLPG9zvw+lWYQpkS4zZIu+aKoCdLedeNs=; b=h4ZcFO+aVsBXLCjwDMl/wp/UT21QKHd8xuehWrIQmatYs4XBRzWQDGOLinQrGBznru HVDzbKdVFSpJwM62N2czsnAXNIJ2GBx91HbXTI6xcmLX1hADQM/O391KKNjSH394NqED 42G/eRCPgCYUYVr2T2DymkcDH0NV424VI1HAtAZ0GeEu5KoiXI5VmlOcV1V6NMYAKRPA lxKLzhEhQxtqs7rG4POQHJHPEMVT5rpwvtu4bS1Idw0VIdDXjY9hbYSQgd7ctJOfudrO CneWYIujO4Dzhjf9YyC9Y2aenNpZsIktpBSUYyFB8ea9LrWX3IZe8EYU6a0yWn7/Dce+ u3yg== X-Forwarded-Encrypted: i=1; AJvYcCUTcdghM4+dmyAlndQRbKC+HKDHs+BBO2l3mt/2sPcS/GMqEBGiFJa1dl23hvzwH2hOD5yteRKwU/MZyaE=@vger.kernel.org X-Gm-Message-State: AOJu0YxZRHocdZSki5hfKwEAfhN70jwA7JB13TIfvSfWrWAYeX5+iTE8 sPxGkol32pz/7dnrsirHUlPuF9rQ8xsdE7xOaFLzhvsu3tZX8FCSfSPz1IHuaSkhq2dBvT29VFD QGiSRAtF3JMwXliXAhQ== X-Received: from wrbbh8.prod.google.com ([2002:a05:6000:5c8:b0:439:adde:b305]) (user=sidnayyar job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6000:608:b0:439:b62d:be86 with SMTP id ffacd0b85a97d-439c800fa23mr11367518f8f.47.1772729722667; Thu, 05 Mar 2026 08:55:22 -0800 (PST) Date: Thu, 05 Mar 2026 16:55:19 +0000 In-Reply-To: <20260305-kflagstab-v4-0-6a76bf8b83c7@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260305-kflagstab-v4-0-6a76bf8b83c7@google.com> X-Mailer: b4 0.14.3 Message-ID: <20260305-kflagstab-v4-3-6a76bf8b83c7@google.com> Subject: [PATCH v4 3/8] modpost: populate kflagstab From: Siddharth Nayyar To: Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Arnd Bergmann , Nathan Chancellor , Nicolas Schier , Jonathan Corbet , Shuah Khan Cc: linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-doc@vger.kernel.org, Siddharth Nayyar , maennich@google.com, gprocida@google.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable This patch adds the ability to create entries for kernel symbol flag bitsets in kflagstab. Modpost populates only the GPL-only flag for now. Signed-off-by: Siddharth Nayyar Reviewed-by: Petr Pavlu --- include/linux/export-internal.h | 7 +++++++ scripts/mod/modpost.c | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/include/linux/export-internal.h b/include/linux/export-interna= l.h index d445705ac13c..4123c7592404 100644 --- a/include/linux/export-internal.h +++ b/include/linux/export-internal.h @@ -69,4 +69,11 @@ ".long " #crc "\n" \ ".previous" "\n") =20 +#define SYMBOL_FLAGS(sym, flags) \ + asm(" .section \"___kflagstab+" #sym "\",\"a\"" "\n" \ + "__flags_" #sym ":" "\n" \ + " .byte " #flags "\n" \ + " .previous" "\n" \ + ) + #endif /* __LINUX_EXPORT_INTERNAL_H__ */ diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 0c25b5ad497b..1d721fe67caf 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -244,6 +244,11 @@ static struct symbol *alloc_symbol(const char *name) return s; } =20 +static uint8_t get_symbol_flags(const struct symbol *sym) +{ + return sym->is_gpl_only ? KSYM_FLAG_GPL_ONLY : 0; +} + /* For the hash of exported symbols */ static void hash_add_symbol(struct symbol *sym) { @@ -1874,6 +1879,9 @@ static void add_exported_symbols(struct buffer *buf, = struct module *mod) buf_printf(buf, "KSYMTAB_%s(%s, \"%s\", \"%s\");\n", sym->is_func ? "FUNC" : "DATA", sym->name, sym->is_gpl_only ? "_gpl" : "", sym->namespace); + + buf_printf(buf, "SYMBOL_FLAGS(%s, 0x%02x);\n", + sym->name, get_symbol_flags(sym)); } =20 if (!modversions) --=20 2.53.0.473.g4a7958ca14-goog From nobody Thu Apr 9 21:51:26 2026 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AADCA3E0C6F for ; Thu, 5 Mar 2026 16:55:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772729728; cv=none; b=UD586coKaMhSx21MwlpV5BU344+uJYIWUKA4vBvSZHMhJq8C4UvCwZUj4j1T8KOPqucLdsxE/1ZhpUAltOKrRTNtX155wP3K2qtxBqPx0pMysMBXAONA9jdIIKCs8T+Iemyx7ybxYUHYH1NxzlZ0ACmwn11HqVEjbelQmb7618s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772729728; c=relaxed/simple; bh=TpZmRegtqEbXTTVHSkwGbHY5Ll9KMK2Mxg+dapA2VWM=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=LgAHDTw7rgPcteRIsF67MYrhZqtMLnQnYoEIyxmseEp062CCEeSFpjKHEv4QQChtJpDVLBCd/YbODC5OLDjSWQwd8wOSa2shuW+GI/PoZKFvkJEMjfs/qaskUeMgCG38ExwSJs8TTyq9l3h/OdUrEU51Um7ldDmmD0PavTZd7TM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--sidnayyar.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=ugY5rrlR; arc=none smtp.client-ip=209.85.128.74 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--sidnayyar.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ugY5rrlR" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-48071615686so65061795e9.1 for ; Thu, 05 Mar 2026 08:55:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772729725; x=1773334525; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=kH4l5sUjOP0TtrWWkDh0aa89yXT1o3HsEp7IF0XRzwQ=; b=ugY5rrlRB3GFRvPh3T6r9OFOU0kUHoW2nUmpQ3RWbVy9Ache2mr30uQ6ARdAj80dWi jsLe07W8a7Jtht1lRjF0pGzpPDJY2+MJ1kxccGyjUJAK7HRbUyY9jwBdoV/TQ9K52FNo CU5k2qQLLWi5TRPnV+5Z6MJXXbSPWzDHSq6aaKml8VTZxElK1HqEvhmf9dvug97uqvxX heCENyeuBt+S8MqU0a2DwM/PpQLz7VWNx8kxRNMSsCXRyE6jheG85VNyyAYcsTg2w1DL 3n6VIjzoZPAgS9ER42Q9I6rJjYUjnuXiRmo1PW/4es378Z8uMlg5ilJqLpURCH1zrDI5 g66Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772729725; x=1773334525; h=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; bh=kH4l5sUjOP0TtrWWkDh0aa89yXT1o3HsEp7IF0XRzwQ=; b=rEintXpYmbFkQtNjYM6yh0JXPkAIJ/xxY25PIUOmwR5tj3anNwN9cM4kyKMqfnhKY2 SN35ARICW8JKdCeO9S25t4xPThR6JhExhO3mgX+AF8k+/J2snFORfO/oEEMZb6EzvvQf q+z4fUd5dwmXzebAPBrDximBw+s063tz9X3PqvKvnRZcZF/RrPsHeGPF2j3UAXgUO6Br LGedNKQOck6/6b2HuZbxomtTJtliPQags0+MTdU2eUb8nq8UahJ7xQxnwMGGbTz7SQc9 K31nn2u3K9JhSecqPlBHz1ibDJX+VdEVYyAOS6q8rsLKGJw4zIYnhovkRIuMXsdUKic6 KzJw== X-Forwarded-Encrypted: i=1; AJvYcCVw+Eg77GVCawLMmGi0g2oINBx6QwXyVXdgr5oAzKe/dcHWfKWzeASQwgFPAwOqxE6CfI5eNi90f4acXKc=@vger.kernel.org X-Gm-Message-State: AOJu0YzEjsuACIIAPQ+mDO4iBWJhuyJmVeWbgvI0Ycn6EQbGHTihyGe9 Xg2LHTGcD2vxg24CDg5Vux1bAdxeDUMI0Nn0TC1F2XvLfH/ySgNn+u/Yguh3BMNXik2iJqlMMaT LEOZK3EWHrbamRyThqA== X-Received: from wmim3.prod.google.com ([2002:a7b:cb83:0:b0:483:a1ee:5eca]) (user=sidnayyar job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:314f:b0:477:9a28:b0a4 with SMTP id 5b1f17b1804b1-4852354764bmr3796895e9.0.1772729725045; Thu, 05 Mar 2026 08:55:25 -0800 (PST) Date: Thu, 05 Mar 2026 16:55:20 +0000 In-Reply-To: <20260305-kflagstab-v4-0-6a76bf8b83c7@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260305-kflagstab-v4-0-6a76bf8b83c7@google.com> X-Mailer: b4 0.14.3 Message-ID: <20260305-kflagstab-v4-4-6a76bf8b83c7@google.com> Subject: [PATCH v4 4/8] module loader: use kflagstab instead of *_gpl sections From: Siddharth Nayyar To: Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Arnd Bergmann , Nathan Chancellor , Nicolas Schier , Jonathan Corbet , Shuah Khan Cc: linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-doc@vger.kernel.org, Siddharth Nayyar , maennich@google.com, gprocida@google.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Read kflagstab section for vmlinux and modules to determine whether kernel symbols are GPL only. This patch eliminates the need for fragmenting the ksymtab for infering the value of GPL-only symbol flag. The fragmentation of ksymtab is removed in subsequent patches. Signed-off-by: Siddharth Nayyar Reviewed-by: Petr Pavlu --- include/linux/module.h | 1 + kernel/module/internal.h | 1 + kernel/module/main.c | 55 +++++++++++++++++++++++++-------------------= ---- 3 files changed, 31 insertions(+), 26 deletions(-) diff --git a/include/linux/module.h b/include/linux/module.h index 14f391b186c6..aee3accba73c 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -418,6 +418,7 @@ struct module { /* Exported symbols */ const struct kernel_symbol *syms; const u32 *crcs; + const u8 *flagstab; unsigned int num_syms; =20 #ifdef CONFIG_ARCH_USES_CFI_TRAPS diff --git a/kernel/module/internal.h b/kernel/module/internal.h index 618202578b42..69b84510e097 100644 --- a/kernel/module/internal.h +++ b/kernel/module/internal.h @@ -57,6 +57,7 @@ extern const struct kernel_symbol __start___ksymtab_gpl[]; extern const struct kernel_symbol __stop___ksymtab_gpl[]; extern const u32 __start___kcrctab[]; extern const u32 __start___kcrctab_gpl[]; +extern const u8 __start___kflagstab[]; =20 #define KMOD_PATH_LEN 256 extern char modprobe_path[]; diff --git a/kernel/module/main.c b/kernel/module/main.c index c3ce106c70af..d237fa4e0737 100644 --- a/kernel/module/main.c +++ b/kernel/module/main.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -87,7 +88,7 @@ struct mod_tree_root mod_tree __cacheline_aligned =3D { struct symsearch { const struct kernel_symbol *start, *stop; const u32 *crcs; - enum mod_license license; + const u8 *flagstab; }; =20 /* @@ -364,19 +365,21 @@ static bool find_exported_symbol_in_section(const str= uct symsearch *syms, struct find_symbol_arg *fsa) { struct kernel_symbol *sym; - - if (!fsa->gplok && syms->license =3D=3D GPL_ONLY) - return false; + u8 sym_flags; =20 sym =3D bsearch(fsa->name, syms->start, syms->stop - syms->start, sizeof(struct kernel_symbol), cmp_name); if (!sym) return false; =20 + sym_flags =3D *(syms->flagstab + (sym - syms->start)); + if (!fsa->gplok && (sym_flags & KSYM_FLAG_GPL_ONLY)) + return false; + fsa->owner =3D owner; fsa->crc =3D symversion(syms->crcs, sym - syms->start); fsa->sym =3D sym; - fsa->license =3D syms->license; + fsa->license =3D (sym_flags & KSYM_FLAG_GPL_ONLY) ? GPL_ONLY : NOT_GPL_ON= LY; =20 return true; } @@ -387,36 +390,31 @@ static bool find_exported_symbol_in_section(const str= uct symsearch *syms, */ bool find_symbol(struct find_symbol_arg *fsa) { - static const struct symsearch arr[] =3D { - { __start___ksymtab, __stop___ksymtab, __start___kcrctab, - NOT_GPL_ONLY }, - { __start___ksymtab_gpl, __stop___ksymtab_gpl, - __start___kcrctab_gpl, - GPL_ONLY }, + const struct symsearch syms =3D { + .start =3D __start___ksymtab, + .stop =3D __stop___ksymtab, + .crcs =3D __start___kcrctab, + .flagstab =3D __start___kflagstab, }; struct module *mod; - unsigned int i; =20 - for (i =3D 0; i < ARRAY_SIZE(arr); i++) - if (find_exported_symbol_in_section(&arr[i], NULL, fsa)) - return true; + if (find_exported_symbol_in_section(&syms, NULL, fsa)) + return true; =20 list_for_each_entry_rcu(mod, &modules, list, lockdep_is_held(&module_mutex)) { - struct symsearch arr[] =3D { - { mod->syms, mod->syms + mod->num_syms, mod->crcs, - NOT_GPL_ONLY }, - { mod->gpl_syms, mod->gpl_syms + mod->num_gpl_syms, - mod->gpl_crcs, - GPL_ONLY }, + const struct symsearch syms =3D { + .start =3D mod->syms, + .stop =3D mod->syms + mod->num_syms, + .crcs =3D mod->crcs, + .flagstab =3D mod->flagstab, }; =20 if (mod->state =3D=3D MODULE_STATE_UNFORMED) continue; =20 - for (i =3D 0; i < ARRAY_SIZE(arr); i++) - if (find_exported_symbol_in_section(&arr[i], mod, fsa)) - return true; + if (find_exported_symbol_in_section(&syms, mod, fsa)) + return true; } =20 pr_debug("Failed to find symbol %s\n", fsa->name); @@ -2614,6 +2612,7 @@ static int find_module_sections(struct module *mod, s= truct load_info *info) sizeof(*mod->gpl_syms), &mod->num_gpl_syms); mod->gpl_crcs =3D section_addr(info, "__kcrctab_gpl"); + mod->flagstab =3D section_addr(info, "__kflagstab"); =20 #ifdef CONFIG_CONSTRUCTORS mod->ctors =3D section_objs(info, ".ctors", @@ -2817,8 +2816,12 @@ static int move_module(struct module *mod, struct lo= ad_info *info) return ret; } =20 -static int check_export_symbol_versions(struct module *mod) +static int check_export_symbol_sections(struct module *mod) { + if (mod->num_syms && !mod->flagstab) { + pr_err("%s: no flags for exported symbols\n", mod->name); + return -ENOEXEC; + } #ifdef CONFIG_MODVERSIONS if ((mod->num_syms && !mod->crcs) || (mod->num_gpl_syms && !mod->gpl_crcs)) { @@ -3434,7 +3437,7 @@ static int load_module(struct load_info *info, const = char __user *uargs, if (err) goto free_unload; =20 - err =3D check_export_symbol_versions(mod); + err =3D check_export_symbol_sections(mod); if (err) goto free_unload; =20 --=20 2.53.0.473.g4a7958ca14-goog From nobody Thu Apr 9 21:51:26 2026 Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ACCE13E120F for ; Thu, 5 Mar 2026 16:55:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772729729; cv=none; b=rMegAO8QCoLRO+eZRb9cGi5184K77l66IM0Pr+V+C0RZiVVxq2RVCb3c/iOXejBM/40y7+wGnA6icQgGSgBQsij/OJDJm1YcV5DRa+RbSzELd9OePmqXrjKWeV6+oUHQwupd1T38ICNvHZlu8ssWfVFQQ2liIUI/tw3IuH8XrDI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772729729; c=relaxed/simple; bh=8wThas+yx6VNeitZlqkk+kXKQX1pW5KK15IT5W2pzHQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=rGeLgPsR7Q88RDTLrEbC9V7pmz1MlO4dAtikZiSmDD2hTEpHgJs6kvTJ9WDK1folBt2HrbAKDCGsRimSEJDakgBZOJ2rG3YwLBBJOk41aqst82WjIuAreMo6sU2bcJJ79iFjbmAtQUI++xmCG8T8zmoCdknM4kSv/Jp5pqKzY6M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--sidnayyar.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=3o52q5sr; arc=none smtp.client-ip=209.85.128.73 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--sidnayyar.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="3o52q5sr" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-48071615686so65061935e9.1 for ; Thu, 05 Mar 2026 08:55:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772729726; x=1773334526; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=SFGOKKmdozaG9322AXfBKix4rJQP+3sKTD6zVfi8C3I=; b=3o52q5sr4EK4amOyH0A7gv8Hfes5Llms2e/Ocp1fGyxk1Kl1KgHGLeoKZpfkjC4qjM 3orEpcZAtdlA1+vWjcStEPCFEUOA3cBUUxOH8bsjSd2yG/TsK/gV44cHH+RAU4UMOFcw PvwjqQiLdaVnDcKAa20HmAWbgldPb3f9YMX6OjVOvFOV6rUoJC41sJeBqIp5nHfgW4nd HHMwiVlexdxv59MQcH6PGAOdHF46Wo2V2r1fWNyzdt5zjCD7qVc+Hb5FKf3p7+3aWf2U uDcHCcWnGL9XkJ6rBsEqVntcK0e3sDI/O8Ryr7W5FTc/WAz0kxSIxwVXTMyjStbkXviy Ue1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772729726; x=1773334526; h=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; bh=SFGOKKmdozaG9322AXfBKix4rJQP+3sKTD6zVfi8C3I=; b=tMTD3JYlCNHRYHLso4j1HSqsi13QkJI/aJnCP8/KqywNh1eKQIYKmB0PNqcIbnvvro srORPlM0CI3hqwoYVSArQB+3AwcwtdK00Tb9gkrRTFADq5Twqg0wPHQ6Noi+RDXG1pmP HxemZ1dNsqDDRoPnnd2MTqA/2BvG9w9qV4QocoYyZtgldO38L6sYOdcDcRslQthxbnSY dh7LaAsLIxBYLggE2EwCE3UTlz8h8kBjo5sMupttfBn2T3kYLXIVHUZ6TIbSUmu1hg+P rQ0U8x+gTczzr5tvsRQz9ckRIQy0neKnY1PzgbXEtmtEtD8UEC1Ear3x6eqX0GftfKcn hIaQ== X-Forwarded-Encrypted: i=1; AJvYcCV/7USzDNZxqCkfx5CYP3XFr/K1yU7BW3vuIPMNotAPfk4xZF4EzOkV/+JcPrtVKJweWTEB0LjKPKB6hSk=@vger.kernel.org X-Gm-Message-State: AOJu0YwHD1j4ytNbjwJEISIvIJNTis0f0sTKTNBMnSydjXSWrXElLIoR aIUsfNUE6kfCL7CuZ6/taJud19+mTo6xsJdv2sqyQOQzlJWqxDuWDu/HiQQSDkpYvE8pJS/gBoT vKe4Lrw0nLMjKikERwg== X-Received: from wmbbd15.prod.google.com ([2002:a05:600c:1f0f:b0:483:acd9:bd08]) (user=sidnayyar job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:c87:b0:483:8e43:6def with SMTP id 5b1f17b1804b1-485235f9a7amr2224385e9.28.1772729726133; Thu, 05 Mar 2026 08:55:26 -0800 (PST) Date: Thu, 05 Mar 2026 16:55:21 +0000 In-Reply-To: <20260305-kflagstab-v4-0-6a76bf8b83c7@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260305-kflagstab-v4-0-6a76bf8b83c7@google.com> X-Mailer: b4 0.14.3 Message-ID: <20260305-kflagstab-v4-5-6a76bf8b83c7@google.com> Subject: [PATCH v4 5/8] modpost: remove fragmentation of ksymtab and kcrctab sections From: Siddharth Nayyar To: Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Arnd Bergmann , Nathan Chancellor , Nicolas Schier , Jonathan Corbet , Shuah Khan Cc: linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-doc@vger.kernel.org, Siddharth Nayyar , maennich@google.com, gprocida@google.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Since the modules loader determines whether an exported symbol is GPL only from data in the kflagstab section, modpost can put all symbols in the regular ksymtab and stop using the *_gpl versions of the ksymtab and kcrctab. Signed-off-by: Siddharth Nayyar Reviewed-by: Petr Pavlu --- include/linux/export-internal.h | 21 +++++++++++---------- scripts/mod/modpost.c | 8 ++++---- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/include/linux/export-internal.h b/include/linux/export-interna= l.h index 4123c7592404..726054614752 100644 --- a/include/linux/export-internal.h +++ b/include/linux/export-internal.h @@ -37,14 +37,14 @@ * section flag requires it. Use '%progbits' instead of '@progbits' since = the * former apparently works on all arches according to the binutils source. */ -#define __KSYMTAB(name, sym, sec, ns) \ +#define __KSYMTAB(name, sym, ns) \ asm(" .section \"__ksymtab_strings\",\"aMS\",%progbits,1" "\n" \ "__kstrtab_" #name ":" "\n" \ " .asciz \"" #name "\"" "\n" \ "__kstrtabns_" #name ":" "\n" \ " .asciz \"" ns "\"" "\n" \ " .previous" "\n" \ - " .section \"___ksymtab" sec "+" #name "\", \"a\"" "\n" \ + " .section \"___ksymtab+" #name "\", \"a\"" "\n" \ __KSYM_ALIGN "\n" \ "__ksymtab_" #name ":" "\n" \ __KSYM_REF(sym) "\n" \ @@ -59,15 +59,16 @@ #define KSYM_FUNC(name) name #endif =20 -#define KSYMTAB_FUNC(name, sec, ns) __KSYMTAB(name, KSYM_FUNC(name), sec, = ns) -#define KSYMTAB_DATA(name, sec, ns) __KSYMTAB(name, name, sec, ns) +#define KSYMTAB_FUNC(name, ns) __KSYMTAB(name, KSYM_FUNC(name), ns) +#define KSYMTAB_DATA(name, ns) __KSYMTAB(name, name, ns) =20 -#define SYMBOL_CRC(sym, crc, sec) \ - asm(".section \"___kcrctab" sec "+" #sym "\",\"a\"" "\n" \ - ".balign 4" "\n" \ - "__crc_" #sym ":" "\n" \ - ".long " #crc "\n" \ - ".previous" "\n") +#define SYMBOL_CRC(sym, crc) \ + asm(" .section \"___kcrctab+" #sym "\",\"a\"" "\n" \ + " .balign 4" "\n" \ + "__crc_" #sym ":" "\n" \ + " .long " #crc "\n" \ + " .previous" "\n" \ + ) =20 #define SYMBOL_FLAGS(sym, flags) \ asm(" .section \"___kflagstab+" #sym "\",\"a\"" "\n" \ diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 1d721fe67caf..9d96acce60a8 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -1876,9 +1876,9 @@ static void add_exported_symbols(struct buffer *buf, = struct module *mod) if (trim_unused_exports && !sym->used) continue; =20 - buf_printf(buf, "KSYMTAB_%s(%s, \"%s\", \"%s\");\n", + buf_printf(buf, "KSYMTAB_%s(%s, \"%s\");\n", sym->is_func ? "FUNC" : "DATA", sym->name, - sym->is_gpl_only ? "_gpl" : "", sym->namespace); + sym->namespace); =20 buf_printf(buf, "SYMBOL_FLAGS(%s, 0x%02x);\n", sym->name, get_symbol_flags(sym)); @@ -1899,8 +1899,8 @@ static void add_exported_symbols(struct buffer *buf, = struct module *mod) sym->name, mod->name, mod->is_vmlinux ? "" : ".ko", sym->name); =20 - buf_printf(buf, "SYMBOL_CRC(%s, 0x%08x, \"%s\");\n", - sym->name, sym->crc, sym->is_gpl_only ? "_gpl" : ""); + buf_printf(buf, "SYMBOL_CRC(%s, 0x%08x);\n", + sym->name, sym->crc); } } =20 --=20 2.53.0.473.g4a7958ca14-goog From nobody Thu Apr 9 21:51:26 2026 Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E82433E123A for ; Thu, 5 Mar 2026 16:55:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772729731; cv=none; b=o+JQ0ViJZyQF0JVgpzCVYZslQvEwUBD2yPuIW6NhIp8F2ySu5Z+/A8/xq+Q7p65WrMfZQ+3DwOxtEgaies8lEJlz0+V1a13eWHaJoqBsnG9jCFiSZZRcGMmAoYZ6fcGTQva0pgWwTN5TkyYCF8wzj4KkWoQxGy0OSm4mwuuu7Rs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772729731; c=relaxed/simple; bh=fv1wHWnKrIC2PSslQ9gqnuOdMd+GSazSWOsjMOvnx5Y=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=cchplV2ZxcM0ejq9dB5RGZvSTqX9DDR70fVPCDUwSKI+JuLQCwHXigColmbbbzDRO0QfdslFz3twV0JBUojUi796uzAEmWG5QG6G2Is2ae176YLhbqYSNWKqSYBQI7ojH0V105Ea9cNc3ITZMTLGm6c5NlZX+PaM0UEj6TQ5YVg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--sidnayyar.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=h+KzQpxu; arc=none smtp.client-ip=209.85.128.73 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--sidnayyar.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="h+KzQpxu" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-483a2db68caso67752135e9.0 for ; Thu, 05 Mar 2026 08:55:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772729727; x=1773334527; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=muhQDYogzWAVYxF2N4rIVwEM0kh3toD1kcsqgk5RsDc=; b=h+KzQpxuMW2hdY1geiExI9nO+cN3usfbFEX04hnp5DY940MAbHBOBvvG6dtaGuJXmf VKcd4Cyw5gsKlhb4+vguDfcrdny9zQTKJPK3LPGPvXWy5caN4Z5NX82EldXa4deU5NHo TGl0+LStVdfGy9sS6ItueplZ2CqWpEVMDAmwFZDq38rn6y+PCIIJzc2K4Fg0bYTPBvke ScsmSloro0MBxJ7mLPFxXr2DOwTcluWBs2sYfBFuT4yk/CKMZqOdpmpa6lAzdC6suQT6 7Ix/YggyzQ6Kzsk0iNO/+UjKnVg/Zddw+bZjFB0aN1m3Sgv7Z2lKD6f0uN66JpYISgRS 3zMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772729727; x=1773334527; h=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; bh=muhQDYogzWAVYxF2N4rIVwEM0kh3toD1kcsqgk5RsDc=; b=QNtxVH3AtLstSOJA5L+a+je1wCBs/kMLZ4vKWI7L/zBn1Ds55Yhv/q2Wx1SvzzAKow JYeXOuujkDgKlstKg1+QX08v/4rzus15zSeetfnjtaOafkBc5QozCNevD/NGSaij9Nsp 5Z/+hsxLtJXomWHC62mF9WbpLKocaAp6LsFDy/L2kDN90ZCz2K7JxLKgiTHvJGxV2ad0 qoxiUNT4Fh8ppegloQk8kWsvgKYwvyxGWKRP10fxsKqhIbkxo19w5y9wFjSF+AX3GJ0F o2xJJZseGc+NAE9epwz3LSqnRoHqmk1yJvNKevxwdxkAunfOE53e4tSn5k8O49OU1Opx Vu6w== X-Forwarded-Encrypted: i=1; AJvYcCXbJ62dPEa7Vf6RDy5V5nuVLHwADXeO3Zrjfw4qg1oLRufVIic9nRufdgXrf/eGr6XvuB5s39JnddChFQM=@vger.kernel.org X-Gm-Message-State: AOJu0YzOPR89/6WpaQRJIMHBq7vsz47sehFdMm6bGvIRErUW7MwD261Y Htx3zEO6EUG+bZdYK0Qc95OCFqv+7rlSn/V0gSj/q6aNxhLJ2PaUrxctW4nxhtnLY0XtLp3XPv/ +LxL3H780vmFChLdI9w== X-Received: from wmsk22-n1.prod.google.com ([2002:a05:600d:8496:10b0:47e:e4f5:36ca]) (user=sidnayyar job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:6388:b0:47a:7fd0:9eea with SMTP id 5b1f17b1804b1-4852359313emr2434565e9.3.1772729727147; Thu, 05 Mar 2026 08:55:27 -0800 (PST) Date: Thu, 05 Mar 2026 16:55:22 +0000 In-Reply-To: <20260305-kflagstab-v4-0-6a76bf8b83c7@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260305-kflagstab-v4-0-6a76bf8b83c7@google.com> X-Mailer: b4 0.14.3 Message-ID: <20260305-kflagstab-v4-6-6a76bf8b83c7@google.com> Subject: [PATCH v4 6/8] module loader: deprecate usage of *_gpl sections From: Siddharth Nayyar To: Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Arnd Bergmann , Nathan Chancellor , Nicolas Schier , Jonathan Corbet , Shuah Khan Cc: linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-doc@vger.kernel.org, Siddharth Nayyar , maennich@google.com, gprocida@google.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The *_gpl section are not being used populated by modpost anymore. Hence the module loader doesn't need to find and process these sections in modules. This patch also simplifies symbol finding logic in module loader since *_gpl sections don't have to be searched anymore. Signed-off-by: Siddharth Nayyar Reviewed-by: Petr Pavlu --- include/linux/module.h | 3 --- kernel/module/internal.h | 3 --- kernel/module/main.c | 46 ++++++++++++++++++--------------------------= -- 3 files changed, 18 insertions(+), 34 deletions(-) diff --git a/include/linux/module.h b/include/linux/module.h index aee3accba73c..a0ec1a9f97b4 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -434,9 +434,6 @@ struct module { unsigned int num_kp; =20 /* GPL-only exported symbols. */ - unsigned int num_gpl_syms; - const struct kernel_symbol *gpl_syms; - const u32 *gpl_crcs; bool using_gplonly_symbols; =20 #ifdef CONFIG_MODULE_SIG diff --git a/kernel/module/internal.h b/kernel/module/internal.h index 69b84510e097..061161cc79d9 100644 --- a/kernel/module/internal.h +++ b/kernel/module/internal.h @@ -53,10 +53,7 @@ extern const size_t modinfo_attrs_count; /* Provided by the linker */ extern const struct kernel_symbol __start___ksymtab[]; extern const struct kernel_symbol __stop___ksymtab[]; -extern const struct kernel_symbol __start___ksymtab_gpl[]; -extern const struct kernel_symbol __stop___ksymtab_gpl[]; extern const u32 __start___kcrctab[]; -extern const u32 __start___kcrctab_gpl[]; extern const u8 __start___kflagstab[]; =20 #define KMOD_PATH_LEN 256 diff --git a/kernel/module/main.c b/kernel/module/main.c index d237fa4e0737..189e18b8103d 100644 --- a/kernel/module/main.c +++ b/kernel/module/main.c @@ -1464,29 +1464,17 @@ EXPORT_SYMBOL_GPL(__symbol_get); */ static int verify_exported_symbols(struct module *mod) { - unsigned int i; const struct kernel_symbol *s; - struct { - const struct kernel_symbol *sym; - unsigned int num; - } arr[] =3D { - { mod->syms, mod->num_syms }, - { mod->gpl_syms, mod->num_gpl_syms }, - }; - - for (i =3D 0; i < ARRAY_SIZE(arr); i++) { - for (s =3D arr[i].sym; s < arr[i].sym + arr[i].num; s++) { - struct find_symbol_arg fsa =3D { - .name =3D kernel_symbol_name(s), - .gplok =3D true, - }; - if (find_symbol(&fsa)) { - pr_err("%s: exports duplicate symbol %s" - " (owned by %s)\n", - mod->name, kernel_symbol_name(s), - module_name(fsa.owner)); - return -ENOEXEC; - } + for (s =3D mod->syms; s < mod->syms + mod->num_syms; s++) { + struct find_symbol_arg fsa =3D { + .name =3D kernel_symbol_name(s), + .gplok =3D true, + }; + if (find_symbol(&fsa)) { + pr_err("%s: exports duplicate symbol %s (owned by %s)\n", + mod->name, kernel_symbol_name(s), + module_name(fsa.owner)); + return -ENOEXEC; } } return 0; @@ -2608,12 +2596,15 @@ static int find_module_sections(struct module *mod,= struct load_info *info) mod->syms =3D section_objs(info, "__ksymtab", sizeof(*mod->syms), &mod->num_syms); mod->crcs =3D section_addr(info, "__kcrctab"); - mod->gpl_syms =3D section_objs(info, "__ksymtab_gpl", - sizeof(*mod->gpl_syms), - &mod->num_gpl_syms); - mod->gpl_crcs =3D section_addr(info, "__kcrctab_gpl"); mod->flagstab =3D section_addr(info, "__kflagstab"); =20 + if (section_addr(info, "__ksymtab_gpl")) + pr_warn("%s: ignoring obsolete section __ksymtab_gpl\n", + mod->name); + if (section_addr(info, "__kcrctab_gpl")) + pr_warn("%s: ignoring obsolete section __kcrctab_gpl\n", + mod->name); + #ifdef CONFIG_CONSTRUCTORS mod->ctors =3D section_objs(info, ".ctors", sizeof(*mod->ctors), &mod->num_ctors); @@ -2823,8 +2814,7 @@ static int check_export_symbol_sections(struct module= *mod) return -ENOEXEC; } #ifdef CONFIG_MODVERSIONS - if ((mod->num_syms && !mod->crcs) || - (mod->num_gpl_syms && !mod->gpl_crcs)) { + if (mod->num_syms && !mod->crcs) { return try_to_force_load(mod, "no versions for exported symbols"); } --=20 2.53.0.473.g4a7958ca14-goog From nobody Thu Apr 9 21:51:26 2026 Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 202653E1219 for ; Thu, 5 Mar 2026 16:55:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772729731; cv=none; b=avtbGPH357Uqa691gT8lAoSFwkzDDcox7bJU4/pgRFoVCsuV7DdsZ6cxT7qdSbk0m66Kc0XASSCjjxGGxGlSAjSgQot+VQImM5FVBkz6v1YWtT9cMWUYxOiHhEYmFxblEtkx+52dP8qF8bX3PvoYOSDiTHWXxq6UZoyz973Hl7k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772729731; c=relaxed/simple; bh=kyfTe0G2VwV3QkAhN1GPs2mavv4U3uviJwI2JjtwqUI=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=BQ5Oe5qyXmwkfAowTVI68wMwHfApRuoBsh/qTE2mrY38W6biG3+KD3HKOzkaba66XC704zT3apwn4+u2sTB600jxPa9pH6NrEBSB8VeTwX6+mk3GiOPXlR3ijJ1NagVLqAYQVKqhKTIdMRSlRBWNm5Bv4VY7AIN47qV7n9jURiE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--sidnayyar.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=cC8ZJTDH; arc=none smtp.client-ip=209.85.128.73 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--sidnayyar.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="cC8ZJTDH" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-483101623e9so78291585e9.3 for ; Thu, 05 Mar 2026 08:55:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772729728; x=1773334528; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=ccvxigw2nS1gLrg2HufkX6BPzMKDvSVZXWPtcb4rQK0=; b=cC8ZJTDHsEOUERfOO+VELFjTZgC0vgZ2ahVXL61lahaw/YFTNecUy+briW/84/VoCh vOS3V/edFll/gegaRtHTH6nvQVbgRuDTmBwZdl7fUNE6yGPxZLMynX3hKIxRu7PLYrIc qiutKgpHfnFPucTSlnkXLLSIzrZdJoUnG5Lkg8rRxcYPKHG3IEAC/P2abfyWOsH7TtLY WEt7Ap6FD3A3jEdk9nb7FUS/XPzyy6j71/FgDLJbes6SCIxEB3ZNKaT46CvWA/rs+ILM aFn5vkqlWKB9QW6UtG4v7Scl2Z1UR2AyGRQALzwElepBtTJVU+42Tfqq42cG6d6IPMQ8 L0pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772729728; x=1773334528; h=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; bh=ccvxigw2nS1gLrg2HufkX6BPzMKDvSVZXWPtcb4rQK0=; b=NthuQAES+m2sNx4M5bbYRDZXznvaXXCRJd1P9ekTlTn1VWoCHONIW2JFohXshen+69 hfBmc55VRapDngZ4sTz9WaCXhqcSJbohm5pvbQgXHgV/OQfwuViaA/ro7g5InTV9HJeo JvNWuedIOtH/Pdp+F7L5C2+KbkyMaAAKC5z0n+eIKXdJmSF+DhqjfuQhBU2d5w/5sHo2 1QtDeewiY1UMrnCpDFpHNvOaeyvxpzw1vsQez+tiIJEAJaplQAZWtC3COalwDkCUu+x+ /RttVLmroLXE2Ruemx4IliXq5Q86YPC9orShlTH1T0Mw33vkinp3I/yr4kGZuPxv9BA0 hZDQ== X-Forwarded-Encrypted: i=1; AJvYcCWBQTSIQTrJVQnliELazKoLfP/tLjSiZz6OwLAsCJOi6N26ABP/DO3Y6Syy0PffgED3dZlDAmRW6L6TVZU=@vger.kernel.org X-Gm-Message-State: AOJu0YwrjvY3BZTiqalFSUWSzC0IhJsLXoFTo/XH+rAbujWXC19D/ojC rJohSeUOC9qM+C66mBenYKTu2LyNT6P5ue0JBbQaZ6eQ/Icqeo13n6SbE+9SchhofnebqxyCqfr toWISIQosBIS86hgzew== X-Received: from wrbfn1.prod.google.com ([2002:a05:6000:2881:b0:439:c449:ae0]) (user=sidnayyar job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:1d12:b0:483:9139:4c1d with SMTP id 5b1f17b1804b1-485235c53bfmr2353085e9.14.1772729728341; Thu, 05 Mar 2026 08:55:28 -0800 (PST) Date: Thu, 05 Mar 2026 16:55:23 +0000 In-Reply-To: <20260305-kflagstab-v4-0-6a76bf8b83c7@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260305-kflagstab-v4-0-6a76bf8b83c7@google.com> X-Mailer: b4 0.14.3 Message-ID: <20260305-kflagstab-v4-7-6a76bf8b83c7@google.com> Subject: [PATCH v4 7/8] linker: remove *_gpl sections from vmlinux and modules From: Siddharth Nayyar To: Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Arnd Bergmann , Nathan Chancellor , Nicolas Schier , Jonathan Corbet , Shuah Khan Cc: linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-doc@vger.kernel.org, Siddharth Nayyar , maennich@google.com, gprocida@google.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable These sections are not used anymore and can be removed from vmlinux and modules. Signed-off-by: Siddharth Nayyar Reviewed-by: Petr Pavlu --- include/asm-generic/vmlinux.lds.h | 18 ++---------------- scripts/module.lds.S | 2 -- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinu= x.lds.h index 8f825dcbfae4..d2e4fa997316 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -508,34 +508,20 @@ \ PRINTK_INDEX \ \ - /* Kernel symbol table: Normal symbols */ \ + /* Kernel symbol table */ \ __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \ __start___ksymtab =3D .; \ KEEP(*(SORT(___ksymtab+*))) \ __stop___ksymtab =3D .; \ } \ \ - /* Kernel symbol table: GPL-only symbols */ \ - __ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \ - __start___ksymtab_gpl =3D .; \ - KEEP(*(SORT(___ksymtab_gpl+*))) \ - __stop___ksymtab_gpl =3D .; \ - } \ - \ - /* Kernel symbol table: Normal symbols */ \ + /* Kernel symbol CRC table */ \ __kcrctab : AT(ADDR(__kcrctab) - LOAD_OFFSET) { \ __start___kcrctab =3D .; \ KEEP(*(SORT(___kcrctab+*))) \ __stop___kcrctab =3D .; \ } \ \ - /* Kernel symbol table: GPL-only symbols */ \ - __kcrctab_gpl : AT(ADDR(__kcrctab_gpl) - LOAD_OFFSET) { \ - __start___kcrctab_gpl =3D .; \ - KEEP(*(SORT(___kcrctab_gpl+*))) \ - __stop___kcrctab_gpl =3D .; \ - } \ - \ /* Kernel symbol flags table */ \ __kflagstab : AT(ADDR(__kflagstab) - LOAD_OFFSET) { \ __start___kflagstab =3D .; \ diff --git a/scripts/module.lds.S b/scripts/module.lds.S index d7a8ba278dfc..23fa452eb16d 100644 --- a/scripts/module.lds.S +++ b/scripts/module.lds.S @@ -20,9 +20,7 @@ SECTIONS { } =20 __ksymtab 0 : ALIGN(8) { *(SORT(___ksymtab+*)) } - __ksymtab_gpl 0 : ALIGN(8) { *(SORT(___ksymtab_gpl+*)) } __kcrctab 0 : ALIGN(4) { *(SORT(___kcrctab+*)) } - __kcrctab_gpl 0 : ALIGN(4) { *(SORT(___kcrctab_gpl+*)) } __kflagstab 0 : ALIGN(1) { *(SORT(___kflagstab+*)) } =20 .ctors 0 : ALIGN(8) { *(SORT(.ctors.*)) *(.ctors) } --=20 2.53.0.473.g4a7958ca14-goog From nobody Thu Apr 9 21:51:26 2026 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 187443E3D92 for ; Thu, 5 Mar 2026 16:55:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772729732; cv=none; b=BOD/Rp3izJOeUfNg7RxtWEjZYMeVbHM4j064dv0FuKaKR+aP81xz0osk+V5Mk9N5+e1dlqX7DPOggPSZg9enc3tmuq2KC0e9IJxZrdqbimGPeKLGCfb0LvH+BUMjtZYZy/IiWhnhdzbF8DHAjx18fz3L16nOcSZyr1W1FQa2wj4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772729732; c=relaxed/simple; bh=/LRjn4DsKeVQZ4dzyANbTGqQ6W2rGj3js9YDFwrFWZI=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=VrNXM8FYNdSu9GXy6lOQxQsPX12xoOlRrfPzFhHW3P6t31doHHMCnQNrC4EToU9++LNZd1UKd6K4oca9qHZyJaaoXxpg9IILKZSZl4K9UnCxgPRw5S3P3HbUTo9gInrZmO8JdBiyopmoioB2+EHlpWmVD/CFOAQ4oIfKig07nVI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--sidnayyar.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=pHhQ2/8u; arc=none smtp.client-ip=209.85.128.74 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--sidnayyar.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="pHhQ2/8u" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-4836abfc742so66202515e9.0 for ; Thu, 05 Mar 2026 08:55:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772729729; x=1773334529; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=uMu0xUqSjGdHKDTYMSydPkunIn5YCF8kNNeiDqHV0Wk=; b=pHhQ2/8uHTpXv68YWMRQZBJDjsKwVeJRgcDzZmZL9spHMUz6RVYPrsZBQY6CXE5ySO RNPUa0ReqPw5OJazHnkzxakJYEiN23VXB4MRuviR7wRS/ppXc0/qAxASRBhmIhuyI/C5 PtlLCwaS5vl2fOe2l/KpYcOmg+A63HT3ltfE0Iw25y9glu/md9uKhwirBllxdaLgYBd6 t9n/AEfU3bt/QeFN7833QITar0rY5e2k9ysPjXCarpKq9eg9sF4ujvcbx+sKUDYdonJv nY3n/6XyF/clIZn/KFdzIJKwMmUVtHwTXf/06e5hS/LB2TGjDrA5G9yru5MIPxGL8pQ2 blyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772729729; x=1773334529; h=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; bh=uMu0xUqSjGdHKDTYMSydPkunIn5YCF8kNNeiDqHV0Wk=; b=EUTJviY+sezzMM2MNWnwV/biHd2dguHmyNje49+aSwVfKhuKpMkWW9Ej8957ZPz7yx qMHEC2hPViSKhGjuHmi/MRgD220n01EUbrwHr3wO497Tf5IkgHL2s6Q5q30McZnaSSp4 nX4yvznMvoSHhe8pFfjoqQ0FdY6LFEfxvxGsymubMC/m5/uwLy9PyypuC3qSFkrtQovo wBoz2jr3O7YMa1dhrl03ga97YOGMRowN+1+z1hC+quPUY5wqwyMLLL1t2fysnksyX0vq 9aYPahP/kyksDABKB3fxtlaxqeYFlqsD0hns1zUXBV9PgiFM4AX9mPPz4YojcHG5iZx5 BHdQ== X-Forwarded-Encrypted: i=1; AJvYcCUGHdpwKv7p2o/e0I+rNWVOrUGcNjOgGMhlXtQ2t2SEtXCDQ9WEtd7sVTDBjvZ3UK9N/22HuilOcujAYl8=@vger.kernel.org X-Gm-Message-State: AOJu0YxseQLy2IbVItHRZNxMv+8WOa1du3PSqyT4MLy/4FaC1MAKkW7/ o3FPvCLSgyn8d5n0/SJGqOcVuJlsbkVTDswa84Uq6uBAcXvErCwZ266rSAADW7Iidxm3T4lTWCE 2Y7V4E3wWU/neREgfyg== X-Received: from wmdd20.prod.google.com ([2002:a05:600c:a214:b0:480:4a03:7b6c]) (user=sidnayyar job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:c4a5:b0:477:7ae0:cd6e with SMTP id 5b1f17b1804b1-48519826fadmr111254425e9.5.1772729729537; Thu, 05 Mar 2026 08:55:29 -0800 (PST) Date: Thu, 05 Mar 2026 16:55:24 +0000 In-Reply-To: <20260305-kflagstab-v4-0-6a76bf8b83c7@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260305-kflagstab-v4-0-6a76bf8b83c7@google.com> X-Mailer: b4 0.14.3 Message-ID: <20260305-kflagstab-v4-8-6a76bf8b83c7@google.com> Subject: [PATCH v4 8/8] documentation: remove references to *_gpl sections From: Siddharth Nayyar To: Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Arnd Bergmann , Nathan Chancellor , Nicolas Schier , Jonathan Corbet , Shuah Khan Cc: linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-doc@vger.kernel.org, Siddharth Nayyar , maennich@google.com, gprocida@google.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable *_gpl sections are no longer present in the kernel binary. Signed-off-by: Siddharth Nayyar Reviewed-by: Petr Pavlu --- Documentation/kbuild/modules.rst | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Documentation/kbuild/modules.rst b/Documentation/kbuild/module= s.rst index d0703605bfa4..b3a26a36ee17 100644 --- a/Documentation/kbuild/modules.rst +++ b/Documentation/kbuild/modules.rst @@ -426,11 +426,12 @@ Symbols From the Kernel (vmlinux + modules) Version Information Formats --------------------------- =20 - Exported symbols have information stored in __ksymtab or __ksymtab_gpl - sections. Symbol names and namespaces are stored in __ksymtab_strings, - using a format similar to the string table used for ELF. If - CONFIG_MODVERSIONS is enabled, the CRCs corresponding to exported - symbols will be added to the __kcrctab or __kcrctab_gpl. + Exported symbols have information stored in the __ksymtab and + __kflagstab sections. Symbol names and namespaces are stored in + __ksymtab_strings section, using a format similar to the string + table used for ELF. If CONFIG_MODVERSIONS is enabled, the CRCs + corresponding to exported symbols will be added to the + __kcrctab section. =20 If CONFIG_BASIC_MODVERSIONS is enabled (default with CONFIG_MODVERSIONS), imported symbols will have their symbol name and --=20 2.53.0.473.g4a7958ca14-goog