From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (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 77D6B3FC8 for ; Mon, 27 Sep 2021 12:15:46 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id CC99F61002; Mon, 27 Sep 2021 12:15:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632744946; bh=I2kLfjcYEq3Pn4ErFSyTzDxe3WqNuLFDliR3QOYIh48=; h=From:To:Cc:Subject:Date:From; b=fIIKqxL9qw6wTOMU611lb1v/toPd+VhxDI/BgUfGmR1T2ir6HsQfn41QNIPpCD7qr vZYaDMslpVZ/tvuoXJ+YMphKNyDe01JNssCwQ/RHBTlu2oVTi40Est+zgBNnfGu5eC k0GOvaTQqVNDaHdyGgnVQ+alHPJwmj2mnMXuF2E4pTPd4vShvVeWqQ+xaGzeuzo3nJ LO31rVjjKFpXBSCooPD1zIXue1RwsLyIfAVXBTnChTnMCSNkRY+Y1yb6KXZO2nGqjN WmWkEUf6CzGOzV1V/US9MxWBzCXZPdUmHiLkH07OALSGDO2nkY1J/3B5AJVUb9rDgu 1S6jlxVMb/J1Q== From: Arnd Bergmann To: Luis Chamberlain , Jessica Yu Cc: Arnd Bergmann , Nathan Chancellor , Nick Desaulniers , Miroslav Benes , Greg Kroah-Hartman , Kees Cook , Sergey Shtylyov , Sami Tolvanen , Stephen Boyd , linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH] module: fix clang CFI with MODULE_UNLOAD=n Date: Mon, 27 Sep 2021 14:15:10 +0200 Message-Id: <20210927121541.939745-1-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Arnd Bergmann When CONFIG_MODULE_UNLOAD is disabled, the module->exit member is not defined, causing a build failure: kernel/module.c:4493:8: error: no member named 'exit' in 'struct module' mod->exit = *exit; add an #ifdef block around this. Fixes: cf68fffb66d6 ("add support for Clang CFI") Signed-off-by: Arnd Bergmann --- kernel/module.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/module.c b/kernel/module.c index 40ec9a030eec..5c26a76e800b 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -4489,8 +4489,10 @@ static void cfi_init(struct module *mod) /* Fix init/exit functions to point to the CFI jump table */ if (init) mod->init = *init; +#ifdef CONFIG_MODULE_UNLOAD if (exit) mod->exit = *exit; +#endif cfi_module_add(mod, module_addr_min); #endif -- 2.29.2