From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f74.google.com (mail-ed1-f74.google.com [209.85.208.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 8DFFC3A8734 for ; Thu, 26 Mar 2026 21:21:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774560102; cv=none; b=tFqpmEt1v3gv0LGGoSTBZhK70ctQuhuvsaG9Lm9Z59DwkQ3QaqsZSiEok75mqVv3dDz3cVLrW6VNq7TarPK9Sqf5AxCI0uN1DeROaEGhHSE9V6ZQeNVUzjVdGAJIfBpRD2jgyiVg2C2Mk2rrL5AasJQtUTMFNpT+PzHO3pL+Js8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774560102; c=relaxed/simple; bh=dhaz9oRBN2LrlO9PSGOfI7otVV2KGMDVKhDfQTLvm0g=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=UaVznhwzN3dPKv5cv92TV5alSp3jnTzDzTjU8qd7vByHDsf4B8ZpXGu/kWUAeH+gBQ+cvIBYo3mDZV/fNl+mvT8Gdr0ldfP/yvMxrRql8asFGitUtWEvLkH7bkYpP4camhhuafv9YT0QPNHA9KgOA9Za+Ff2itQd5PYr6+3DaLQ= 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=CNYgqHo+; arc=none smtp.client-ip=209.85.208.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="CNYgqHo+" Received: by mail-ed1-f74.google.com with SMTP id 4fb4d7f45d1cf-668ad6574ebso1514843a12.0 for ; Thu, 26 Mar 2026 14:21:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1774560099; x=1775164899; 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=ZE42C9hekLpveGyF6RMfwZOJjelI4nIxMgNfnUlAiOM=; b=CNYgqHo+nsn6+52h3Vz5Dy2vrKxUl4vVbYIm+G8/CPASSSepVNkkCZPZhs4OW5CLJK JQX2nLjlXgeUi4qysCCZ0O8YkKyDPiDzaEEykBEsbPdGeK6q7hBoVcTmPTnOgKCbPyVx LCMEvP+pb99HwI0KsWVC647uLtBJWkx+T2T3kn7CquQbYud3JoKW+w/Wu2OncK/0hyx2 DpI1JG4S/rdGpxkyPhZWgCEO1xvvrnwz6z8unSJjfJ7fBWt/7/pptbxVCJaIb+4r7GRO fzgVb35fC355FOgTxuN5w3HY6penk2cySDbedjNGqtQ6czxBdUaN5fmhXZ/Eiz5G9jlL qQhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774560099; x=1775164899; 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=ZE42C9hekLpveGyF6RMfwZOJjelI4nIxMgNfnUlAiOM=; b=ZXa2kfQDc5hQR9fSccPa2Wjun23Phk24SROtBY/0U60DpIwJpG0obC7ay8gCE0wgMo OvtHFGENtl+ypLm9GUOlJtMrPBtTXivt9qKhd+o5tlf6sOTV7dmgOfApBic92H4nnglr 54l5cohKIL8B5w2NdFyyYgRWmifOPQSIyvjItVmZEYWa/nsTZ6KRZFGAenctayWGtxFp aVS4D/mNK1KnXa8RhuNb4Ippis60fqk1vNAMXnfPj0KtULrXzrN9Look0IgWMiONidoY QHmDLDNSZSe4eI4fqSs4JDqPcc2PT1389OVQUpLmv3oYleqhthigalI8bqbWk4HIrG72 SXAg== X-Forwarded-Encrypted: i=1; AJvYcCVUjlXYeV9h06UL4UoHzFFmjoEuGBaYJe7UWs34GyM68BXIQWJzjc8EqlSK/Ixa1Oz56Fr8MzpDbwQ=@vger.kernel.org X-Gm-Message-State: AOJu0YwfQFaS/GcZbx/hwK8MAE69n8DNosyQnYeF85TrEJ7V87TexTQZ Te8j/1aH9VJG+eTkG/jd493/HXrkbtj1a8YPRujWBaWUM8KKhUtmA/d3m7c1iNszB8NCpW0V9te 3MWdYefnD/QvfWx+dRA== X-Received: from ejccw7.prod.google.com ([2002:a17:906:4787:b0:b98:2423:3942]) (user=sidnayyar job=prod-delivery.src-stubby-dispatcher) by 2002:a17:907:e0d8:b0:b97:c968:d9ba with SMTP id a640c23a62f3a-b9b502c08b3mr856766b.5.1774560098750; Thu, 26 Mar 2026 14:21:38 -0700 (PDT) Date: Thu, 26 Mar 2026 21:21:33 +0000 In-Reply-To: <20260326-kflagstab-v5-0-455cd723dddf@google.com> Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260326-kflagstab-v5-0-455cd723dddf@google.com> X-Mailer: b4 0.14.3 Message-ID: <20260326-kflagstab-v5-5-455cd723dddf@google.com> Subject: [PATCH v5 5/7] module: deprecate usage of *_gpl sections in module loader 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 , gprocida@google.com Content-Type: text/plain; charset="utf-8" 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; /* GPL-only exported symbols. */ - unsigned int num_gpl_syms; - const struct kernel_symbol *gpl_syms; - const u32 *gpl_crcs; bool using_gplonly_symbols; #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[]; #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[] = { - { mod->syms, mod->num_syms }, - { mod->gpl_syms, mod->num_gpl_syms }, - }; - - for (i = 0; i < ARRAY_SIZE(arr); i++) { - for (s = arr[i].sym; s < arr[i].sym + arr[i].num; s++) { - struct find_symbol_arg fsa = { - .name = kernel_symbol_name(s), - .gplok = 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 = mod->syms; s < mod->syms + mod->num_syms; s++) { + struct find_symbol_arg fsa = { + .name = kernel_symbol_name(s), + .gplok = 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 = section_objs(info, "__ksymtab", sizeof(*mod->syms), &mod->num_syms); mod->crcs = section_addr(info, "__kcrctab"); - mod->gpl_syms = section_objs(info, "__ksymtab_gpl", - sizeof(*mod->gpl_syms), - &mod->num_gpl_syms); - mod->gpl_crcs = section_addr(info, "__kcrctab_gpl"); mod->flagstab = section_addr(info, "__kflagstab"); + 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 = 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"); } -- 2.53.0.1018.g2bb0e51243-goog