From nobody Thu Dec 18 03:22:32 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 D5840316911 for ; Mon, 3 Nov 2025 16:20:04 +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=1762186806; cv=none; b=VoLrYaTKLLFyzTr+ujR0GIa2Am0Xl/QTlWAcgJeuBq0FGNI1eQE0W+8eVSrLq2iynUM1I2mZ6+99HrBU1g6tYm5L0JXKGv3C7ztru0JFqbL8YPLpUBwPOhol8gomFS2d0M/739YdvFTMrMo2Ekxp3NINgYrBrcMOFelaDduIzg8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762186806; c=relaxed/simple; bh=/5wAYAreFX43kAUmx0C0owVCwGfgfUmGJQjEtp5PpmU=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=YDxCYFmrUSlKMGspjpdUplnQH10N0xKeuXsyRGWOPofVRwKKurPpXG+EfRSMgQ16ImpwJmGdUCvhlYNdpubR1OpxX6xo9xj91/yryBjRIteGtNOBq7gqxS6BgmtSBUC/WmniLe/KHQ9iC0tBrZ7tb0lo63j1yfhYWYfE+JWVQJ8= 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=UJu4fRlT; 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="UJu4fRlT" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-47106a388cfso36920025e9.0 for ; Mon, 03 Nov 2025 08:20:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1762186803; x=1762791603; 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=ftIFzkEm1zjsUR3x20qQ2ikS9QsKBzHYJMroz5LF+Dc=; b=UJu4fRlTIAtrZ7NFRQwUJeBxNsfxMBET1Qvx9Ec2jMjSfb3X2AUQHuN0/H2xcOTlem 0J3ixvJSyFWjTrdhHfrL97EyhLoSmR7lHpB5h8ThvVM7Dr0CDYUe5DJot1+I1/bWdb6i /dIgQmXayRmHP5g8xmOiXMS81VJXH2MRS8NU3MPRalTPGIMbdqK1VYkyLzK+ZXAu2aMz D8voxAOBBqZAVdgMJzuU8wNxXNgQ4sEAsW49Tf3EtAheFRYutjyBZuyJkOQfoxY2/9Ur /4w5lVkHEpuM7mzFy7cP6v2J6EM2ss+FjdlwAJb/31yvD7l1q32P2LX8q6y1LOd/z6F6 vPBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762186803; x=1762791603; 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=ftIFzkEm1zjsUR3x20qQ2ikS9QsKBzHYJMroz5LF+Dc=; b=XVDaetm9Ew3k3TsODiB6OcrOWcVuOltWr7l0k2vX4gEVNw+cLqj/qswyONsNGH5bPB BN70xAfa1/nDybfQkg5ppNPsEgqj9AnLduNchiL/EZ5SCDUUXPoF71Gttz2jsm10p12j Xu7cp/JM1h+lsPbgbTHzKtscy0RugZK+/NbCJvogYXkwhnhFyl7urOwe8RjUgX+C5fVd bEtInvdUf4l9/422xiCq7zVuzVG79IczhqOz/jAWS1b7eBbWhSU5S8oflc0BOJlntbGv fde+gns579F64I6kYkrFIphbTwYXVEXEu1slBUeqIQa6dRLsLKNmM4T+gM7yHATwCG/N MUNg== X-Forwarded-Encrypted: i=1; AJvYcCUuiqbsUqknuxnzNPGg8QHXPTfH99HY/q1U/Bz+vEjExMunxuf1vwh5PXVaJcAmr5QTDU7hHsiXBxcf/Qo=@vger.kernel.org X-Gm-Message-State: AOJu0YzXh2qF/9hlq78XCOB9PDXQC5I/13s21f0riE5i+bK/+xnGrg9a oAUP3NKhAVtQh1DavDs1LAkVJ20EeLxRP9mRsd4cW4cT5yzcByc7tkMTTdxuZw82AJmN5a2m/If +1RBPlvcdQfd97ejvxg== X-Google-Smtp-Source: AGHT+IGECLnp+Wa6r4Tdn5YaQ0l1JnV9PG0t+Gh1GDl+yBw8QkV/OxuaBN7aNEBYUrBG8kD7+TwvFiS8NMYrRcQ= X-Received: from wmkn22.prod.google.com ([2002:a7b:c5d6:0:b0:476:9bb8:201b]) (user=sidnayyar job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:524e:b0:475:dd8d:2f52 with SMTP id 5b1f17b1804b1-4773089c6a2mr132957575e9.32.1762186803282; Mon, 03 Nov 2025 08:20:03 -0800 (PST) Date: Mon, 3 Nov 2025 16:19:47 +0000 In-Reply-To: <20251103161954.1351784-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: <20251103161954.1351784-1-sidnayyar@google.com> X-Mailer: git-send-email 2.51.1.930.gacf6e81ea2-goog Message-ID: <20251103161954.1351784-2-sidnayyar@google.com> Subject: [PATCH v3 1/8] define kernel symbol flags From: Siddharth Nayyar To: petr.pavlu@suse.com, corbet@lwn.net 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" Symbol flags is an enumeration used to represent flags as a bitset, for example a flag to tell if a symbols GPL only. Signed-off-by: Siddharth Nayyar Reviewed-by: Petr Pavlu --- 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.51.1.930.gacf6e81ea2-goog From nobody Thu Dec 18 03:22:32 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 1D44B31812C for ; Mon, 3 Nov 2025 16:20:05 +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=1762186808; cv=none; b=NZ17d5lvJYkTIr7fPv8LwRLhJIIqJNmLm+a+CKz1EbcUIzssM3M2MuN2/aqn8KHVFZx7eeVrY9mabOg5+rZLPE8w8oiSOxWbvvztDOVBmb1Sm4Fe2wCgGsKSHkXdA/0RMnelSH0aS+GFe9jm4lDmHUlw6do9jnPpMjEidMN/vEQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762186808; c=relaxed/simple; bh=pkHX++p8KzINn4g+tNG5oYVFuXXq/LyOGK2x2a5Q39w=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=dGAbQLQIF64utnS7cOwzhXmngXSRO6SnbbeXoxWrjU/fjT1QoHldYnhxGqSCqBnCQSEmT+ApK3NIytduHDFJZo++T4Cn3FtEVhyBP4ohyogW6z08BNrsSv4sCR9lmllIuDpHXyrzb8zCW0qQN+081sSKRUduttM9LMj2E7kMeXA= 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=VgxSYz1+; 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="VgxSYz1+" Received: by mail-wr1-f74.google.com with SMTP id ffacd0b85a97d-429cd447398so786138f8f.1 for ; Mon, 03 Nov 2025 08:20:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1762186804; x=1762791604; 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=jKpzC7OwKr3KFY5COtWMHui39YTNk2I7jCnxEbVs+Mg=; b=VgxSYz1+TQ68Qc9k+4Zdm6LZd3LumOrbJybHGNYBI6SkLuy+sI6c0lh2snSdMN1dgf rN1iPIKCkPXrjyHwuBQPnNnYaUg5hsa1wf0Gai+OH4ZxKwXE9LS+TIaFqGmmxIyehvBt 1o9wA5PPPt2HmH+U82DYmrv4CSOHAZl+ir5JhUZglRmRmWjTDGLWsJmZ2LWlQFxXrxC9 6pkl5DYQKXwDkgxeB0dI7/RN58lyq1Iy9N8p5Cz+xvnXeJSiDQvfzRleiMosD6bLQOCU 3jiHOMIiMxKqirQCdnIksZdQFNxD0zpxRk3CGugflFVZYZtZ5bkptE2fIuuByxLlFkNy urng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762186804; x=1762791604; 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=jKpzC7OwKr3KFY5COtWMHui39YTNk2I7jCnxEbVs+Mg=; b=SLcm924uQK4KE5gPPrqYLch9VEeCjy4D8gaqp/VcS5iZI2KZ8MAQ+Vw7QPUuZ+QXyK CxHO3+TL1nDfWY5zpUM1mUrQd3K37sKw+Axvt4i/QsJjqw1+/dpevP8bfpueSSUMUNod 6G936KtcuH/1N3IhW0tUGPnfHih7EmlGd+nVmpYBrjZKtsJnW4Bzpp3NwvuI2Kwdsq7/ bkwt5QClK96VlxXnTpsajuTE+UFJuoyFRQuh6IbrDDqVquLebbaISZLCOisGD08waa5L 1OMqzlnRXtlbzLePGt+i/qXRvrKOuAS7WZSztB7j4R/AJfHJOwL0CKjV97YFaFpKwMeV ZylA== X-Forwarded-Encrypted: i=1; AJvYcCVxuH4Ff6S17sW38Ht16bR9pNZCRaj2l4ovPUXmXn2cslkjuWXtzJqG9KTocA8yrBXR0FJ/iBD7iD2rqvs=@vger.kernel.org X-Gm-Message-State: AOJu0Yxmktqv1AnSD22YlJGEqY/dkCSrfgeZG6BfMgLGX+slmRTOOjXC RedTaRGKpNu0DgptnLgWOlMTva5u+RdvSA4dE1VLECDRqyHOnO8aOME8sONumEEjeFrZspJsxaO fdEH2v775yGWHVHjeLg== X-Google-Smtp-Source: AGHT+IGYgTuLSihsPJ88Spd9dISIsCQuf62e7EG7IJZ70IGjE1Hy68HXjMiE6YNWqCxl9BmEEpOCUF8ubsRZqv0= X-Received: from wrmr5.prod.google.com ([2002:adf:e685:0:b0:3f9:9fbe:f838]) (user=sidnayyar job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6000:2281:b0:429:d2d2:5032 with SMTP id ffacd0b85a97d-429d2d2519emr3619316f8f.3.1762186804331; Mon, 03 Nov 2025 08:20:04 -0800 (PST) Date: Mon, 3 Nov 2025 16:19:48 +0000 In-Reply-To: <20251103161954.1351784-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: <20251103161954.1351784-1-sidnayyar@google.com> X-Mailer: git-send-email 2.51.1.930.gacf6e81ea2-goog Message-ID: <20251103161954.1351784-3-sidnayyar@google.com> Subject: [PATCH v3 2/8] linker: add kflagstab section to vmlinux and modules From: Siddharth Nayyar To: petr.pavlu@suse.com, corbet@lwn.net 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" This section will contain read-only kernel symbol flag values in the form of a 8-bit bitset. Signed-off-by: Siddharth Nayyar Reviewed-by: Petr Pavlu --- 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 ae2d2359b79e..310e2de56211 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -518,6 +518,13 @@ defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPEL= LER_CLANG) __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 ee79c41059f3..9a8a3b6d1569 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.51.1.930.gacf6e81ea2-goog From nobody Thu Dec 18 03:22:32 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 355503191A9 for ; Mon, 3 Nov 2025 16:20:06 +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=1762186809; cv=none; b=V1l6nrgoWzmWLZbj7/RT1e6Dk21UXeDGDNOsHAEay1SfgS18LmEYWXOSsuPrQ0VZf9KOLiOYKK95MeHiPEGfoCIXMsxixNz/MCLf6I9ZBiYTvSykJRgsQQ0uJlMcO3nZXCXA7QocX3zuLTX7l5M4iGkwtqhReDc9a3TWnbtrBH8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762186809; c=relaxed/simple; bh=jkxdHhADxKe70tQ3LxdaaXA6uDsYEFMedCjDeqV0A7Q=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=uZ7yBxNyX1G05olIHbH713DhniN8p7MKsS6qMtg1cAyohnjX7tmRP2TH/rsnooTXOwfEFGcNsVkBwLUqyH11s/gVfPri/JGGlCPjFgWB0Z1xKWlczp2D35lmP7VABA5tjBb0s8dfD2oD3O9SREeyuw5T7D8kaIKQqPQ7oDGkm6A= 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=nPTqGnTE; 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="nPTqGnTE" Received: by mail-wr1-f74.google.com with SMTP id ffacd0b85a97d-429bd66fe65so2195643f8f.0 for ; Mon, 03 Nov 2025 08:20:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1762186805; x=1762791605; 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=P4w/p5iGh/i/9IMayogTX0N6/mX9464BshDveJOwZLI=; b=nPTqGnTEQPqLxXB27cBYYHHxBxD7ns+aEvyVWs41PZB1OJqnaCIqjxYPpP0jjUsVUo hVRQnpTXZ3GPYtI5wu0cmwJdeg7bjL5hzOd1elANbgxM94h9yWT06iwBPYHZQG+sWZld BQUafx7TaAnsTRhi7GYevL7EfytwFlt1kEZaoVAL3SJQNH5bBkDBv4wOXPz02mJCJfEE 72ZrnXrqV3tifKXt0jyUH+keOf6GVE5gJiKl7lmulyLCIO0DIa2NvxYH3z+hGuIi8Fe+ Ud7hhePYGKvCK/7r+pPsDxppcTQ+lNurzmnj2pSU9J7ZMcqCwqe05SHvlymSwOpVnC1v zG5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762186805; x=1762791605; 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=P4w/p5iGh/i/9IMayogTX0N6/mX9464BshDveJOwZLI=; b=HcTQt84JJ3pHwUvfXrAMJmh3up/FkbCAeA2U3c67cMpQbFHjVBJFpn7J8S+/xXHXwG 5yAzpuHJzPhPzS6A99wox/avG1YWV5/VP5Zh+UTQykY7fm24ZRGNd+Y7turnMQF/EmHG q73+Qa6846qBtnOD69ARDrAwn+HzBcAvUJqB1EP5bxcsboLXQ+R8/iVfQG2ffbNsg0mi Xk5Xv0bQBYOZD/5Rpi2EO9xCcOt5E8oSf4pATEWo8QxYAB19qqXLLuYHXs75KWKMpawS MD8G9p60ttrA/1cRMb4RQnwBtN9H1YVrwOvZ4OaQTqjivSNPFB7jDTy0LHlmSdhrtmiS OIwA== X-Forwarded-Encrypted: i=1; AJvYcCXdxdXjwirnoZRnnJZRfiz3F58PIc8qbI5X0c6DqOCmYbbZZ/D9hj9JnK0vVRANF0TCZdCA13yAGAVjHFY=@vger.kernel.org X-Gm-Message-State: AOJu0YyMPGLDHKl2vZF6oxBY4JWvHtrVPIuTLKE85FzuLJ4VunEvrtBM 0V/4zKGrkRQUHnvj7w7yVx+sRiIcjxI64VybnFet0E2P/qpKVe2Lra8mf7wcye0ViKGICrcKVJc ELL2LqvsJIpiFs3wraw== X-Google-Smtp-Source: AGHT+IFf+tT8KEZ4bOrXCsQXmpdi3VAAa0VDdDuJqsBmNk6vQmoBDyCE42yQpSuuN+bhZNXSvklX9SUFaH5ZyqI= X-Received: from wmbjd5.prod.google.com ([2002:a05:600c:68c5:b0:475:de3d:2cc9]) (user=sidnayyar job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6000:26ce:b0:426:d5ac:8660 with SMTP id ffacd0b85a97d-429bd6e3dbamr12562628f8f.58.1762186805589; Mon, 03 Nov 2025 08:20:05 -0800 (PST) Date: Mon, 3 Nov 2025 16:19:49 +0000 In-Reply-To: <20251103161954.1351784-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: <20251103161954.1351784-1-sidnayyar@google.com> X-Mailer: git-send-email 2.51.1.930.gacf6e81ea2-goog Message-ID: <20251103161954.1351784-4-sidnayyar@google.com> Subject: [PATCH v3 3/8] modpost: create entries for kflagstab From: Siddharth Nayyar To: petr.pavlu@suse.com, corbet@lwn.net 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" Signed-off-by: Siddharth Nayyar Reviewed-by: Petr Pavlu --- 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 5ca7c268294e..f5ce7aeed52d 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) { @@ -1865,6 +1870,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.51.1.930.gacf6e81ea2-goog From nobody Thu Dec 18 03:22:32 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 25B6B3191D3 for ; Mon, 3 Nov 2025 16:20:08 +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=1762186811; cv=none; b=nPpMYdkODcgx3liQ+vaqWhC+Frd9cAYW1+QP/I4JoCAocZdinJbEkJyd/8fjIjSSqe0Rv1k7uqdbF5/c9VKQ1ChbD7gAHUAaX1I/3fEkI8YFpClXnDiRG1N5Aj+Z57//5w9lrnRHY0oG2p4wEZrYeS2S9UyALCexMV/VdafzXxE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762186811; c=relaxed/simple; bh=tuyLXUvi/ESqwW2v6QjC+olXsEHZK/Kv3IdYAAA8beM=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Rl7X5sajhNKZ4PwEMw2uFUiCcEd1BxW7O7stb7dmp7v6Bz/FRRLTkYS6bC5saDFmKPjCboNBSy9gUtyPyTldQRmGRmKeW0VDnSUDMUliEFbU820jvOvLnd8UvaXmf2bWxEX9LPslRtmXgllVDrHEwZytOpOxVpulaPmN5KJgGS0= 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=RVmVEh0L; 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="RVmVEh0L" Received: by mail-wr1-f74.google.com with SMTP id ffacd0b85a97d-429c5c8ae3bso1950746f8f.0 for ; Mon, 03 Nov 2025 08:20:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1762186806; x=1762791606; 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=6+VzLCYAN+u3C81ZeCic6e0B5W6UCDTRzeShogr9CFM=; b=RVmVEh0LByx8eUVYFmsZLGJ3IFZZf5bQUYcdmr1Bwf/mlp7+Zkzrv1gTT/3WJdEocq 6h/uCbp7EvTatnQCw5LU+KTO42vlJPY/qeba7nZVmwhQImN4Sj7js/6soiraBuSQRJxJ 2xKSQ5yT2l2nFuVPBGU4Z7Hx73S4tM/f+RCJJ7Ukk5tj/pOzN5WcA/y2CSWvRtfovJIE RiXgpyb2Qg3Z0ZuGCeUJl4KUs/SxWsS99zWpVVvYk99u4pGnGIXpS3y2tk6uK3/XYMW0 3E7K3zLweCq4QBmy0rrFz21akcPmj9utMTJkVAbPo31kvqqVorOFNhaSyYYz/0C//T7T 4qSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762186806; x=1762791606; 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=6+VzLCYAN+u3C81ZeCic6e0B5W6UCDTRzeShogr9CFM=; b=c5/KmNTdx6cFBWpHuiAR9oghUmQtzoEk3ItN0HHEmmfEhizjQHi15nrWFAdbLiol91 pl2MsVy/rohwZTElqjaEl2LVQ428jIj7cwPqrEfz2u6fqRNDgecFqr9s7zG3gCuKV5ij PYuAU1h6EaVjd74aKsi0wNHKM0kOmDzOYxHAhKS96uGyLSLHL1tF1e4IlxVvs67LJaPI 60zhkkhEMe4MzFyrafpd1zIOdT4MjchFx7gZMomjSBhyzaxVC/T1iaWsypA6rlHFqwuc szHd2Lu+VW44Fbms6+qokj6IYLB4GdqReTlaqUHYUq/gnXfJBw9FU98f9RZy5fCPdI3c +AKA== X-Forwarded-Encrypted: i=1; AJvYcCWl7AVWFLKCB2LTbJDkJ6BHCuh5VeX8LZDWjL93p7artxyDapWio0Bt9FO1ZYjXJgqM2RtE0XNz/LuWxgw=@vger.kernel.org X-Gm-Message-State: AOJu0YxnmKxBkC6gZutLVujafiHgOGnyTlAOgowMkpJds3eYGM1ETerj Ny/vTo2V1VALwJU8swvnrFQwWVKliZUCN9zGBKUF1GKTytqF5G4+42E5tU40ucN1MnDVQu3hEl6 1apg2Pl3W8IgMCPbezg== X-Google-Smtp-Source: AGHT+IHsA0v7E+SnXH75SrlLLdZznHgP2mGDuTma0AhnTccBK/k4OR/i3RdgETyahE/jGzsOOaCC+90khENn44c= X-Received: from wmbjt1.prod.google.com ([2002:a05:600c:5681:b0:477:1186:dfaf]) (user=sidnayyar job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6000:22c7:b0:429:d79f:c86b with SMTP id ffacd0b85a97d-429d79fcb0cmr2277909f8f.58.1762186806407; Mon, 03 Nov 2025 08:20:06 -0800 (PST) Date: Mon, 3 Nov 2025 16:19:50 +0000 In-Reply-To: <20251103161954.1351784-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: <20251103161954.1351784-1-sidnayyar@google.com> X-Mailer: git-send-email 2.51.1.930.gacf6e81ea2-goog Message-ID: <20251103161954.1351784-5-sidnayyar@google.com> Subject: [PATCH v3 4/8] module loader: use kflagstab instead of *_gpl sections From: Siddharth Nayyar To: petr.pavlu@suse.com, corbet@lwn.net 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" Read __kflagstab section for vmlinux and modules to determine whether kernel symbols are GPL only. Signed-off-by: Siddharth Nayyar Reviewed-by: Petr Pavlu --- 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 3319a5269d28..9ba6ce433ac3 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -415,6 +415,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 c66b26184936..4197af526087 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); @@ -2607,6 +2605,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", @@ -2810,8 +2809,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)) { @@ -3427,7 +3430,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.51.1.930.gacf6e81ea2-goog From nobody Thu Dec 18 03:22:32 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 34BF93164B4 for ; Mon, 3 Nov 2025 16:20:08 +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=1762186811; cv=none; b=MbIfE/ddhtTFtwu3f2Dd+a9qzi5D3e2zxV+q3wnAJLxpTXDjYH9TdGq4nG2a0+ng71Vma30CEYwJEo4loB657FjzxE0Hhg193jkfFPdEkSQpGFXmeBDhINEm8BEcSTdSOZqxPcapgNXg3RCEp+DjCUuKUKjQ6b7VaCXnGcHFuBA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762186811; c=relaxed/simple; bh=9Cwz4yVXI1l3qeHRLhyx4TZ/Ev1Njh9gQAluw4KuMPo=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=dhvAnqEW2UJhkTnorBpg78hHpM14sEJtcWg3qMScTSY+feHi+nbwKJqGy8QYFvysmbszcMQka1u63cD86Rn7tf/sW3wOQNJ9XLSk6z9vngR72PGMM/MvXR9XJ4IXlulJVwcThTLrtV8mxjE/kBYog/pPQeUGWfxALGSTOBxeBho= 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=4cxwHzI0; 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="4cxwHzI0" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-475de0566adso34915305e9.0 for ; Mon, 03 Nov 2025 08:20:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1762186807; x=1762791607; 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=I3NEOOYIbpeR+4we18GdYqD7b1OledoGg+btJU35ZGk=; b=4cxwHzI0AQ7iZu5m355hJAxmp43DNe8NLTTPMxhU66Jvx5j63K3bc/HwCkxT0latvQ EKQWh6CYyJKgX6ubDo/JA/Yw+NSB3c+H+YRb4Gz95zmUKM2LCgYYEMOCZS+0nz7zXoJI ScBdlLG3xmJzAyHc5musgPZgb/XeVPTHtydcbOMX+/vFohLDx+npb8oY8V9Y7wYaNd9W s6vEWqIBslb1LKqJnCBWOJ6bdyhCduby0FITfZFGNWN6Bgi4E0pONa2zgySBUMBfaDtQ xiXRLjp16Kyc+R2f2IgiuNuKzgUkRwU0pKNUJpAmGzV5e40qIr+SYhgPKs3x3tFiQwAm SXFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762186807; x=1762791607; 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=I3NEOOYIbpeR+4we18GdYqD7b1OledoGg+btJU35ZGk=; b=oEYFclXhrs9FBU0e7djAZRXcSJPNW9n+u4kOSZsG9RZo+mEMa3tzxJluFyXqdE61lA T3jw2F+ll0R2naQy4yulozQ4ty3HhJMClU4DjZ6gZsS0abQItE76KSxL0TDnJmTeIvNC awMIp99vtpkRpe278NRC7XJdqjqKvTUWiJiVBCKCismYcD+0OOIcxt4x3Uic2EcoQg8u bkrWiKOqxdRhr5625nil1EI0X4n7qHptOQndyr23G5SD3rCyEXX5kEgVgiiRanV6lA0M 3+aUEvNqAy9pprvEsn2yCg4RGO+SUxiWmxowcENIRqrGPPQSATuMA9O+XBHDV/MV2D0I gJVA== X-Forwarded-Encrypted: i=1; AJvYcCWmbLpqEg8C2ruQ/v55JWa+fzkGWrbaGJjJVfZ7HSGFR/gfouJmneKxDz87YLBP0zbppvN3/f2hnzHt+3s=@vger.kernel.org X-Gm-Message-State: AOJu0YwZfDjRz8VL9Z1SVulufmyUnjB0B0hy5xd58HaicLc4rlwQoLNS bj9YZ/KGeFQIJQTeGZUuGTZBnl5X9RwmGLpL3f+iKK5YEsUPqcXf1NNaFCanurbxYoHfCycJEKF l885Rr/ViegyvWRWx5w== X-Google-Smtp-Source: AGHT+IGWADIxrNkiKWiAtHE2F2qUzfmmzbjTu7H/WDRRQcPsxtPCSsOpwinifQgqwk4x+PMn602oe0eH71+Kf3k= X-Received: from wmco23.prod.google.com ([2002:a05:600c:a317:b0:477:40c1:3e61]) (user=sidnayyar job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:6995:b0:471:15c1:45b9 with SMTP id 5b1f17b1804b1-477308b0606mr131316165e9.29.1762186807379; Mon, 03 Nov 2025 08:20:07 -0800 (PST) Date: Mon, 3 Nov 2025 16:19:51 +0000 In-Reply-To: <20251103161954.1351784-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: <20251103161954.1351784-1-sidnayyar@google.com> X-Mailer: git-send-email 2.51.1.930.gacf6e81ea2-goog Message-ID: <20251103161954.1351784-6-sidnayyar@google.com> Subject: [PATCH v3 5/8] modpost: put all exported symbols in ksymtab section From: Siddharth Nayyar To: petr.pavlu@suse.com, corbet@lwn.net 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" Since the modules loader determines whether an exported symbol is GPL only from the kflagstab section data, 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 Reviewed-by: Petr Pavlu --- 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 f5ce7aeed52d..8936db84779b 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -1867,9 +1867,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)); @@ -1890,8 +1890,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.51.1.930.gacf6e81ea2-goog From nobody Thu Dec 18 03:22:32 2025 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 B15BB31985B for ; Mon, 3 Nov 2025 16:20:09 +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=1762186812; cv=none; b=UTMX5OCc3aEvDb9R7Dw8qNsOg47xfVJ2b2khZ31PDoZYJfgFwm1cv11v0KkZU8JvFYwycHEg8/S6v4S+uSsY5OiGwrtneV1ZYyh2Pqzz/x17FHXMqGG4hB0R3J5ZdB1fZdakkV4KKiSj3V63QMmYdSPGlVPA0qUIOWdN/Sq45E8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762186812; c=relaxed/simple; bh=QGAi+ONyMbMm0xeVQDTKnmccX0ZHWeVKKtypFmAuEsA=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=qkbriHD+2J85dfp82uB7n2FQG8O88i/kSRaCTZJjUSjbikU0IMIa3CoqMagX8MbG03sjzfI1Lxtr2yPIJcizWX/17+4CxOrp8tr3IQZS/o8RMi49pEjmECTVlJs2HikVOUeK4WWEsNofgjA7RIMNJUMt5GsfhUj8LmL8mHpbjZk= 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=niHXI75D; 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="niHXI75D" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-477113a50fcso33845175e9.1 for ; Mon, 03 Nov 2025 08:20:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1762186808; x=1762791608; 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=NeBc1PqOxKqd9rI2R/vzteBDEeuRiti7tKcE1sQ8cJ8=; b=niHXI75DTv99udGcKgEAAl0bIpB+eCQ6iTsos5QOF3RNmmMZ9vSmY2veHmWdXiygkm D7YAmU2TmgvbTWQrt7HmvxMaO5PeszN0/FJRm0LEfbZWXfxCFYrMJezTAkObezTCYQOC H9d7pt6/5l9Iv+7Nsj2dIwVW5nOBybEceHvBju500Kpdd7ilBU9uC/SxngdE0P8IMpfV dKlGbElsDzWZQp4gDsEAiScRpnFtq5zj6KSvFNTZUuytvmJrdh14lpiD2D4rXECLJvyF Li4ddkuVZl5trHRS5EWyqRUeqKPj0BV4CaftmdLliubcENXouNSV7Hd8xv7Q44ALIQ96 iLgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762186808; x=1762791608; 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=NeBc1PqOxKqd9rI2R/vzteBDEeuRiti7tKcE1sQ8cJ8=; b=ktB0nFG+7akTt9J8oBtUF5Qq88G+LeDCVN/7f6laI2JVhwEXdTsu4AXqp5SgiwEt1I xDT+ff/BPK5X5NIv0KRoSD8gI4c7M9FVfjLbfONdSUDs+TXlFt2/c5QLIv1H71s2eNNH 31AkjnjOdHcGGYCMyVagIZHYlEs+f3sQAkp5hAhU7gsG8VHtHHLCNDMvEGsDoCw3DdfM h9jfB72FMVmsmfpdh5j3EHTvuLfHcphiv0KniRnv0ntgHMrQAStyOG9C8dkhpaPQeMcq PEJoS9iRo6gqj88R3qyj7bMdHX16LVPbe7jTRrqyGuCGuqojrQFs1FXi0dXCVEDpMXuy 9eXg== X-Forwarded-Encrypted: i=1; AJvYcCXM5Cie7XmIFKkUXuORfePhP34vNGpN5pAeaN1vxdY7ZbTzN5Mge+f+MnJMhHp7f2hjoRXFPDGxOKcnfBY=@vger.kernel.org X-Gm-Message-State: AOJu0YxxEXZN2tMgggsIW/mMPoQjXFfU5jjelU5W2vkBEfI03USoso5W /U+aBG2pU1Wo51XlUnp0HkXddiRfKvJVH95HTPpsgtD8etQ+aZtEUrA8jags//wz0Nu6B50Umz8 jF3AXY4t+6L0UTEbz9Q== X-Google-Smtp-Source: AGHT+IGeGN1Hp41Ud0+9yWo+cHpbvWWoB9BA2YL+XnuANZQqI/3R4uVwNj2QKUQsp0r9uk24ApiOFtFuDXR98YE= X-Received: from wma5.prod.google.com ([2002:a05:600c:8905:b0:477:31ea:6473]) (user=sidnayyar job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:3e17:b0:46e:4b79:551 with SMTP id 5b1f17b1804b1-477308aec8amr143460475e9.31.1762186808290; Mon, 03 Nov 2025 08:20:08 -0800 (PST) Date: Mon, 3 Nov 2025 16:19:52 +0000 In-Reply-To: <20251103161954.1351784-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: <20251103161954.1351784-1-sidnayyar@google.com> X-Mailer: git-send-email 2.51.1.930.gacf6e81ea2-goog Message-ID: <20251103161954.1351784-7-sidnayyar@google.com> Subject: [PATCH v3 6/8] module loader: remove references of *_gpl sections From: Siddharth Nayyar To: petr.pavlu@suse.com, corbet@lwn.net 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.1.930.gacf6e81ea2-goog From nobody Thu Dec 18 03:22:32 2025 Received: from mail-wr1-f73.google.com (mail-wr1-f73.google.com [209.85.221.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 5F47C3191D9 for ; Mon, 3 Nov 2025 16:20:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762186813; cv=none; b=eZbQ5W00ECgNOZys6oGQeh6JnXBfTOrNhqc9xD09tPlWFJEbocDAmGsqCzbc0yeWOU9BeA4a3o5qVZWUl5n9E8t7F777fi6jsnXSgPr1SKaZ1J/MGvzNSSQJiwKC/74EZt2FpB0SApjW3DEUjarkUPRiZAi1As5m7nvTAqdkQy4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762186813; c=relaxed/simple; bh=90zgfRi03LUPC/zqKQIwgs11pM+miVnc5O/8fUC1p4o=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=IyPMlEp4+Lx12kfmnInZXr/9CU+DpS3KVKwkHzjeZiVMhSn29TjIogxijZSt2FjqOzcVVgR3Ewe1R/ZM8V2SVZDVZv8hAeQNLsnNj57A3lJiUe8rqe10t4lR8TyyvLyY0Nhb1bgnCndTDpCc7bU0zz14vja82xlzK0QXpveW3v0= 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=OEd2Vqwy; arc=none smtp.client-ip=209.85.221.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="OEd2Vqwy" Received: by mail-wr1-f73.google.com with SMTP id ffacd0b85a97d-42814749a6fso3496320f8f.2 for ; Mon, 03 Nov 2025 08:20:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1762186809; x=1762791609; 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=olCu7FTS9PcLYXD/iow1F/tBLcCLSX9gN8Zi1GrdvXs=; b=OEd2VqwyKjLVxi3c+TEVNkTSh9+vhMjXybRGbzI7I0glzxpfS8SBRHnBSi6Xa6U91+ /qPNXCXg/F90N5a8KV+mn5fCvuHy1Tm3PsBVKyF2LfYza575371qrIOewx4cYpvzZdX9 uvBlm3xC6KJmLgYIqv1kOp7c0NOH4Rp7vt1NrLyATC8jwYzDZUiwYWgpOCw8VxQxydXp miykrXrrqbqENIdKi5HVPNbhJews4HqvlQjTOOLG0te+VfcbuokYaozF6F0Q85UOQLmg RCnsTFkrFS3HVWLU+NAV66M0qqX+tqWMfq2mFAYfhRjvBj8EikKCYVULGRH4UtOa0mYi UeDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762186809; x=1762791609; 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=olCu7FTS9PcLYXD/iow1F/tBLcCLSX9gN8Zi1GrdvXs=; b=lBVKTv+cnj5F0W4QjARbQN/5f1Y16dR71wTSGjDNMXVMpTCtXljDP1scB0mI379AHl GTiShRtqYFi5CRvSVasr/GN5v59YqY6wop36lHGHfZpb6J14DfKA2XDO2YeOR3Z6B7+r mMuwf3kjDbk04b/0F+idkJHYN/mioPLvmI68g6FZyZggl9Un0DDMMHp3LlKapJI6Yv9r B2Ki96D88rE7l7drVguNzkI21gR33omEudlGXVOUvp4WIjzFSeEbb9r+7JjubCK38ZzK ihy7OIImaodwQ+XPd1x2G3vhJqDFg29C/rwO8tZGjVfgH+dTLsC1jxK7k915cLRqbTe3 PPpg== X-Forwarded-Encrypted: i=1; AJvYcCVJqq5UeTBkyscGkvjLGrXpcSe+wm4CPARzCVU2sYbgXjb7afvO4jUfOaG2xqBXVWNwld3eNKFUa43mDWg=@vger.kernel.org X-Gm-Message-State: AOJu0YwAbfmJPe5uH+TjOLMNQI2INrOYvk+6Ca9bEKdNPBXSLGKXr4W1 YNJkcS0q0WfA92Y2l9ucwxWb+7hWKmIF3+5R0aujVqgNcI/OEZv34pf7/rbiRk4VgRjs5Rja3Uf smHRHmFw0a1CSs3E/rA== X-Google-Smtp-Source: AGHT+IE9IPcvmbIvQwAMqkVKiUmE8DZiY829fkrxxcHOeyR7WshNvHPAvPnZKpl9Eu6FnQkKKw9nU3nVrpj/Nr0= X-Received: from wmcu9.prod.google.com ([2002:a7b:c049:0:b0:477:f0c:b354]) (user=sidnayyar job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6000:25c2:b0:429:b751:7916 with SMTP id ffacd0b85a97d-429bd6ad961mr11484402f8f.45.1762186809292; Mon, 03 Nov 2025 08:20:09 -0800 (PST) Date: Mon, 3 Nov 2025 16:19:53 +0000 In-Reply-To: <20251103161954.1351784-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: <20251103161954.1351784-1-sidnayyar@google.com> X-Mailer: git-send-email 2.51.1.930.gacf6e81ea2-goog Message-ID: <20251103161954.1351784-8-sidnayyar@google.com> Subject: [PATCH v3 7/8] linker: remove *_gpl sections from vmlinux and modules From: Siddharth Nayyar To: petr.pavlu@suse.com, corbet@lwn.net 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" These sections are not used anymore and can be removed from vmlinux and modules. Signed-off-by: Siddharth Nayyar Reviewed-by: Petr Pavlu --- 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 310e2de56211..6490b93d23b1 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -490,34 +490,20 @@ defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPE= LLER_CLANG) \ 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 9a8a3b6d1569..1841a43d8771 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.51.1.930.gacf6e81ea2-goog From nobody Thu Dec 18 03:22:32 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 44E4531AF3D for ; Mon, 3 Nov 2025 16:20:12 +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=1762186814; cv=none; b=Z3g+vPZohe5xRvsH2O1jUatboHrJFXu395Bg/yNxMOK8PNDAHUQ/Y3YPsoH5UxsXHsvKbBp3PjOeAu1DxyKX+tcvXWM4isGUqvO7pGCE5EFlaurJRSfyuOhd++kHsQPZM3Ba8/glJxxq4vbtwQYVzgtqoA+19tVA0tB97dHiaSg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762186814; c=relaxed/simple; bh=ZfLqA4q+LlT4KDHK6OgFCUnnDeCp0/yqCM3z3y4ZAUE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=o0x4fgMXnhVv86Y04wICwNz96fuZam71hP3wBvMz1pxpREQktBQazTT3o1Tzu3BP4NEbf64t3IrxbybGS7udHGuC7X3smKkyOlzNet2M302G1+ouGFBxqnz7MSSnALdjnC321xPBbSSxwj/B20nGVSc4x4NtoPnbhSzVNNwxBf4= 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=n1XsnXQA; 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="n1XsnXQA" Received: by mail-wr1-f74.google.com with SMTP id ffacd0b85a97d-429ca3e7245so1259034f8f.3 for ; Mon, 03 Nov 2025 08:20:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1762186810; x=1762791610; 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=dKMXNiGZfPIVH217MRjliLXTvp1YDgJjekxykL3Rm90=; b=n1XsnXQAt2p3nRKaN4HTnKPHWC569qA8uToA2McZM3UKZJU0HLJHpL+s8xp2ORO7CA tNfjzzjpxaTzkE50+HaZGP3+3uaMq9zijiAoSatK1Mm9sygV0nPCfq7e3/8M2EKMGB/A FaOg1dCWLFxG8+gOu5kWjq0mbTKmPWBp9SKiqMTpAzGy7TKK4adXM2MyeRH5bYo1xynV JxxQxMYvQ8n0KcHogckZHciVzIpkyLnj/n+74NuRjuGivON1k1qA2La6kfBPsGXnvAXG olqjcjyUSwRJCRswG0Wsbwj9E3lYkCS6bbAhzttyMWQ13INhBTiFPSFfU9GJTlhmZjaE RYvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762186810; x=1762791610; 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=dKMXNiGZfPIVH217MRjliLXTvp1YDgJjekxykL3Rm90=; b=LGSLA4HASv7s6sv12HjbzA2l0s9APUvQA1K7z0YgPJMMlPhtihJTc6OOgjrkIx8yRp +74BMsSGQImKcdpGt/GUJDo92/8/iOS6h9FKOQiqPTAliVijWmXcRyCFeO93MmSHuFaO Sqqw7RfQMic6S8+g2WzMb18vf4TgFI+A9pcMhApRVRaiQ8Vp9+FWz6ZcfFkj6i23H0kK F0wkMcxTlzoYSgfJzlf4MafjlioSEDfnznNKW7EzP58OcNY3A4YjpP7HHzGaaOVLHDFd KiBPCgGDQTv0JGLpZnTd2eMdDHVYbNAZH9qVWanE8YNc0znSQaB4QFXj2fRBReG9BGTr ir3g== X-Forwarded-Encrypted: i=1; AJvYcCU9lxroZkp8BkayBNWhTvGX5nnT+naY8Ij9OjZoZ0QdEzXWRObJi9usyrVdQ2DB4yif5DOctGdTeDz2Um8=@vger.kernel.org X-Gm-Message-State: AOJu0YxOGfoeL5wXG1BX6oIsdSOGFSZA+XNOMj46Rhuil4pqN6NkpwBn m3ZkpAAwlRKTQt9GXFSh2KY438CDP5k/GKW0/6mewPyLhEo+RO5VJASkWWVssFQA8HhLTtHnbn/ C7jvvN4ODozV4+GF6ew== X-Google-Smtp-Source: AGHT+IFC8uEzBjpjBcVhKIzQAVZ9PgWEyRrTcxIH5OA39bpirlxZf+DPWIWJ65wuyC7UfWssuMtt201eUDa8ubY= X-Received: from wmna17.prod.google.com ([2002:a05:600c:691:b0:477:11b7:17fc]) (user=sidnayyar job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6000:2888:b0:3ff:d5c5:6b0d with SMTP id ffacd0b85a97d-429bd6723c1mr10520562f8f.4.1762186810296; Mon, 03 Nov 2025 08:20:10 -0800 (PST) Date: Mon, 3 Nov 2025 16:19:54 +0000 In-Reply-To: <20251103161954.1351784-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: <20251103161954.1351784-1-sidnayyar@google.com> X-Mailer: git-send-email 2.51.1.930.gacf6e81ea2-goog Message-ID: <20251103161954.1351784-9-sidnayyar@google.com> Subject: [PATCH v3 8/8] remove references to *_gpl sections in documentation From: Siddharth Nayyar To: petr.pavlu@suse.com, corbet@lwn.net 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" Signed-off-by: Siddharth Nayyar Reviewed-by: Petr Pavlu --- 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.51.1.930.gacf6e81ea2-goog