From nobody Fri Dec 19 20:17:44 2025 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 36AD031BCA3 for ; Mon, 13 Oct 2025 15:39:54 +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=1760369996; cv=none; b=I6Z+Wdf7KnzhLDqA4WVkiy8nUI1lLdWv20HlsbLVmHxLJeOBsWoSS/W/nv8eQ8V9I8U9bmMgLTc77zbfvzzKJOZ1pVHaUhEB2bSWA87sqIoBh8Dp93qIYexhMKLPWofC74V3r8QnF+7D1PBm1kZzLtfUNg9oJ3imBsEtSQP3Ng8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760369996; c=relaxed/simple; bh=RLWrJA6e0o1fvEZPXCTEkfPrFrwKqhIpIw4wVbO6co8=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=oc56c8cZXTMAsyqjtYu5WawLV9kmIGCQkmygC3B7W/mBPT7v7argSpXDRK+DAxlsw+Dv4E8NBFU2N8f3lP1N6Jm+85oRdNi4U6h4IGXzH1aSn9xUmHZzIP+yCoE+UttOXJ+RzFeg+Sg/qeLBvYMEmKuDx0aeaBlHoxVRUjJnl+w= 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=SjQIS3Ul; 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="SjQIS3Ul" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-46e4335fa87so30540515e9.0 for ; Mon, 13 Oct 2025 08:39:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1760369992; x=1760974792; 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=a+g1ys0MMb9WULZqvnNzuABkcTm+/NGxqiHjvVRRSBI=; b=SjQIS3Ul7/PrB8Pe97ZCMHCNseoYl5UvPNI27D7c+HJ3hHzFY/1b1sPpHkwcN1XhHe 6DelFYo3MAXKB58aIWz3RUmtaaS+HItuauZJsaFqfA6wrhInQZlXQQaC6HZhqsLg0wN1 WOD8e03pvhHhZ8Q/LAI3nwJMuK1UR5lfkiQy+jw7G6JYF5M7oMlKxvd6vtH3YHkydxss +MO3pRmjlRar8/4u0YEI/IuELW5qoCB/DK0Re6ihFlxMo7N9/ekX8tcqKxF3DmAgpPJr WDZmLzLITaOVQtQ1ohxPoJAY50Ou27HMkBcl1+AHivBqcKByMT4vwA53HR1mrGRGSsXL LoKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760369992; x=1760974792; 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=a+g1ys0MMb9WULZqvnNzuABkcTm+/NGxqiHjvVRRSBI=; b=sIqmDlynf0K3dQLqEwFV9lI6HinqgqTSvtE7ucjWHnXNzUgRA+NVVBvUl3mvs2i+GN QWCNOWvpfsj2ZD4R43RE9yVbblPbAUgDGrpxA+6doVhlV3pl0MX+jUpjVx7GgqN5MZlY H/2BKuxO4WhDnUDtg+nRjHVeT1m4dS2Z8uNP+2BND+QkzZwmSvW+RUOcowmztKOwePnM e1G2b9uVlKZELS3ELOrF6lq49+OzOLSAXFPA3Y2L5iFmDeA19EH/bMRZEpzwbb74i2zL jniG37BPOTwdhtOB9Fpgc4Yqjc0573vsvO5/HkIwn2f5fRNtoLVxZGDQzy17aiwskeSN 9e2A== X-Forwarded-Encrypted: i=1; AJvYcCU/yOH6GYZu9G3+hB6i20g5fXedSaM/QF1C+NboJe1s8FZwYfHlK4dHfGlGVVq2Bon4E4dpyERExyYzVNM=@vger.kernel.org X-Gm-Message-State: AOJu0YyQ4S7vBOHHjQlrK7S93M2ugYSBDClItJtwlXhD0eQGM+YwkAa3 7Lf5JdluY/AhhBUeMotVy3tePanF1s5PGhaLEMysozZLfRpx+H7eh/X+KRmGdJ1RaQQNTQ7C2w9 axZHDB3OFZ34uZutx9Q== X-Google-Smtp-Source: AGHT+IGLaf0ASghwkahJRWS3hPq7oT6ve24L37x4B6OnXmFbgLy02R9Qw5r8wqjyhj+HwGR3CdmVAm9wSPmh24g= X-Received: from wmbgx15.prod.google.com ([2002:a05:600c:858f:b0:46f:b153:bfb7]) (user=sidnayyar job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:c4ab:b0:46e:46c8:edac with SMTP id 5b1f17b1804b1-46fce364066mr11500775e9.11.1760369992506; Mon, 13 Oct 2025 08:39:52 -0700 (PDT) Date: Mon, 13 Oct 2025 15:39:14 +0000 In-Reply-To: <20251013153918.2206045-1-sidnayyar@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251013153918.2206045-1-sidnayyar@google.com> X-Mailer: git-send-email 2.51.0.740.g6adb054d12-goog Message-ID: <20251013153918.2206045-7-sidnayyar@google.com> Subject: [PATCH v2 06/10] module loader: remove references of *_gpl sections From: Siddharth Nayyar To: petr.pavlu@suse.com Cc: arnd@arndb.de, linux-arch@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-modules@vger.kernel.org, mcgrof@kernel.org, nathan@kernel.org, nicolas.schier@linux.dev, samitolvanen@google.com, sidnayyar@google.com, maennich@google.com, gprocida@google.com Content-Transfer-Encoding: quoted-printable 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. Signed-off-by: Siddharth Nayyar Reviewed-by: Petr Pavlu --- include/linux/module.h | 3 --- kernel/module/internal.h | 3 --- kernel/module/main.c | 47 ++++++++++++++++------------------------ 3 files changed, 19 insertions(+), 34 deletions(-) diff --git a/include/linux/module.h b/include/linux/module.h index 9ba6ce433ac3..1a9c41318e22 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -431,9 +431,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 4197af526087..f5f9872dc070 100644 --- a/kernel/module/main.c +++ b/kernel/module/main.c @@ -1464,29 +1464,18 @@ 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; @@ -2601,12 +2590,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); @@ -2816,8 +2808,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.51.0.740.g6adb054d12-goog