From nobody Fri Oct 3 15:33:21 2025 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 DA58D313524 for ; Fri, 29 Aug 2025 10:54:36 +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=1756464881; cv=none; b=qfmu7VWPV4eCdHm6nOSkpcJy1Qm2YxFqRecsBI575LQ4zdXMYDAT+2uvKFoIfOCBaTA6q46N6zar06/vjXoWKo3B2PUn7KS1Uxeu9/x4T7Ewg8EST8d432OuZU0aVfonMvRr6eGP3k0uoSMMjZ7nolEUkEOdDNa6FWAWhVcK1vM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756464881; c=relaxed/simple; bh=yF9Nwmba/jevaBt9hbUSzr8VO0GmzyMKV6WaC+bYVkE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=QLu/P+Ri2kzrcaTaCuPO06jnf4tRjOrzxa1ezXZI3i29yHVmHoS8ShImyviUXU29eWknyNI7KmUDiEe8jAC2p/ye6fMKD/IF4MP7NBDAzAjI0pgoF/HCr6+lShWeoqVTCm8xS1SrMnE/hGvpJgr5C4p30Zhfa9BHigLKLPzFFLk= 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=1HL9SLyC; 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="1HL9SLyC" Received: by mail-wr1-f74.google.com with SMTP id ffacd0b85a97d-3cef6debe96so587186f8f.1 for ; Fri, 29 Aug 2025 03:54:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1756464875; x=1757069675; 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=tl5xVMQDO9rOC+YVNnG9Us77dRWtm4Hbzqq49mGE7X4=; b=1HL9SLyCWtP72z5Frih2DAXSDv2wkd6m/xBbjdqovr6f6NfpVtl2xqyE6rRatrG1Bd wiStsWJ3B6Bd47iz2uAG/W59jWupTtjCRwznH3inMY27Gq9mlAOHVb70vEuppvhkuH6E gK9+4H9/iwOjBzd9HwBzB8+7EkeGBKl0Cj4BkjsaeB1mztPa0ABMAxs28TqF+DXqYb/N z07eHi2BG7ffHGahF7MGkskNPlLlUrGdsaR4yjUkDvkeWR7stT9zrK0vSVC+TW/TnbQN psrQCvQJlxl935z0oidoXB8InHVwOCuixlUU5+YZBrgUuUO4X17Usa2BfShPASXTduQD LFXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756464875; x=1757069675; 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=tl5xVMQDO9rOC+YVNnG9Us77dRWtm4Hbzqq49mGE7X4=; b=iuGB5/VK+fzE2v7r5lWytuX394JlDszyfVnV8iE7mEthKRn0Lates7E7BMJe0brhyl L5E2fwS+bzCAoO+CpJDLKxCidcGYQcTmL/RaxDzeQr5vdhOSfQnHM9odGferODZWdn9V jskwnd6Zm98wqzkHEHI4MRORqsYABx7+SoRE7VKi5DXO7bvxkky/NPwvfs/USSy1ym92 pfe/l3Hk/Z7TP+6IgMcgjX9ku6xDzhU7oJYWVgKCekUE2edPKk6TezVUUOr5Av9ZR7vu icdzinuL+OHdfSJSngp9L7VE95srgBlYZQleZ5urdEK3pgZD62LLRj5V9uK8BBFqAPZB D3lg== X-Forwarded-Encrypted: i=1; AJvYcCV68xrP+jXL5i0yyaQHEs9nZR+hFHuu89kjsqoSN+b62mdENY8Ddn+lZtBsgyaWtpWdg9BGK5gusE+pQ44=@vger.kernel.org X-Gm-Message-State: AOJu0YwMAqhAlmq78dEnFUIIlu5KEZBWWdNdIikSqa8axS53J2567exf SR4iHIQF6PjwmPdlj6nL1MBPrXrnFu+dVLnGvIHqU2vhcVwEXehslfiiLUL8bbyHeNBQx5WRScu MjOgPjVbX2yDReqv9Ug== X-Google-Smtp-Source: AGHT+IHBrOSPoi0y2RsxzWW1F4le7Bf1Bk/4RMIS0LXXWN2TETItYHW5HWXVVsxZ+L4PXPSHZLojUsL4tRay638= X-Received: from wmpz22.prod.google.com ([2002:a05:600c:a16:b0:45b:520a:6656]) (user=sidnayyar job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6000:2582:b0:3cf:a44b:26fd with SMTP id ffacd0b85a97d-3cfa44b2b45mr1213005f8f.8.1756464875293; Fri, 29 Aug 2025 03:54:35 -0700 (PDT) Date: Fri, 29 Aug 2025 10:54:14 +0000 In-Reply-To: <20250829105418.3053274-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: <20250829105418.3053274-1-sidnayyar@google.com> X-Mailer: git-send-email 2.51.0.338.gd7d06c2dae-goog Message-ID: <20250829105418.3053274-7-sidnayyar@google.com> Subject: [PATCH 06/10] module loader: remove references of *_gpl sections From: Siddharth Nayyar To: Nathan Chancellor , Luis Chamberlain , Sami Tolvanen Cc: Nicolas Schier , Petr Pavlu , Arnd Bergmann , linux-kbuild@vger.kernel.org, linux-arch@vger.kernel.org, linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org, Siddharth Nayyar 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 --- include/linux/module.h | 3 --- kernel/module/internal.h | 3 --- kernel/module/main.c | 40 ++++++++++++---------------------------- 3 files changed, 12 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 400d59a7f44b..4437c2a451ea 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,10 +2590,6 @@ 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 #ifdef CONFIG_CONSTRUCTORS @@ -2812,8 +2797,7 @@ static int move_module(struct module *mod, struct loa= d_info *info) static int check_export_symbol_versions(struct module *mod) { #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.338.gd7d06c2dae-goog