Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2774524pxp; Tue, 22 Mar 2022 06:02:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqZzLit+HJvvfabLYK8lyn7FGxAxB+UkJRcwqa/IxsX5MtQyVMXqjIQMbV2E2GRzuzlu72 X-Received: by 2002:a17:90b:3ec3:b0:1c7:24c4:e28f with SMTP id rm3-20020a17090b3ec300b001c724c4e28fmr5035563pjb.191.1647954156119; Tue, 22 Mar 2022 06:02:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647954156; cv=none; d=google.com; s=arc-20160816; b=bvfgVdBVYxh+m4a3m+PRO9m/L75WwPU7Yyx9zgmOsTocss1HEBws2KgWa9Arl1U2sC gXSJDuRZXhh/6XzkjeX4JB+vebFIoK5t6qwxRpwnoFndn+d5KhJJqVikrSqQ/oX4YuA4 SQe6u26IvlQZS8/f8jaUOqnTt9jEKHvuvR7rpmPiK7S/96Gd53vlu5fYmjerCpzUvC+e E9pRpuYnO3zzIflVowxsmT8yjVtGOzRyKeA/dED4TeTvnJ0u6rHbjrN1mnJekKOVLZbw PULalEDPuqwn4B0nqJY0tZlPioEdiKphMxTeaGtJDN44cvG22hXH/mhbQpBXPAeQFM7Q SfMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=J2EtVFDuVFg6bxKUJzQyPZqFlEYCxJgjKRdDkiuW44E=; b=jgQYPgs+ceQPQB5TBce8KkW0/itY3GadDynoS9FBNWIYPh3w/ZcCRuQZUBYteGfOP+ iOIuVW3eZeA9RxqPly9ugzwYSrM1qQ0fEI4kS0TUb4qW9EpQofhY57xBPeTLGtXtR5sf U7w/bBy4blHDbdUbu4xXgOR6l9+pMVQMgAe7lHnWQ30NwptdEWDXh3ytkuTFbXTWgBfn h1F47kA2f4F/mfkfE+sSgSeGIkaAlXeSFORObS6DYoRWwtqIymGN9TGvaVFuTXP0ifBP QlEopciICFwEqzFwnYWKzqbHjAa1pq25l4HvePLVh2ySR7EjgEhnDlxuNtdryR9g9zfo 1M1Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l24-20020a637c58000000b003816043ee4esi19482677pgn.67.2022.03.22.06.02.18; Tue, 22 Mar 2022 06:02:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232564AbiCVLNz (ORCPT + 99 others); Tue, 22 Mar 2022 07:13:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231534AbiCVLNw (ORCPT ); Tue, 22 Mar 2022 07:13:52 -0400 Received: from smtp-bc0d.mail.infomaniak.ch (smtp-bc0d.mail.infomaniak.ch [IPv6:2001:1600:3:17::bc0d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B52D81666 for ; Tue, 22 Mar 2022 04:12:24 -0700 (PDT) Received: from smtp-3-0001.mail.infomaniak.ch (unknown [10.4.36.108]) by smtp-2-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4KN82v01l3zMqKMC; Tue, 22 Mar 2022 12:12:23 +0100 (CET) Received: from localhost (unknown [23.97.221.149]) by smtp-3-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 4KN82t5Gg3zlhMCB; Tue, 22 Mar 2022 12:12:22 +0100 (CET) From: =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= To: Jarkko Sakkinen Cc: =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= , David Howells , "David S . Miller" , David Woodhouse , Eric Snowberg , Paul Moore , Tyler Hicks , keyrings@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= Subject: [PATCH v2 1/1] certs: Explain the rationale to call panic() Date: Tue, 22 Mar 2022 12:13:23 +0100 Message-Id: <20220322111323.542184-2-mic@digikod.net> In-Reply-To: <20220322111323.542184-1-mic@digikod.net> References: <20220322111323.542184-1-mic@digikod.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mickaël Salaün The blacklist_init() function calls panic() for memory allocation errors. This change documents the reason why we don't return -ENODEV. Suggested-by: Paul Moore [1] Requested-by: Jarkko Sakkinen [1] Link: https://lore.kernel.org/r/YjeW2r6Wv55Du0bJ@iki.fi [1] Reviewed-by: Paul Moore Reviewed-by: Jarkko Sakkinen Signed-off-by: Mickaël Salaün Link: https://lore.kernel.org/r/20220322111323.542184-2-mic@digikod.net --- Changes since v1: * Fix commit subject spelling spotted by David Woodhouse. * Reword one sentence as suggested by Paul Moore. * Add Reviewed-by Paul Moore. * Add Reviewed-by Jarkko Sakkinen. --- certs/blacklist.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/certs/blacklist.c b/certs/blacklist.c index 486ce0dd8e9c..25094ea73600 100644 --- a/certs/blacklist.c +++ b/certs/blacklist.c @@ -307,6 +307,15 @@ static int restrict_link_for_blacklist(struct key *dest_keyring, /* * Initialise the blacklist + * + * The blacklist_init() function is registered as an initcall via + * device_initcall(). As a result if the blacklist_init() function fails for + * any reason the kernel continues to execute. While cleanly returning -ENODEV + * could be acceptable for some non-critical kernel parts, if the blacklist + * keyring fails to load it defeats the certificate/key based deny list for + * signed modules. If a critical piece of security functionality that users + * expect to be present fails to initialize, panic()ing is likely the right + * thing to do. */ static int __init blacklist_init(void) { -- 2.35.1