From nobody Mon Dec 1 22:35:04 2025 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 B34FA8488 for ; Mon, 1 Dec 2025 03:06:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764558376; cv=none; b=LH+zdoEBvy5MKDMhfHnxR/0P6P7b1ZUfAtrqug/v51xbsV2A6U7YiPOGI06QY3qZCYfbCxyWSN+IOyq6y8FWcvMSJ19g9FMoHJEf8tNo1JTh6TKHlqO2yFCsapG/r33Ri8Rg5Yad/Jik7zdVCxmnTn89jh/MddD5SXXNzrBaGho= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764558376; c=relaxed/simple; bh=JQob1fIFOHd0zgBafaJjwPrC6CdFgMyJsc+cMbI1z/8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nMWc5Dkrh6fjJ2yagk1Zq0UmLpZwRSL2MWNta2HS0IKZNpxZMiLk+sSgLQbBcXCvGp4as8kQCu55MqR8D7/q7ICrKa8wS8njFTJlOFMMNmcZd5w0u8lUCasGOAzjQwVhCE0hfCstjUVVEf2Fp1G/HCU0EJ+I4KgmDSyE6J87fcs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=R8f6Z5G3; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=PZ8Jk5A2; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="R8f6Z5G3"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="PZ8Jk5A2" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1764558373; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=38eKCGFDzi9YXaJFlb8wscW8uVUGQfKn9hJMTWM8MvA=; b=R8f6Z5G3zBW9oCwRFJNxQKWnFEk6ffcqqwlXyAawjC58Gq9fPLeUDNY7emnov3kEUYozKq DkoaP5J892d54ZQR9m/lKXo0Ll3KDSePVW1Xl4qNGxPaBNENJRUAdVq2SBJ3IhGhcLhZCN +OpjQs44PopV0vmPaMx5IitASaQ6rFI= Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-338-rQzU11-7NS6XxOevhH7eqQ-1; Sun, 30 Nov 2025 22:06:12 -0500 X-MC-Unique: rQzU11-7NS6XxOevhH7eqQ-1 X-Mimecast-MFC-AGG-ID: rQzU11-7NS6XxOevhH7eqQ_1764558371 Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-2956cdcdc17so33926745ad.3 for ; Sun, 30 Nov 2025 19:06:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1764558371; x=1765163171; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=38eKCGFDzi9YXaJFlb8wscW8uVUGQfKn9hJMTWM8MvA=; b=PZ8Jk5A23lBDBritOLYFZ2DGHVe6kzPsedp+pWbcmPSObdvxWeJosPUxGfAlbzQulK LvFLY+YgYG/UIrCaS3h3cT/JoktOaIKr6jyg5CW7hxRuqg0QQJWbrHpN08s3soHDpoGV IC3kTUBa81Ayyjkv6Xlgvyg605gwx+vxBFZgDxHblYMXTAjn7ANpWFHHFF8bJ3mi187s 6+9L+W30bU/Sq/sK0wh+1h+F8qMjtZYF9U+A9zytWr8bi2u2MRWkxEPI4lrKttxmXLut pQfSdtgtFtTnY7UtPkhwQZHcz+ItqIRzDU4SF0cDWMEJXkU/mNo6+7/PT2dtpFmoJ2H/ qqMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764558371; x=1765163171; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=38eKCGFDzi9YXaJFlb8wscW8uVUGQfKn9hJMTWM8MvA=; b=JfRQJM31nLJgbrjWbhfzl3GCRLATksJ17nVhb+cB2G+kfz594C9tC+LV2RjyIGhv28 bbTbJ78wyZlgAybhVdP9KgkeaB93chyKicMJZ5LdwYlcBJ6ar8/dF82eUDd9AKxvR762 lRf2G4E4ID++WCBhGLHg+Eh4NFu49d78lPtz6ywDpxWkiYh7SJEZr2aZhfsaCXrsckxt +dWzeA8s3e4y+vosChQpwif7yiPLL933xmz523KNls2/zAL7+vmAhdelg7rhhUlynkKe PVRVDFEdk0k9SkrwpLarA4sNM0z21xf5nxKW+u/NSH/1GjjezvO9YPw6qawcAETUPxfO Emtg== X-Forwarded-Encrypted: i=1; AJvYcCXj7jedaJ6nfZWwijr8vaPMPuvtwSc1SFLoBRM0gxudxTtmlipELPxo9TrUOEfXF+RXOkGNsXPPI67gajw=@vger.kernel.org X-Gm-Message-State: AOJu0YzL5QJPOX0mhX7BCR9pVDu4/hMKGUMBe2zqZ26hFGXn3cAIn9YY eYw/8he2nvjxpl+Wk4GI9dUJp5VZ6X9mCB3OYPj9ZB8PHRf/mVepSMSCQ+nf8wBNyUM6MkzKGnI +MfLgMJbXCPawohzWN6cv2sl8FCEVlnG3xvXvg4VEnPDjm91SbB/xlwu2o7tnszSVDw== X-Gm-Gg: ASbGncv1Ik4r0lDTozU1O1C0C0bVzJrtgBFIfds3bJ5lXRkPaJ7xK/p4cu1BX5RTc7c XhqXe6l7qEbdoB9emVo8fCqlvBhr1XGxLPyJrVXdbYJrUtK/6d4qcptHH18l+Rn4e7gsJdO/eO6 1J5jTJwnjkyA3URTHF61CPLMQDEqtyR0qDeeI0t+fdSD4C8ir3ZQVaQpOF12GZbaPO2rQHuG28k mSk4BoZbPRqoDxJaA81N5LNsId6eP+k9M5oSwModvuPTDIsFtoep4mDMxrx7jk5J+++aWVSuNk6 nw8s955tW7ti5kwa+deIhzSxryexgOIeX4pYC1To576mL8PLQPpFlcga82L/MPSsLRPo0fVda3v S X-Received: by 2002:a17:902:f788:b0:267:a1f1:9b23 with SMTP id d9443c01a7336-29b6c3e5524mr368030995ad.18.1764558370872; Sun, 30 Nov 2025 19:06:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IFb1AfSKXtOAPR9LAt0sVNrvR3EMUitw1jOBkDMrMtNSwVwZgBH54JasyLl3tbolo7V0xtUeA== X-Received: by 2002:a17:902:f788:b0:267:a1f1:9b23 with SMTP id d9443c01a7336-29b6c3e5524mr368030275ad.18.1764558370055; Sun, 30 Nov 2025 19:06:10 -0800 (PST) Received: from localhost ([209.132.188.88]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3475ff57b47sm9183994a91.5.2025.11.30.19.06.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Nov 2025 19:06:09 -0800 (PST) From: Coiby Xu To: linux-modules@vger.kernel.org Cc: linux-integrity@vger.kernel.org, kernel test robot , Aaron Tomlin , Daniel Gomez , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , linux-kernel@vger.kernel.org (open list:MODULE SUPPORT) Subject: [PATCH v2] module: Only declare set_module_sig_enforced when CONFIG_MODULE_SIG=y Date: Mon, 1 Dec 2025 11:06:05 +0800 Message-ID: <20251201030606.2295399-1-coxu@redhat.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251031080949.2001716-1-coxu@redhat.com> References: <20251031080949.2001716-1-coxu@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Currently if set_module_sig_enforced is called with CONFIG_MODULE_SIG=3Dn e.g. [1], it can lead to a linking error, ld: security/integrity/ima/ima_appraise.o: in function `ima_appraise_me= asurement': security/integrity/ima/ima_appraise.c:587:(.text+0xbbb): undefined refe= rence to `set_module_sig_enforced' This happens because the actual implementation of set_module_sig_enforced comes from CONFIG_MODULE_SIG but both the function declaration and the empty stub definition are tied to CONFIG_MODULES. So bind set_module_sig_enforced to CONFIG_MODULE_SIG instead. This allows (future) users to call set_module_sig_enforced directly without the "if IS_ENABLED(CONFIG_MODULE_SIG)" safeguard. Note this issue hasn't caused a real problem because all current callers of set_module_sig_enforced e.g. security/integrity/ima/ima_efi.c use "if IS_ENABLED(CONFIG_MODULE_SIG)" safeguard. [1] https://lore.kernel.org/lkml/20250928030358.3873311-1-coxu@redhat.com/ Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202510030029.VRKgik99-lkp@int= el.com/ Reviewed-by: Aaron Tomlin Reviewed-by: Daniel Gomez Signed-off-by: Coiby Xu --- v2 - improve commit message as suggested by Daniel - add Reviewed-by tags from Aaron and Daniel include/linux/module.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/linux/module.h b/include/linux/module.h index e135cc79acee..fa251958b138 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -769,8 +769,6 @@ static inline bool is_livepatch_module(struct module *m= od) #endif } =20 -void set_module_sig_enforced(void); - void module_for_each_mod(int(*func)(struct module *mod, void *data), void = *data); =20 #else /* !CONFIG_MODULES... */ @@ -865,10 +863,6 @@ static inline bool module_requested_async_probing(stru= ct module *module) } =20 =20 -static inline void set_module_sig_enforced(void) -{ -} - /* Dereference module function descriptor */ static inline void *dereference_module_function_descriptor(struct module *mod, void *ptr) @@ -924,6 +918,8 @@ static inline bool retpoline_module_ok(bool has_retpoli= ne) #ifdef CONFIG_MODULE_SIG bool is_module_sig_enforced(void); =20 +void set_module_sig_enforced(void); + static inline bool module_sig_ok(struct module *module) { return module->sig_ok; @@ -934,6 +930,10 @@ static inline bool is_module_sig_enforced(void) return false; } =20 +static inline void set_module_sig_enforced(void) +{ +} + static inline bool module_sig_ok(struct module *module) { return true; base-commit: ac3fd01e4c1efce8f2c054cdeb2ddd2fc0fb150d --=20 2.52.0