From nobody Thu Apr 9 21:49:50 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 69BAC3DA5B4 for ; Thu, 5 Mar 2026 16:54: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=1772729671; cv=none; b=iGZBV46xZ+euZJGJ0zXj870zA0TjNQuHjnxJWR+iqBy85MsOJYLWExte3FodM+LS89nBtkZJsYOHLna2NOhkkZPFWVaYaiwA+GW0Rj+eiTkAYm0xE73A9U4O3zlMM2Qa/gREHHqMzdUh4ehH9ZGAUJfGxVvBmLcBpHmBl4cMIC8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772729671; c=relaxed/simple; bh=Bb1KMrLqycT1mJTEbsbAR/yPkfis88j4rK2phU3dd5U=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Cj3QBIqyJaKdpGEDbvqYSfFOVOI+53J+ho5PoXIpncPDzvtGZh/LyJd9zUMZo2LdtIVPGdBHSenGJkm2i3ZhR5aCYsJbGj3BoM6jbeXIVECNELIYSmCcfJ/XbTYrQ25341uDNrEdZISNlGAaX/WsNGHqFz8Aajd8AuCr1fncZp0= 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=sluHBj5J; 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="sluHBj5J" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-482d8e6e13aso67093695e9.3 for ; Thu, 05 Mar 2026 08:54:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772729669; x=1773334469; 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=sluHBj5JfAAw33DMwk5C0P7EoC2p68PVq8RIlHzHG68iPKFgypy4gCkU+ybrrSk/mR +T4SjJSSWUaJSOFm4/INlHG7cYUMj9WxW7/H+3Nl1LpMOeQLUmZgrRmvtkAFzBNdah12 gS+n8yoY2V+rSh+zyKmbofIW/TYWQejCb+fQa2gp4pKtsGpNT34YmIgF9Xw+e70a16vJ O2mhpZERm/kgnJ/c67dnCwCdzTx0XKdFX/9k5OwGivtd5h8RiBsT/fARLO18LmHP+1po WQaSA4CQsyKZWJTH9Ef8qbx86eEvWCuDZ9r5qyBZkrGCRrMG/9ZWvdpXrqEOYKgt0YBy B2hA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772729669; x=1773334469; 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=E560Atd4dSHyMbLLLLXOpK8jtEAriVc3b3hlHFaZu2i7Rgc0AtNO0c2jCE6QWYoWSN OymLJ+3YBxseFUDjZwVc7PVyDdbGYT8t5/LFYqbogVdjpz/U7pJFBwlYN49NzVzMtejT kz0wT04MafxPN8t14c7jvqYpLP20m7V7Dts72jwMds8j+CYK+yGmxYXs4hsy7ASP5SXw S/nj24tRqnvQ03OtRLQJYhQOFsWDMnC/YGIk+4UWsF685YsAYk8bRI8wJg/SRMChGLIG Wh7nnAGgSFPzyxd5GZQZoDTESET4ATJv9iJdOGWwIQQ3d++F6VS1weUlLiLUBDHmC7F8 QiKQ== X-Forwarded-Encrypted: i=1; AJvYcCU7zlYQ4xBnxU8fcX+YmpccZ/RL2YyicgTwamsR+fTb+gupWw2I8u9se5qleRkEujyvrLgNGmIr6xCm58w=@vger.kernel.org X-Gm-Message-State: AOJu0YyAyaEJEwy34zUGMY6iCZ4JyDowI66H2Ixp8oOT/0HRFEjuxx6p UY2BQivesf5JcNXJ+QW2jczGvrsMSjh7kpdS+WRHNWTahRZc1ADmw1kwQvlM4GOE9vLmDvrYWk/ TIzU7yorPHYKDas3ENQ== X-Received: from wmnf7.prod.google.com ([2002:a05:600c:43c7:b0:480:1bc3:e23c]) (user=sidnayyar job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:1e88:b0:483:703e:4ad5 with SMTP id 5b1f17b1804b1-485198800afmr106818555e9.22.1772729668779; Thu, 05 Mar 2026 08:54:28 -0800 (PST) Date: Thu, 05 Mar 2026 16:54:21 +0000 In-Reply-To: <20260305-kflagstab-v4-0-4fe6eea27e30@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-4fe6eea27e30@google.com> X-Mailer: b4 0.14.3 Message-ID: <20260305-kflagstab-v4-1-4fe6eea27e30@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 --- 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:49:50 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 C92483DBD57 for ; Thu, 5 Mar 2026 16:54:31 +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=1772729673; cv=none; b=SAltPusTSIvk5OfW/oU0cK5XARp3/cy+uRMMGjN3EjoHTqbJeui3EsLh5LUxx/RE/c9yUc1U3QQ1cjjNWSOZzJb/LzmZN0OcFC9uxaBbyT6CUN11bwZ5HVTG/ck4cuAtrFwhWS7PhLHrvZxU2RYtWauoBZeigMAqsZ/2YNzGgT8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772729673; c=relaxed/simple; bh=P86ac5my1fDlI8n2GQxcGL87lpW9m2344uJNQZ3J/J4=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=UjJDW/741/poM+lySbQQ5eJdn+7Hs7sdSXbIPhnZbCmPFkQByUZUUb/U7plyXZ4sYdsr6XPXEjNAvgmR1JQuPVU7NMbPB+xljs8b5tMqkOq7Tt31UnfAuCHf7GZCCdXnbnGVBVbSfzV1tIVDDSMhT6WSVL97Antlg5aV/lszaI4= 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=CIC9YsA/; 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="CIC9YsA/" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-4836abfc742so66197275e9.0 for ; Thu, 05 Mar 2026 08:54:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772729670; x=1773334470; 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=CIC9YsA/S7B74m6EcNsCBGM+3FTucRXi0kJgFe58qZaaPk6P6OpTVNGuLwuwuO7PLY LWtEfrCHamzxiYXBm1Ofpz/KBeQqi+uBNNI+PreXdCLVJvG2+LDyokB1l7a4SRH/hbuZ LAG/1Qnd34hDOye8VTsP7ZrlNmcpC1aZhcN330xTTrxkX2t4TZypQb67PBGGBYx6ae0y hgGAj4PyulvCiISCq7/+MqE8z4cbT4C5/pZxcoQ7O5eOOEcg1Pr7OlzhGVhkjWKyOu3U KT5Zj0kzFm2jEf2u/I33zgCYBkUbZHSyUgEX+bq8PTK1iGm8dqmFDe4N++0F/zPz/2Pk 6lcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772729670; x=1773334470; 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=RLLztDD7/PveW/6xKXjiV5rqUAeQB3XXrwSakGIeHLgbtCBGVfjPBPSItt1xtdThIh Zs+wv5LTi6jR1lzUVxJc4Gl9PhfvrZZeO2H9qxvfjUV14h0dx6a1Kk+nywrUivzuVR9F YHWF5EFm0ogd5LebeNvwq+zRLdVs68OzH3uzHSX/C3VmNFRKKhv+1krPOZnUok0LPFIY UCptbhbQi13KnNksKMMew2X4a7ZYFsyFDRBqAPJCVwnPHuNhHlDWCyJgFnIsClF4YER6 Gr/PibxxYd8PtYtlYJ85bRZMek4iPu6B791HRuTN5wBughq9nCYT2n4XHTfrNzQPoxvw Z7tA== X-Forwarded-Encrypted: i=1; AJvYcCXPhrNhchtmxwWe0cCtXCv5Ahnmb5NXGII7o66cZyUvUS1k5+6ozsPTkFofy6u1ViQnispusRE8NPyPueg=@vger.kernel.org X-Gm-Message-State: AOJu0YxOfx5ufL3oEinDSwzHuJGtJux1h7naTTLYFOt1yfBwHOLT2s6W v3T+XgPOadNbEA9WHNKPVsUGdfzn5MjoMnKWKzDAAzB5q05w+MMtvRMMibNmBvYy/9P2Df5VtVO anjSPmEPnwdt2azTm/Q== X-Received: from wmap19.prod.google.com ([2002:a7b:cc93:0:b0:483:26c3:383e]) (user=sidnayyar job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:35d6:b0:477:54f9:6ac2 with SMTP id 5b1f17b1804b1-485197d662amr130569275e9.0.1772729670078; Thu, 05 Mar 2026 08:54:30 -0800 (PST) Date: Thu, 05 Mar 2026 16:54:22 +0000 In-Reply-To: <20260305-kflagstab-v4-0-4fe6eea27e30@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-4fe6eea27e30@google.com> X-Mailer: b4 0.14.3 Message-ID: <20260305-kflagstab-v4-2-4fe6eea27e30@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 --- 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:49:50 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 266113DEAEC for ; Thu, 5 Mar 2026 16:54:33 +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=1772729674; cv=none; b=VJ/b+OBQvjHLkiDmSGAmz0cxyoVCERdrlQWzrmKFCHAjpqosu8jsw+u+ECoPCCvdGgXSrhkzWkucc8j+ZpBFTSw+lEPVFy4g+Md+NIQ+uVA44qU2z1N1QQRS3EmWzjYkX0yU6efRGb6Irkff+rEX1Do+Ncf3jVRg4GnQouB7glk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772729674; c=relaxed/simple; bh=A4U/FoOHtW+MFUPt0VllbbGZtdckI6pJiFlzK0SEzrc=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=U15ZsEeONqEHV20GH9z8y4hyHqcWh629G2CTlZ1QMW8kcqgbtPOhzQcii3AMRjOnYM6Rg3VpByzIEEA5VKiLqbd7aH1Um/E4oFc9Uv+63KXeTnKCnDdv6BIiGnnS2Kzne0oNpaj1rir5gd//wp9UMJqhOs1UY24mYTClY90MkHc= 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=4HMD/CGE; 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="4HMD/CGE" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-48079ae1001so61263465e9.0 for ; Thu, 05 Mar 2026 08:54:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772729671; x=1773334471; 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=4HMD/CGE6dbg/CK+yImdBeNbWOOeE2skBGvhrTrV+0Z2H8NvDeODh9DowVcyCKtywL mh8Kw7YXzusDb/8brKi+mGqX6BdWeJB2THRPDTf4/nXtCdvxXuIWdFRqR3i4493VPfu3 3uP6GTgJWcbKPSJ47PM+HCEr7Co/PuMfqjtiuSXrfCvVyCXhVJoLpEGME/7YKXL3hPeK cusZ+CsT3CTDfbwgLgm7uXAI457I1N0mXH/2BB3cZ3NvQuLNXkADTCX+eCUsqNPbovWp EbneL3eu6P8TRCXUKXrgrR4xbatDPWc3Rq1JHMdRKRU8Jm/1H5zK51FNph/9TTa/gpdW aSew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772729671; x=1773334471; 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=G8d+yych/exG5GpkY2ChS6gmQXl9UqOD6lcieZiRtPVOZ/DJ2bOraioPVkS8ZHH57M PUS8D5PjYGxVzLG6xXFGTFR5svCV0KJgFNHp1ZMLY03mwjWNKTK1s8xqoDweTBjGgvL4 YQlFZmnZgXmwLkD0woUBpDznhyYVFMEAU2DBxmfmyK+iX/Py2ZPQWa2Mqwi1m9xafTCR QjppXVhArm+pcmUUGUvomXFee+4cCLjr6yDUhvCjH4S45eoXU1eIcjpAlMRVbytMx4sS znkSKHd5I7B0FLsZ7xlxosmYI1cPxIGbjs5DLfes4bVIzhhvIpdixxTkEGIoVTWrJpUZ r6lg== X-Forwarded-Encrypted: i=1; AJvYcCXayX+/6Rr7bZd0/EEcjHOeZOcU/x+5uOWz36qBApHhM0zqOln0L1Xv+tPnO7WrcQZO3bSY8yt0LrKXfyQ=@vger.kernel.org X-Gm-Message-State: AOJu0YyH2LSKE0LB+Q1tJF01pR4A+GdbwNoSLSPF4Y3ABSyvbTp8qQrn ZvUd+7oTZtp6TxbckxnshTr1e/1eTFBO3keAf6GWXPalseLVpi2YWHUm2nflzXlgqLeibmO1XQu eX0SEC3LYnjgX88EDlA== X-Received: from wmbjv25.prod.google.com ([2002:a05:600c:5719:b0:480:6a27:9ec2]) (user=sidnayyar job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:529b:b0:47d:25ac:3a94 with SMTP id 5b1f17b1804b1-485198840ddmr115115695e9.17.1772729671507; Thu, 05 Mar 2026 08:54:31 -0800 (PST) Date: Thu, 05 Mar 2026 16:54:23 +0000 In-Reply-To: <20260305-kflagstab-v4-0-4fe6eea27e30@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-4fe6eea27e30@google.com> X-Mailer: b4 0.14.3 Message-ID: <20260305-kflagstab-v4-3-4fe6eea27e30@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 --- 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:49:50 2026 Received: from mail-wr1-f74.google.com (mail-wr1-f74.google.com [209.85.221.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 7FF653D75DE for ; Thu, 5 Mar 2026 16:54:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772729676; cv=none; b=fPXgtnrTEShE2v/8gwnKm4MXphtR4hWi1MpwVx4g/qxUiQ1jAaXoQ43KCrmEVQmyH9xtPZDHrSFf+lOyHfUUL8Ig8CP+0fgMsf4Igh086Tp66q1rJVUbIHqjcO0DezGlNbxleOA1RCro3hsFw3eKiRwcVt/wMLDnTf0uk49Crvs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772729676; c=relaxed/simple; bh=TpZmRegtqEbXTTVHSkwGbHY5Ll9KMK2Mxg+dapA2VWM=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=NwD7SoEOEV4nJW7tfrHK7QrtYb8PXxt1+ZN0//LMHUNnaYhK63dP5uGlxff8LIsIHd9E6mtsSam32FesciBDcjpKaDP9gq9pEKTl5/WsxVv5lhVZKGUJFDGXLvq4w4uPmiy6TIdv7LMUnqrHrQ42f9HXic7PFhPQayfodp0Bofk= 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=bQrUUkam; arc=none smtp.client-ip=209.85.221.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="bQrUUkam" Received: by mail-wr1-f74.google.com with SMTP id ffacd0b85a97d-439aa1d898cso4906051f8f.2 for ; Thu, 05 Mar 2026 08:54:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772729673; x=1773334473; 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=bQrUUkamxN1QkJYCeRefJ2D3tyeyokD5aDFT/QmtFslOeekId7+b0YOX+53+m9ccJL p9/21KJQZGb+TYYaoWsAuBn5U3N3ihZy7t2QpGgKoDaA3Ajmkfiekwz/GNVuwzAhjciA 9B5EPQ9phmRMBr31t1xbPtPr0Whu9DsXtxDLcUlpSzTJFffZYgCLopHOF3Lkb1Set+Kq 0Mf2wyara4QitFhem9FfEeLPV/ovR6yJoO7CDzeK8ey/8fcWW1LVjSiqA12VRvdELWsz Mpgc/QStXWlC5ixDfczhbY9IFxG8JMrEFmzqjg5e38YvkvEfvthSYunoik+1a9BMBNyN Azjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772729673; x=1773334473; 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=RikczWDLWGvjVJOt4W59yBSoYcV9bpszUdn3SjCTEsxL9dwvdLyyaZuqTLdj4LDJBw 7klOSNxu6ULqvzKVvubeP0llItP6vTi7W4ZJSMDmgIN7TrJ/kFzFVkc45ZUWFzWaCRo8 SOa9Z7IRxwdJ53+dxEgbiRiCaLLclyHxQzFyq9M/EMhyi3ytqsfsVgctWmA+hiRZekwn 0OF3RLst6cw2l5Wv+Hzdzw2BlpGRM8wc0rilyBeStOyiC/GuPNQGRiQIFq/iy9XKF40k eRh9RWgbFH/7ugV7C53fof2TQBYSOeCrpAZIxUMxWjd4yp4pCiyjCELD/CMtRG7OFmqG Z7nw== X-Forwarded-Encrypted: i=1; AJvYcCWAhoiUvEdOPK8w0FWAvoJ72DnecgQnlHv+5Eb3r2VLd7Vct87uXjx8hrXu/VoUs1JvtgaXNZAS13aKxzw=@vger.kernel.org X-Gm-Message-State: AOJu0YykJxj03yDOawUNE4UES5Em4FF+r6stZLIDGuVLVqhCzYqBHon6 MFIRGtr32PExhWkq7uRj4JNFGBhP31MeNfmCJ1bMOlvoZXVcKdh/HeWxAsejFc7qNFCtMp5qTCk o8W91IzDjM2O76e+obg== X-Received: from wrbgx17.prod.google.com ([2002:a05:6000:4711:b0:439:b92c:c91c]) (user=sidnayyar job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6000:2c10:b0:439:bce5:6518 with SMTP id ffacd0b85a97d-439c7fa448bmr11832934f8f.22.1772729672747; Thu, 05 Mar 2026 08:54:32 -0800 (PST) Date: Thu, 05 Mar 2026 16:54:24 +0000 In-Reply-To: <20260305-kflagstab-v4-0-4fe6eea27e30@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-4fe6eea27e30@google.com> X-Mailer: b4 0.14.3 Message-ID: <20260305-kflagstab-v4-4-4fe6eea27e30@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 --- 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:49:50 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 061F03E1224 for ; Thu, 5 Mar 2026 16:54:35 +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=1772729681; cv=none; b=iwamu4QG1oIOrQzOgiaueBMLZtu17qHBwSVLoizjWzlxK881m0pRpJ/q2+i/BBsdoaADRB1nn7bd09SzczXzpQTIishyjGe4YMeZcM2ig7BXrel/9wn3XSMD1w7jDTxFYinxL89SFRj9jxRScevWCaeLHWmuvOYt+49JrWx8SfQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772729681; c=relaxed/simple; bh=8wThas+yx6VNeitZlqkk+kXKQX1pW5KK15IT5W2pzHQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=DFl/lm09Utw/sPztQUNWHgk5HvagTGpB++1YsczRnkTXg7U/UL5qcxXxTyyEvmqKFPdQqIauXIZv1Nnxxqzzw7gULux+X9CVseqHd1TKYQ6H2IWA58fHAmpWLonZfduiQcN1xnClkHuF8veTWecM3YFm/7vo0vIMff2OUEG20IM= 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=zvmx1IpI; 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="zvmx1IpI" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-4836b7c302fso83507915e9.1 for ; Thu, 05 Mar 2026 08:54:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772729674; x=1773334474; 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=zvmx1IpI7nado72UsjjXdZvSHZfw4yt+2GZdT6YaJK3IPas3AXd3nWACJQmvMIN60R rj1fv2aMSshDBQ3/72gu0bHwjQfoYMTS6hFblTdKTAW3w5ZhiRR2rNHatBoXip9njWY+ /2hVbHFDGaQ0lRc2IeLom1c1DqtafCzl2VVvKky4oZCbdtij775/NUOU2RwVr22Q1Z4n 0qN5JAkcikrJxK7u0gs2LtCnMrRGa1hhnatCXYXs85ZsjentBTV3T+jIr/mcMoGwJHFw WDhPIRu0p2eq5Jandckz7yWdxEr3o8prGwx/kacYUg+kBh1It9fGRAwNYRb2XbylKwQn H4HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772729674; x=1773334474; 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=lxbPB4jxxYw9aYBD9VVZGFuVTf3VrkaSLex12ReIe1KlkNW/p+38ACsUTry40L5rIw WCh5lYplvQIcMmLukChA2avz0hrSkW5fb+kDReaVGiH3iF0Yu0XfxqajVwMZKN0MThli 8lynqBwiOQgUhyOwSC4D4dpc9OmGW61kCAoHCQxuOasdcw1k758CmiV8gVQE/FXctN89 T8EpvDLD0qTFnUb4VOKBCEHoLhzqvLggZ2/BncJ6Ix1J3jjgEkyHZS4m2wuuhZRqo+LZ zmvYQqXGk91kombovRQKgA30xWJHSUJOHs5P4mW2lnU28Ck290lQbzDg0dfKuiuhtH8b z6eA== X-Forwarded-Encrypted: i=1; AJvYcCXX7/o+XXR9zGZGyP0KYiIOI/MNjzhcPbOoOyTFxNWAV8krtCtUXAB5UI8YtCpnNpj0zQ92dnbUCR8Ax20=@vger.kernel.org X-Gm-Message-State: AOJu0YzBYN9h/Li5CaoO0W15NXRbMoNPeFOyBEmZ0IKpkulrrAkSzG7f Ukf3xGET1J4ob2Sv6pgcv6E9Nksn/jy7fazZnAtRTz1D9iDQ5yYKuRK3cKHvmnl4mkvcTg/Sy1K WaTBYxJ6Dbp+Fh8OVBQ== X-Received: from wmat14.prod.google.com ([2002:a05:600c:6d0e:b0:480:2e46:31e1]) (user=sidnayyar job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:8b67:b0:480:2521:4d92 with SMTP id 5b1f17b1804b1-4851989ca05mr112546655e9.24.1772729674165; Thu, 05 Mar 2026 08:54:34 -0800 (PST) Date: Thu, 05 Mar 2026 16:54:25 +0000 In-Reply-To: <20260305-kflagstab-v4-0-4fe6eea27e30@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-4fe6eea27e30@google.com> X-Mailer: b4 0.14.3 Message-ID: <20260305-kflagstab-v4-5-4fe6eea27e30@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 --- 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:49:50 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 D91813DBD71 for ; Thu, 5 Mar 2026 16:54:36 +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=1772729680; cv=none; b=U7flpiH/GmO1jCNmoMVsKgUTtlhhAfU6qyvpgM84z/J7bEDqJSt9W03duua3pI7qV2zYdv4ExKgXwoz3TcZcdFrM7Qf1vg79ZDr/JRaQqTdWdSKPHX0nH6poIrcGWVxSipt5GVWb9gB/2PAPjx9JaJiT3elg0USoX8gUYo95NEE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772729680; c=relaxed/simple; bh=fv1wHWnKrIC2PSslQ9gqnuOdMd+GSazSWOsjMOvnx5Y=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=HXryQDwB6kpu2giNaHHfmt9KfyhzDhWATu6QykM8k8EP1IKvy6GIr7ywqi7d0gBoOa4k9hYMzGLBqFBwmymyQI/51br94F7MEaTn7pZGwOBgW/lEtEhzhWILSHTI0Ys3opof2LiFY3VAURLU9/n99oLDoR8JSKCkQx8LKJF/bhk= 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=0y24uKFj; 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="0y24uKFj" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-483101623e9so78285615e9.3 for ; Thu, 05 Mar 2026 08:54:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772729675; x=1773334475; 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=0y24uKFjULkIa38q+zartyA+QMDPXKofAjo4QSS8Th0R02SBQk5OJG0rtzFjnv0jeF gisfTN7+Du0KsWjkO0YyvOXHvyUklfjjEv+2pGs/v0NP7CRbsa1mq7AhlEvJzIb4ouIK HDoGQva0vBWJ4HZa3SExbueHBGKorWOUi9Hj/oXBwjCloUiV1+AsKf9pQyAsH1GYrQEG z2Iqi/8RarScdmr/8+9VXQoss8ga/98yZwJDnPVGasCNmoQpOm6UisXhq/zri/ntuxRr n2puxmo8S3ZTX8byAqIBzZuX/3yQmbm8ImtbsYtu3F+rok6w8K8Ug9LvnIwazfkx1aNg d53A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772729675; x=1773334475; 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=n9vuU6UcfnKn2D4T5/VYNBLUQHQvYBHKl6WdMguCPqC6scIBQSulpcoXMvqYZg5Yc6 EYBySpu2XYkVdasSY8WtewigOliFgx6TLL+sHog5VXLyrLHkx6dRoFfiD6L+yEhovGyK kE8UrnatKuo1UydhP3Ww92WO0z5eWE41iwx98X9Zkk7dZIrDFmLQ7jacL5Tya/Zw9lto RsaG9lHnC9SM/ZZ3v/XT8GXB1c2ioG/wcl+8fTNx+iOKm7ESIgpRt04SpTLINKhYdyG8 mBv8ezdMRL9HfEYgPN798iNgXAGp/Fz+p3uJtOPqoA5gQGNuaXkgUqA4PMKK9UuZIn/w 9DDg== X-Forwarded-Encrypted: i=1; AJvYcCUouEKRU9j6Fbs8HsLYxSvCSDsF37FWNVRwHp9hXPQtlGRLA+8xJmY1Frp/tWNJ6/irr6Wj4a9RORO6PMo=@vger.kernel.org X-Gm-Message-State: AOJu0Yx8t9BCFdSWT9MJ327vvytofKHG5IBkFzKYYZJ8NVeyiqevCS1o 33px3TfAIG9PQVcKlmZbQ/w7KroJ8xJtT4NOMFPtnSy+mQgjFMOBju9+6y81b9uBDfGobqZfkDa isZDnnMjzBBngw6d/6A== X-Received: from wmpb29.prod.google.com ([2002:a05:600c:4a9d:b0:480:4be7:3f3a]) (user=sidnayyar job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:3ace:b0:477:5c58:3d42 with SMTP id 5b1f17b1804b1-485235bb7admr2503055e9.10.1772729675271; Thu, 05 Mar 2026 08:54:35 -0800 (PST) Date: Thu, 05 Mar 2026 16:54:26 +0000 In-Reply-To: <20260305-kflagstab-v4-0-4fe6eea27e30@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-4fe6eea27e30@google.com> X-Mailer: b4 0.14.3 Message-ID: <20260305-kflagstab-v4-6-4fe6eea27e30@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 --- 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:49:50 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 06BB93E0C46 for ; Thu, 5 Mar 2026 16:54:37 +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=1772729679; cv=none; b=WMRrgrgP4QOVz000Q/92lDDn4PtYxPEH/tWojoMsJlGOgN4uG011A0+B4gXtFaMM/hP0QSGyzPJXB/Liia/8pIStrloArBVt5rufP/DtCCfzaZ4cCZYNv+WtAAnO8vYKgUAAErhvLn3wDxpl+hsuUjP1j0pFtHwxCtfWzymiXWc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772729679; c=relaxed/simple; bh=kyfTe0G2VwV3QkAhN1GPs2mavv4U3uviJwI2JjtwqUI=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=unZ89x+UftPRg/L9KpCoSGwrXs6fCFv4E2v6Spo1L99QbdDFVl7MOpcf7GUxg4P8LuKSUUdMehPog+CewKXMQcZMdf0tXRTm/BYOb6Xdw0iVVctNC2k6VcMoa5aCXXKWX007LoZuC6YFnU+ayv2LPSmwKEDPTiUS2mJwT1WsF3g= 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=fEMn0oXe; 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="fEMn0oXe" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-4806cfffca6so84841945e9.2 for ; Thu, 05 Mar 2026 08:54:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772729676; x=1773334476; 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=fEMn0oXeALXszMX28BgO0W+VojAMuYJpiNcN//H9MdPHUEIPNIy/NjiYbjq54PqWvk +J1PrBFdGSsyyVKRJpu4tdN/40GC+7I0bq7vh7VDCfaB4wBNa08893G9vIUV6ps7UmfI LvJfvRg4May4r++G5LDpJgfN+F9xsl498OPOnDuW4LJYNwW7Wi7RQLltmTQst5XUs0sq u9lMGaBYP64Me5qOb7s0ErqVhflKkn1r2/MOii0KR6U+WCuI7xlk6+Tsdtg4CgGQz0ix 4XAv8hrjqlBlFTdybdY6xK9VqjeCJ2oL4zLwvL5rebdhBMADhWVca29qHlbmb42OOC9Z L3gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772729676; x=1773334476; 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=thF0KbEwbiF9YoZ6MUyX6UTwvy3izXl135S/HNEnxBEiCqmh1MljOnNEGSf/NjiVAa gXXKyjNR7O35xuyMYT7/6c8XkhDCV4rGiNKGmpxby4HTImPPTDQyE2S8qetoR7WLgcYG U/WDGq7DScxNXK0FH1m+zIm+Ex4MyXQtA8GTJz3K+P76IULFmFED4hxCHAXeLzAnc/Pj Fl4Y7cIgGj4YFJ9Qfk7f7MnjqVQ3xB/48fptK7YhB6npxjTUpkR+fB/IrglqpRKP6Rvo Fj0PuP1bWpSEBnk+nkLET47QdbXclLjrNHLZTXtA6oKA+P/QT/ZS8VBQWToJx2vPzpgY 0E+g== X-Forwarded-Encrypted: i=1; AJvYcCVwHubO63OKBI73M75i/+v0yr8Tw9A/L/FIwV+ZvJE7MKAgtDacdNUtS5Fvbu8D17m7NQMDO/eVwLc4Cz0=@vger.kernel.org X-Gm-Message-State: AOJu0YynBL3orbiLXYMk+HIRBo2mKaKFBMBo/kKy0CQ4EZy/sQToU6fY vx/R2gM6SvwZheKlQzuzD/45fiuUMYs8WduUnGkr8t0Ejk1MXmvQzES8EOHVcdF31D4VOPNmKFn 02XBYjL74/KCSlXmpXA== X-Received: from wmxb5-n2.prod.google.com ([2002:a05:600d:8445:20b0:47d:5bef:a379]) (user=sidnayyar job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:3b99:b0:477:63b5:7148 with SMTP id 5b1f17b1804b1-4851983121emr109133495e9.6.1772729676375; Thu, 05 Mar 2026 08:54:36 -0800 (PST) Date: Thu, 05 Mar 2026 16:54:27 +0000 In-Reply-To: <20260305-kflagstab-v4-0-4fe6eea27e30@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-4fe6eea27e30@google.com> X-Mailer: b4 0.14.3 Message-ID: <20260305-kflagstab-v4-7-4fe6eea27e30@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 --- 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:49:50 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 060DB3E1223 for ; Thu, 5 Mar 2026 16:54:38 +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=1772729680; cv=none; b=mDC9IOapJx5HkKSj9bY2BytlJ5fsXuIt+0A/eVy6YmcH+UlVyP04Z5oQizAy5Bg/JuNJa93h18uph/fZU7vFXSUvp4LuKcSTyBveOaGuz72AP/9JqlfmIUf02Q3J8e2GY9IWPGjhYVQprW3/Nth0ISjkkxd9HgYmROLgPDhlhLw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772729680; c=relaxed/simple; bh=/LRjn4DsKeVQZ4dzyANbTGqQ6W2rGj3js9YDFwrFWZI=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Pv3p3bx9UiPN160RMyLmym8OxlSNx1eH3zpWAILTSOOey3eBCywiZ5exSJ9HlVoI2v77quRxnZP7RFzEjaPsIosDNrqIp3A+BGX/zmv2H1n7AXFm5cxz3/tKThnt/5oioHT6SIGCMhrX0/9h32OPRfaCmUjB9dggs5y3PhvNLhE= 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=GFx8dS3R; 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="GFx8dS3R" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-48378df3469so57384045e9.1 for ; Thu, 05 Mar 2026 08:54:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772729677; x=1773334477; 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=GFx8dS3RPhRQrd8aEAhWoi8w6LrKqygyG9nnbjZDMVXKQd8vQI8w7O2rgm2mfo2RMA qwz6IApjkhEW6/xbjIVcnr4ZB3GjVsM+91O63iEhR/yz3On6iaJ8VBKZSMrSs8hR7Qel OKM5mY5jW/xXmciE/wschWdSOzaAx+obbzyMQITA5FLdmaHG7vSg/czlTcj9yCKeYXI1 2Iwuy/npohzCkrmxSFrHjVDPWd8zRcBVCSFT2V6YWMg3O6aH5HEbEvFEA3BGHfGnl3Rv VAs70FKibOzA1r1k6zgMjt+yaPmP78rbNHLhWYvSXIFHbIM0kXVW+UcmJxWtCWePeDRG sb/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772729677; x=1773334477; 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=rymrRvft3emKZ9eMjFyVea/NPWG79qO2bZWgOX9aehuISk6srL2WeDE0lr6a6l6vXz XW3F8ErK3XvS38gPZ5ouIEkXfZar6mHD0RKn841Fih9aArCqRm/CSxdZKDexu4sdjWHt 1Mwef0C1/ZD3OiHiS8BhG7kCwsBAAoPdcUOFmKLZI80L4IsD11jYErslqKz4ZEZr0q7w c6TG3bTYzYsqVoLhxevj9lP0d/mTd1DQwJX/Qmc+WVdrvvrCaKukf/DV4Q6LL3DBaQ4q ePqGiTlRdubGF4XO2pXQU7ouaUEo/KGgITEIYdF0y4uiIE+XTwXXHfPWYEWe0Sz/TQOP 1VUQ== X-Forwarded-Encrypted: i=1; AJvYcCU7IMt9Lw3HGH5/Lci/k7LC92d+hArlKOQSlIdTi24RD8mIrHp3XZI38dB0OoFNEvSZPE2b+Q1NdTuKOAg=@vger.kernel.org X-Gm-Message-State: AOJu0YyOecNU9/2CmlpG+BxcO52m0W3eBrP7exkb8sb40P285603A0Zh 5ZzToE3V0mgyZ8bNWMbCCZgoQ5wL5ZoPJD84Fh+Jqw+AsEWrMAnw11i5zncgssx+bncny9Y9X6+ Nq79WA61ukopn+CSEmg== X-Received: from wmqi19.prod.google.com ([2002:a05:600c:3553:b0:483:6fe1:c054]) (user=sidnayyar job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:5397:b0:46e:59bd:f7e2 with SMTP id 5b1f17b1804b1-4851ee93bdfmr46394685e9.11.1772729677377; Thu, 05 Mar 2026 08:54:37 -0800 (PST) Date: Thu, 05 Mar 2026 16:54:28 +0000 In-Reply-To: <20260305-kflagstab-v4-0-4fe6eea27e30@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-4fe6eea27e30@google.com> X-Mailer: b4 0.14.3 Message-ID: <20260305-kflagstab-v4-8-4fe6eea27e30@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 --- 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