From patchwork Fri Aug 9 07:33:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 13758476 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3EE23C52D71 for ; Fri, 9 Aug 2024 07:33:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 41ADF6B00A0; Fri, 9 Aug 2024 03:33:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 374686B00A3; Fri, 9 Aug 2024 03:33:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 17B516B00A2; Fri, 9 Aug 2024 03:33:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id D4E816B00A4 for ; Fri, 9 Aug 2024 03:33:13 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 9AE9D1A0A0A for ; Fri, 9 Aug 2024 07:33:13 +0000 (UTC) X-FDA: 82431891066.10.AF15A89 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf29.hostedemail.com (Postfix) with ESMTP id D6AF112002D for ; Fri, 9 Aug 2024 07:33:10 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=QqpCoLXI; spf=pass (imf29.hostedemail.com: domain of kees@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=kees@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1723188758; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ZtVqoLL30FNVIrIzNRmlrz4pHlXBNgqPNuW4pj66gso=; b=uO3nXkaT81Z94w/PpI+4cBT5y35zYeBGb+FNsEODJAvOqOhmMSFFxhHMVXzU5b8JcEuaf0 X2YG6ZxibsTN1g7KQynQaQSwgeL44fuwRo8ptJHvPIweiXMdNaqHW6IWSXJw9wJ2Fe+MT0 B3zzcrqjf4vmSHNdBxiYhGN3ws1vChM= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=QqpCoLXI; spf=pass (imf29.hostedemail.com: domain of kees@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=kees@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723188758; a=rsa-sha256; cv=none; b=DevgkxADPbafnuPqL54qHNBu8zGTKAGEWLTPXwQtqYMzknaTWg6+EZq00hvBr6Kv4PgYfb Q7i6Kh6EE4US1rb/Mw6QeOee0MkEDLgvNf+gAfqdTxlvsxrC+6HAE2Wp7LayAInpkKGNkR i9bXZwzCRW2N5CBlAMrAkliLJg2SgHA= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 05FAC6165E; Fri, 9 Aug 2024 07:33:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A604FC4AF0D; Fri, 9 Aug 2024 07:33:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723188789; bh=Bm7wZvIpH1u9Fue5VhYGh2wN4XsW+HXCBPDIfO+4Wi0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QqpCoLXIIBMnBfGGkEX09zukRI2+BmDPINyNOYod5uVhbZDarz3N5Gon+RuXzFMAb oPfcGVx2F89WvXdR38xVPnVsVlOUmNcyHLnIz/i0Chy93oj1L4sP0lHM9ULrx3F+Dy 3wtCujBr/ZAjZcrcrOYEQHYox5wX8h0ySRVdiy4kQYmXwl16b/dgOdo7qfIJdcuOze /My+X+Esi8xyVCPP+QA8hTU/aKTo2FyoEfdKL29fwNZw2fSN5v+VcPTVRG6MpbJbIh z6fXqwUOtqJjrwqRQmB4cR3qiejfPc+eHmuFlse3M/B3SuOYmoyKMkjQGsPZiZMAAm X3fYWCL8pp4Yg== From: Kees Cook To: Vlastimil Babka Cc: Kees Cook , Suren Baghdasaryan , Kent Overstreet , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, linux-mm@kvack.org, "GONG, Ruiqi" , Jann Horn , Matteo Rizzo , jvoisin , Xiu Jianfeng , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH 2/5] codetag: Run module_load hooks for builtin codetags Date: Fri, 9 Aug 2024 00:33:03 -0700 Message-Id: <20240809073309.2134488-2-kees@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240809072532.work.266-kees@kernel.org> References: <20240809072532.work.266-kees@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1658; i=kees@kernel.org; h=from:subject; bh=Bm7wZvIpH1u9Fue5VhYGh2wN4XsW+HXCBPDIfO+4Wi0=; b=owGbwMvMwCVmps19z/KJym7G02pJDGlbjxke+n5p3ULn87cf9DTKdwmaspUUamrMS9iRlnGLf TIne3NeRykLgxgXg6yYIkuQnXuci8fb9nD3uYowc1iZQIYwcHEKwEQuXGZkeC42Q9N+bpD98SIX x6h7Lvs+C7ZwcS3zP3qIZfUbhd77AQz/IwUeVCk7XGpQ0dpqWr5Ru4/R+rV7RXv5Wob9sVHfDmx hBwA= X-Developer-Key: i=kees@kernel.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: D6AF112002D X-Stat-Signature: 4ykktbde95ygrhm54ohw83a8rej1skbb X-HE-Tag: 1723188790-964777 X-HE-Meta: U2FsdGVkX1/Djrx7TawDgBQsFvl81DbzayCmB/TWSp/M+dadwyr7Qtxv872Z3wrGQ0FzLrlvIzo3UXFqNmubrM7wIWSLcbM+eGW0ptwl1Enc2mm1c+zIGR2iZY+Rp/GlauLgtSwSmhmAFyeEPZYAIZ3CrHEqovD6UutV9G0Ojy3dxjv3lwTGcLOGt9z0P1xIDyHb7BrSExWjyv5GeDMt5mkdNQRbaL8UcCN7G8geM3kInvVEP6jLGgZC4xvjNu1rb4sm1/CQnVGShCmAL5uE34mLxQqY9Tdo4J0dKUNoppH9sXw9P+ui+zcsJw/lDQT+O0p3uaUyva2VWjCQshGekXYZmNVyAnNg8SnPgL51pMvPWVA5BbdIUstPWG1Kzn0gCw1Nv8ka8BKsN7v7wMITG/vhNvjALzFygTaS4OhilnNYAhYargUPthySdOoiETxZfAQf9nfBxBIqN19uNO+CS6h/Z75/hzYpIckL1ahSLDLQUEaiwznUdCk97uPI0RIe9faXb+iUEhdcf2b1fE5DYydtzWrdn1owxJRv1ZRLe/j/sOjutxzQxl2i9ubQvlu3Xnss8hFZSwqios1wgEP10w6b3y6ZBZRO/5WkumEsx2EYrLYQBV6Z/QtrifhPsRAa4ArAL8y39qCUg8eoCHoXZDyQugVyjhXvDwE3cBdbLussg3WE102A8tpgOk0Bgz2e87uQJICWwqvTGEcjXd/vPS895sG0bW88bmbGzz2VgMpv/eqfYVZDTbMelkQkBgy9SUAVuiKcp+S3gERmi6AMaNkkD86Enu2KU8pDR8ousUKykA0g6bXZB3iEVOcO6J7aZ/Zd5n3iXsL4Q1zvZubhdEPK/gQQ4XecJrU2F2s5sxPRepC19pMyhgcr6CqDEQEGISL3Tc64UCFQE3vUoyOFT3AyWAZAnUq1G8H+p1vnZbX7ScaA3lhY3BGYZzBV0lLSm2ECIkZKnfZpFBDLplz oWQjB9Hx XaSit79Ls2GNkToS1qTskuE7dIa5hHxom5SvM7SyihBWOE0S4MibzQFUrNaOBvgi32YrNcFEPRRMsTSiahQE1qa7iUbnfZry/IhC+bb9fGgWmuK+noymKDmSs12L31JTXG3aS9Y9rw1h4F98oZjTUd0qw69aP7HF2r3ts49HEKaODakDCWkzQiC6GYOSTF7iOZH4Jw7teNx/08DURgkEHupUSH3JKF6cTmVWXq80ddgmNe0+VSOwKfS1bKAyLRoPp4TZCvnLzWWlloht7A6n4Vy1dHNZSl8DdDJskX25v8xliTkcS7dz8HzQaBvFLt6PIjOYL0CJURRVnhoQv/AiG+93gc5m3ZvIDGfIXGG8MQ88ZvLYzskt717ZycmZugRvfz59wdwnYzt39mfmYp2qgRn6SzMFlpUHu3cyR3VIQF2ICJt08J/CCXTnSjAZiITKUrIBaWAWN1wBnMXyWkvfedCf9vL/zY94C12chquTUsJP2tjhrf+UxbK4ffb2I1SAYfBH8lkH1RrtPSGTcBn5GUqhb4kYmDdSztVWygPOY7K65yEjkcRhfZj0zBisDvFtAm9lLNeOlk8vHcpWbBzEtN/kKiawHDswS7ROeT2FjhSlbxOl1tm1UV6s8hlQXVWZP9Abv X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: The module_load callback should still run for builtin codetags that define it, even in a non-modular kernel. (i.e. for the cmod->mod == NULL case). Signed-off-by: Kees Cook --- Cc: Suren Baghdasaryan Cc: Kent Overstreet Cc: Vlastimil Babka Cc: Christoph Lameter Cc: Pekka Enberg Cc: David Rientjes Cc: Joonsoo Kim Cc: Andrew Morton Cc: Roman Gushchin Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: linux-mm@kvack.org --- lib/codetag.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/codetag.c b/lib/codetag.c index 5ace625f2328..ef7634c7ee18 100644 --- a/lib/codetag.c +++ b/lib/codetag.c @@ -125,7 +125,6 @@ static inline size_t range_size(const struct codetag_type *cttype, cttype->desc.tag_size; } -#ifdef CONFIG_MODULES static void *get_symbol(struct module *mod, const char *prefix, const char *name) { DECLARE_SEQ_BUF(sb, KSYM_NAME_LEN); @@ -199,6 +198,7 @@ static int codetag_module_init(struct codetag_type *cttype, struct module *mod) return 0; } +#ifdef CONFIG_MODULES void codetag_load_module(struct module *mod) { struct codetag_type *cttype; @@ -248,9 +248,6 @@ bool codetag_unload_module(struct module *mod) return unload_ok; } - -#else /* CONFIG_MODULES */ -static int codetag_module_init(struct codetag_type *cttype, struct module *mod) { return 0; } #endif /* CONFIG_MODULES */ struct codetag_type *