linux-modules.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Siddharth Nayyar <sidnayyar@google.com>
To: corbet@lwn.net
Cc: arnd@arndb.de, gprocida@google.com, linux-arch@vger.kernel.org,
	 linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	 linux-modules@vger.kernel.org, maennich@google.com,
	mcgrof@kernel.org,  nathan@kernel.org, nicolas.schier@linux.dev,
	petr.pavlu@suse.com,  samitolvanen@google.com,
	sidnayyar@google.com
Subject: [PATCH v2 00/10] scalable symbol flags with __kflagstab
Date: Mon, 20 Oct 2025 22:43:17 +0000	[thread overview]
Message-ID: <20251020224317.723069-1-sidnayyar@google.com> (raw)
In-Reply-To: <87ikgieiar.fsf@trenco.lwn.net>

On Mon, Oct 13, 2025 at 8:02PM Jonathan Corbet <corbet@lwn.net> wrote:
> Siddharth Nayyar <sidnayyar@google.com> writes:
> > This patch series implements a mechanism for scalable exported symbol
> > flags using a separate section called __kflagstab. The series introduces
> > __kflagstab support, removes *_gpl sections in favor of a GPL flag,
> > simplifies symbol resolution during module loading, and adds symbol
> > import protection.
>
> This caught my eye in passing ... some questions ...
>
> The import protection would appear to be the real point of this work?

Yes, import protection prompted the introduction of __kflagstab. But I
would agrue that __kflagstab in its own right is an improvement to the
overall health of the module loader code, therefore can be taken even
without import protection.

> But it seems that you have kind of buried it; why not describe what you
> are trying to do here and how it will be used?

Point taken. For sake of clarity, import protection is a mechanism which
intends to restrict the use of symbols exported by vmlinux to signed
modules only, i.e. unsigned modules will be unable to use these symbols.
I will ensure this goes into the cover letter for following versions of
the patch series.

> I ask "how it will be used" since you don't provide any way to actually
> mark exports with this new flag. What is the intended usage here?

Patch 09/10 (last hunk) provides a mechanism to enable import protection
for all symbols exported by vmlinux. To summarise, modpost enables
import protection when CONFIG_UNUSED_KSYMS_WHITELIST is set. This
results in all symbols except for the ones mentioned in the whitelist to
be protected from being imported by out-of-tree modules. In other words,
out-of-tree modules can only use symbols mentioned in
CONFIG_UNUSED_KSYMS_WHITELIST, when the config option is set.

I realise I should have documented this behaviour, both in the cover
letter as well as in kernel documentation. I will do so in the following
version of the patch series.

Please share any feedback on the mechnism to enable the mechanism. In my
opinion, CONFIG_UNUSED_KSYMS_WHITELIST has a complementary goal to
import protection and therefore I felt like using the option to enable
import protection. In case this seems to convoluted, I am okay with
introducing an explicit option to enable import protection.

> If I understand things correctly, applying this series will immediately
> result in the inability to load any previously built modules, right?
> That will create a sort of flag day for anybody with out-of-tree modules
> that some may well see as a regression. Is that really the intent?

Unfortunately this series will break all modules which export symbols
since older versions of such modules will not have the kflagstab
section.

Out-of-tree modules which do not export symbols of their own will only
fail to load in case the CONFIG_UNUSED_KSYMS_WHITELIST is set and the
symbols which these modules consume are not present in the whitelist.

Regards,
Siddharth Nayyar

  reply	other threads:[~2025-10-20 22:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-13 15:39 [PATCH v2 00/10] scalable symbol flags with __kflagstab Siddharth Nayyar
2025-10-13 15:39 ` [PATCH v2 01/10] define kernel symbol flags Siddharth Nayyar
2025-10-13 15:39 ` [PATCH v2 02/10] linker: add kflagstab section to vmlinux and modules Siddharth Nayyar
2025-10-13 15:39 ` [PATCH v2 03/10] modpost: create entries for kflagstab Siddharth Nayyar
2025-10-13 15:39 ` [PATCH v2 04/10] module loader: use kflagstab instead of *_gpl sections Siddharth Nayyar
2025-10-13 15:39 ` [PATCH v2 05/10] modpost: put all exported symbols in ksymtab section Siddharth Nayyar
2025-10-13 15:39 ` [PATCH v2 06/10] module loader: remove references of *_gpl sections Siddharth Nayyar
2025-10-13 15:39 ` [PATCH v2 07/10] linker: remove *_gpl sections from vmlinux and modules Siddharth Nayyar
2025-10-13 15:39 ` [PATCH v2 08/10] remove references to *_gpl sections in documentation Siddharth Nayyar
2025-10-13 15:39 ` [PATCH v2 09/10] modpost: add symbol import protection flag to kflagstab Siddharth Nayyar
2025-10-13 15:39 ` [PATCH v2 10/10] module loader: enforce symbol import protection Siddharth Nayyar
2025-10-14  7:34   ` kernel test robot
2025-10-20 23:00     ` Siddharth Nayyar
2025-10-23  2:36   ` kernel test robot
2025-10-23  9:58   ` kernel test robot
2025-10-13 19:02 ` [PATCH v2 00/10] scalable symbol flags with __kflagstab Jonathan Corbet
2025-10-20 22:43   ` Siddharth Nayyar [this message]
2025-10-21  8:35     ` Petr Pavlu

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=20251020224317.723069-1-sidnayyar@google.com \
    --to=sidnayyar@google.com \
    --cc=arnd@arndb.de \
    --cc=corbet@lwn.net \
    --cc=gprocida@google.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=maennich@google.com \
    --cc=mcgrof@kernel.org \
    --cc=nathan@kernel.org \
    --cc=nicolas.schier@linux.dev \
    --cc=petr.pavlu@suse.com \
    --cc=samitolvanen@google.com \
    /path/to/YOUR_REPLY

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

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