From nobody Wed Feb 11 02:25:36 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B190A2BDC32; Wed, 8 Oct 2025 03:59:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759895978; cv=none; b=C73nF5IOGrGZ/kZxMPAvqcds+JQzLzYN+wa71x/nRWUhhYLH5eWDHYY+hl36cZnCs9QFCveCzat7PJx2n0OmLkPR0Gp1yL69CMN2vnaMUHCcaoLHKwDtQoHZLrNrONB8bHDTSF3OY+SAhc3QO8P7wtTn7YV8wxDR3KUO6evXRYY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759895978; c=relaxed/simple; bh=qNjT1AkMsrlGTHoFdpErJ22ljElcPV3fTuggOttYr3o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NfU3B0yDThwtrZqcetANiynzcr0nwvu1BI9zmoPCEUVdatc4eKyM43lgnN7EPBusDoKK6YvqP4bBTEWH76WlpbrrVdQG49wHu4iqX+z5tzJtu9PQkSSL6blbIDUWZNKekYic3Xi+BwS4QAEqZIh8RBZGPC4qunXUKvBYc0MwbDg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jWtiZgAg; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jWtiZgAg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5705FC4CEF5; Wed, 8 Oct 2025 03:59:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1759895978; bh=qNjT1AkMsrlGTHoFdpErJ22ljElcPV3fTuggOttYr3o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jWtiZgAghGjVIS41h3O76mFd9v2VVcO5VuGk2hNYKMLK4Cg5avhN4bcma7CYBvsA3 Hyk+7myoQoKGIH8zkWTI36yg4XZTLZuqpOz0iwoLQPEfJf/ycznMIc6DYPeid6XtA5 vYe+saWpysDdf7O/xU89dqA0yqdnx96fF5vK6HHM9Av5F0ZGReBIfmdaDQ6gy0Qipz m5CkHz1Bbkg0PPEAosqtrXj9IUxnZzGGKMwc4A2qDZKJSpqEGEawUm6rUJ2vmvbD3K RjPIw7cIqZvYiniZFB5zi9HEDO5AbH/yV3SYMI8kDS9p7uXpvv4NAQuDmnVuy/zp1w xm7DM/JQVfxvw== From: Kees Cook To: Luis Chamberlain Cc: Kees Cook , Malcolm Priestley , Mauro Carvalho Chehab , linux-media@vger.kernel.org, Hans Verkuil , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Rusty Russell , Petr Pavlu , Daniel Gomez , Sami Tolvanen , linux-kernel@vger.kernel.org, linux-modules@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH 1/3] media: dvb-usb-v2: lmedm04: Fix firmware macro definitions Date: Tue, 7 Oct 2025 20:59:33 -0700 Message-Id: <20251008035938.838263-1-kees@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251008033844.work.801-kees@kernel.org> References: <20251008033844.work.801-kees@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1974; i=kees@kernel.org; h=from:subject; bh=qNjT1AkMsrlGTHoFdpErJ22ljElcPV3fTuggOttYr3o=; b=owGbwMvMwCVmps19z/KJym7G02pJDBlPHy577VIi+qSi5Mg9MZZLOfzZ1xjYKiabHfJpbBNMU DnPXt3RUcrCIMbFICumyBJk5x7n4vG2Pdx9riLMHFYmkCEMXJwCMJHn1xkZnv7Kqck2WRhgd+fD jdSyR365f4/UabalyYXozlJv4XqTwfC/Rvvv2aWiKodP7tjJMbndy/zYl0XajtFt2ipJO/4n7Zv IAQA= X-Developer-Key: i=kees@kernel.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The firmware filename macros incorrectly included semicolons in their string literal definitions. Right now, this wasn't causing any real problem, but coming changes to the MODULE_INFO() macro make this more sensitive. Specifically, when used with MODULE_FIRMWARE(), this created syntax errors during macro expansion: MODULE_FIRMWARE(LME2510_C_S7395); expands to: MODULE_INFO(firmware, "dvb-usb-lme2510c-s7395.fw";) ^ syntax error Remove the trailing semicolons from all six firmware filename macro definitions. Semicolons should only appear at the point of use, not in the macro definition. Signed-off-by: Kees Cook Reviewed-by: Hans Verkuil --- Cc: Malcolm Priestley Cc: Mauro Carvalho Chehab Cc: --- drivers/media/usb/dvb-usb-v2/lmedm04.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb= -usb-v2/lmedm04.c index 0c510035805b..05c18b6de5c6 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -70,12 +70,12 @@ #include "ts2020.h" =20 =20 -#define LME2510_C_S7395 "dvb-usb-lme2510c-s7395.fw"; -#define LME2510_C_LG "dvb-usb-lme2510c-lg.fw"; -#define LME2510_C_S0194 "dvb-usb-lme2510c-s0194.fw"; -#define LME2510_C_RS2000 "dvb-usb-lme2510c-rs2000.fw"; -#define LME2510_LG "dvb-usb-lme2510-lg.fw"; -#define LME2510_S0194 "dvb-usb-lme2510-s0194.fw"; +#define LME2510_C_S7395 "dvb-usb-lme2510c-s7395.fw" +#define LME2510_C_LG "dvb-usb-lme2510c-lg.fw" +#define LME2510_C_S0194 "dvb-usb-lme2510c-s0194.fw" +#define LME2510_C_RS2000 "dvb-usb-lme2510c-rs2000.fw" +#define LME2510_LG "dvb-usb-lme2510-lg.fw" +#define LME2510_S0194 "dvb-usb-lme2510-s0194.fw" =20 /* debug */ static int dvb_usb_lme2510_debug; --=20 2.34.1 From nobody Wed Feb 11 02:25:36 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C8A1D2BE035; Wed, 8 Oct 2025 03:59:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759895978; cv=none; b=UbQ0LhISUDUtYWvsYHrVAAt9Tu7rvDhMqWS9RVIF2oun+AnrxtGKc+n0cFE9VnjwMBHV3SJsGfyR8CcF07UlN68F7zBCuRBvEFYQntl304sDSARveSox+lHx2DagXwvJ7E2AjKEbjho5arJ9PevL6ieKsldR9Xq2WDZVqlHFiFc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759895978; c=relaxed/simple; bh=SYBRK9Is6hze7pc/EZVMKBQ2vZCW72GwF2tZk/9Hvxk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=X/Uzpix6nYn++O110Qu20DP81DmLAodNHAK4U+0JILP6GzjZWPbWaeH9vXpc6zv61gpssGCka60MnDzfIxqUSZ2ZD9GhKjpTvoOE2H2gqBAtBnwZsvzPYp7Tkl+54J54rv0s82HAJCKnJ6bU4pQTZ1/VG/yk8VyT8Kt7Ls3zxRc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PY1/AsgV; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PY1/AsgV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B775C113D0; Wed, 8 Oct 2025 03:59:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1759895978; bh=SYBRK9Is6hze7pc/EZVMKBQ2vZCW72GwF2tZk/9Hvxk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PY1/AsgVHhpY4bWXsNkg+CrG/U3KzIYEBun6QR/Ei+nhfs4UqBqsyu1ZKuN/iuLCM j7liF/0UCvsOLAxYDs/FLZHG2Z64/wQ+or8QyjC6K4vd7DqdoRYgWWhzWxDXvO2dcy 7LPHtB/UugSgKobT6dlX5NCR1P8QfvJIenRKNDxtaZFDHpoDT3PyM/or+9RxVagZhV MYhRK9YIZ8cDpPbCGlrm3mWykfWQL8yxpDJzetwXSEriqC3ogOoiQwiHL1WXG1jOZN t/aMR9uvK0l/GVROq2y+nUArgZCBdppgHhbwyS+jO/Ii7X61FmDr3Qr8JDhDRGt7cs bumUE4TtPbSDA== From: Kees Cook To: Luis Chamberlain Cc: Kees Cook , Hans Verkuil , Mauro Carvalho Chehab , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , linux-media@vger.kernel.org, Malcolm Priestley , Rusty Russell , Petr Pavlu , Daniel Gomez , Sami Tolvanen , linux-kernel@vger.kernel.org, linux-modules@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH 2/3] media: radio: si470x: Fix DRIVER_AUTHOR macro definition Date: Tue, 7 Oct 2025 20:59:34 -0700 Message-Id: <20251008035938.838263-2-kees@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251008033844.work.801-kees@kernel.org> References: <20251008033844.work.801-kees@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Developer-Signature: v=1; a=openpgp-sha256; l=1678; i=kees@kernel.org; h=from:subject; bh=SYBRK9Is6hze7pc/EZVMKBQ2vZCW72GwF2tZk/9Hvxk=; b=owGbwMvMwCVmps19z/KJym7G02pJDBlPHy7LFHPVe8133XsWQwTv1OhnWkxLZmSls7q47Tn38 rDbYqOzHaUsDGJcDLJiiixBdu5xLh5v28Pd5yrCzGFlAhnCwMUpABMRf8nIMHn/rTvCh2Wb+w4K vP0Qkf9gS3PFVF+zb4516RMncWW3cTL8s3dKMLug9ZxrE/Oe2U/mBdpuWNDPoKOwQrTm8takW25 WDAA= X-Developer-Key: i=kees@kernel.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Content-Transfer-Encoding: quoted-printable The DRIVER_AUTHOR macro incorrectly included a semicolon in its string literal definition. Right now, this wasn't causing any real problem, but coming changes to the MODULE_INFO() macro make this more sensitive. Specifically, when used with MODULE_AUTHOR(), this created syntax errors during macro expansion: MODULE_AUTHOR(DRIVER_AUTHOR); expands to: MODULE_INFO(author, "Joonyoung Shim ";) ^ syntax error Remove the trailing semicolon from the DRIVER_AUTHOR definition. Semicolons should only appear at the point of use, not in the macro definition. Signed-off-by: Kees Cook Reviewed-by: Hans Verkuil --- Cc: Hans Verkuil Cc: Mauro Carvalho Chehab Cc: Uwe Kleine-K=C3=B6nig Cc: --- drivers/media/radio/si470x/radio-si470x-i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/radio/si470x/radio-si470x-i2c.c b/drivers/media/= radio/si470x/radio-si470x-i2c.c index cdd2ac198f2c..3932a449a1b1 100644 --- a/drivers/media/radio/si470x/radio-si470x-i2c.c +++ b/drivers/media/radio/si470x/radio-si470x-i2c.c @@ -10,7 +10,7 @@ =20 =20 /* driver definitions */ -#define DRIVER_AUTHOR "Joonyoung Shim "; +#define DRIVER_AUTHOR "Joonyoung Shim " #define DRIVER_CARD "Silicon Labs Si470x FM Radio" #define DRIVER_DESC "I2C radio driver for Si470x FM Radio Receivers" #define DRIVER_VERSION "1.0.2" --=20 2.34.1 From nobody Wed Feb 11 02:25:36 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CB3DC2BE036; Wed, 8 Oct 2025 03:59:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759895978; cv=none; b=QKNNI6lcPxlYpI/MSkHO2+UKoYCDJRRNNWJO0qoKJWwGccPq4CH9siOJQQLgmNINYzqIq0ksrhRsyfzET6BdKdHVm+6nCE16Cox+SzHSi4Plpkd+iO6Q5XapfXmOuNlr39ni9JWIaTKVg3EuggDPzBkYZJpoaywuBlaqawKS95o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759895978; c=relaxed/simple; bh=/WAB5MfGBmvDQJ4UC5RStzDxPybbW2rZG0FUWgjN0gw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=htJMMPFPHhEjIrtlrMTR7cXRhXzF8t+dOEc8QNZHTi9Zx0Zrodzx8BrT0LDU+IBpB0VjpnIr2Kehze6RU0ZIgSDGI292SYUtvc6hw2/a3xMpSOwIV4bymjT+xz2zCAqhm/ctNr7PD0PwnzLA/oDOZWUeb9Su4VG6y76TQeYTwF8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Vv68HgJE; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Vv68HgJE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71941C4CEFF; Wed, 8 Oct 2025 03:59:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1759895978; bh=/WAB5MfGBmvDQJ4UC5RStzDxPybbW2rZG0FUWgjN0gw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vv68HgJEsyCeLlY8CO4rpXYMTZapQDaiwnzYkzOfGL29Dn3s6aStlzvCbpwhrBlL/ CfWgaTDopGP1F6nXuYhlbbn41NqciR20Znai7B9MwubAibXGr9Dz/9EMD7IvkidBVK nwvVFT5cpF2QVG+TqTzqGmQ4zmxJGqi70XndFFiM2/f57IVFlUWLu8zk34X6LfMC9N HVsmL3cxSshslfXFudgva2eG15BipiayRAiWJseHZX04CifVTjVoWQ9Q/kCfGc4QXt nz08kCPJ07Wth2JBr/t8Haklzb4OxnTBZH/gOursbDQipObCMGg+dYGBMT4bpC0bEa 8JBCa4fcAtArQ== From: Kees Cook To: Luis Chamberlain Cc: Kees Cook , Rusty Russell , Petr Pavlu , Daniel Gomez , Sami Tolvanen , linux-modules@vger.kernel.org, Malcolm Priestley , Mauro Carvalho Chehab , Hans Verkuil , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH 3/3] module: Add compile-time check for embedded NUL characters Date: Tue, 7 Oct 2025 20:59:35 -0700 Message-Id: <20251008035938.838263-3-kees@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251008033844.work.801-kees@kernel.org> References: <20251008033844.work.801-kees@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2357; i=kees@kernel.org; h=from:subject; bh=/WAB5MfGBmvDQJ4UC5RStzDxPybbW2rZG0FUWgjN0gw=; b=owGbwMvMwCVmps19z/KJym7G02pJDBlPHy7beiD4Ye+RjYysL/hj7gZ84zy1yMJs5jQdha1RK 7UXnZ0Z1lHKwiDGxSArpsgSZOce5+Lxtj3cfa4izBxWJpAhDFycAjCR7L2MDB8vy8zWENNNkJ6l kDW/8JyFxXLLUI5uj105ImpJyRc/7wCqEFluxNv3JOZG473PE7o1t+8W6/mkvqlCdoZ1xY9HiZV cAA== X-Developer-Key: i=kees@kernel.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Long ago, the kernel module license checks were bypassed by embedding a NUL character in the MODULE_LICENSE() string[1]. By using a string like "GPL\0proprietary text", the kernel would only read "GPL" due to C string termination at the NUL byte, allowing proprietary modules to avoid kernel tainting and access GPL-only symbols. The MODULE_INFO() macro stores these strings in the .modinfo ELF section, and get_next_modinfo() uses strcmp()-family functions which stop at the first NUL. This split the embedded string into two separate .modinfo entries, with only the first part being processed by license_is_gpl_compatible(). Add a compile-time check using _Static_assert that compares the full string length (sizeof - 1) against __builtin_strlen(), which stops at the first NUL. If they differ, compilation fails with a clear error message. While this check can still be circumvented by modifying the ELF binary post-compilation, it prevents accidental embedded NULs and forces intentional abuse to require deliberate binary manipulation rather than simple source-level tricks. Build tested with test modules containing both valid and invalid license strings. The check correctly rejects: MODULE_LICENSE("GPL\0proprietary") while accepting normal declarations: MODULE_LICENSE("GPL") Link: https://lwn.net/Articles/82305/ [1] Suggested-by: Rusty Russell Signed-off-by: Kees Cook --- Cc: Luis Chamberlain Cc: Petr Pavlu Cc: Daniel Gomez Cc: Sami Tolvanen Cc: --- include/linux/moduleparam.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index 6907aedc4f74..160f1678fafa 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h @@ -26,6 +26,9 @@ =20 /* Generic info of form tag =3D "info" */ #define MODULE_INFO(tag, info) \ + _Static_assert( \ + sizeof(info) - 1 =3D=3D __builtin_strlen(info), \ + "MODULE_INFO(" #tag ", ...) contains embedded NUL byte"); \ static const char __UNIQUE_ID(modinfo)[] \ __used __section(".modinfo") __aligned(1) \ =3D __MODULE_INFO_PREFIX __stringify(tag) "=3D" info --=20 2.34.1