Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2272583pxp; Mon, 21 Mar 2022 15:32:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPiGlAg6ZeiVHXHb1OY4E6+7bEYY2zOyqUdnarQ/OmAV2Ts/g01TZ/boq9Cm6FY/V/BaxL X-Received: by 2002:a17:90a:ba07:b0:1bc:a0fd:faf with SMTP id s7-20020a17090aba0700b001bca0fd0fafmr1432045pjr.194.1647901954067; Mon, 21 Mar 2022 15:32:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647901954; cv=none; d=google.com; s=arc-20160816; b=g/MO6fYo4VlNpoKcuOQPdXX5s1BpFUGQbuyKQTE7QDPbeFKSh7fLvQbhHoC1a6DHEn FV03Xbg70nzj7f1OutUTAi3qMwXu1pCl4iHE+/zsqkCwoBa20rAW7zKaghyI3vIPcn2l hX3BcWj+1XfrD/YBIYAyrttob65ag57+enZT0JUFI98IP82PULinyLy1VR7rSaTTxAmK Nc2dW35fdwShQW/r8GUPqDOJIrmoc6gsuUHppgumvjzAyXx9DrtIPkXmrtMTpp/sXJTc tz3GHSyB8JeOR/xHvsZFm67E43J3lZpslMc1RLh95M6VW4swMp96bqQ+6EWulxlGZGrv +TBw== 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=mx8q3juwgRx8YUw4HyqhuFFLdbOIZl5Ou7wbgu0o9+A=; b=JVBSN6sWK/L4+z1Rp3JAFQOmp4eDEBf/dOD/cpQcVJX08tR4QO2MGmrevItExUZn3S POHKzlsrSASE7dq6H5JgnfDRaepOGVM28Bs2iZqQJV+nhF2OrusVloCpYxFxsnp8E4Nk 4TbD/Og/G/DpemcwovCjYUMZo/zMowaiynuwFyppr68Sgq5/1vBkH4Bi3MGOn5Vh+ZQy G+61XUB7vcuXHj7DEuVpd97pGA6m1sgPZP7ooVH/oAZMwL3GKQ5HTUViw2uzG3+NomQK eVtMorBowkljAemus//tkkDRx4Mxm/KBUKDeV8xG6/fByIlgZ807zn8n1gcNV1NlGh+X Pkrw== 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:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id r15-20020a638f4f000000b003816043f011si13910882pgn.518.2022.03.21.15.32.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:32:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8792A83B12; Mon, 21 Mar 2022 14:45:39 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350213AbiCURqf (ORCPT + 99 others); Mon, 21 Mar 2022 13:46:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241430AbiCURqe (ORCPT ); Mon, 21 Mar 2022 13:46:34 -0400 Received: from smtp-1909.mail.infomaniak.ch (smtp-1909.mail.infomaniak.ch [IPv6:2001:1600:3:17::1909]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB91E3B020 for ; Mon, 21 Mar 2022 10:45:08 -0700 (PDT) Received: from smtp-3-0000.mail.infomaniak.ch (unknown [10.4.36.107]) by smtp-2-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4KMhpV75KZzMqBgV; Mon, 21 Mar 2022 18:45:06 +0100 (CET) Received: from localhost (unknown [23.97.221.149]) by smtp-3-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4KMhpV4lQ6zlhRV4; Mon, 21 Mar 2022 18:45:06 +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 , 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 v1 1/1] certs: Explain the rational to call panic() Date: Mon, 21 Mar 2022 18:45:48 +0100 Message-Id: <20220321174548.510516-2-mic@digikod.net> In-Reply-To: <20220321174548.510516-1-mic@digikod.net> References: <20220321174548.510516-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, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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] Signed-off-by: Mickaël Salaün Link: https://lore.kernel.org/r/20220321174548.510516-2-mic@digikod.net --- certs/blacklist.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/certs/blacklist.c b/certs/blacklist.c index 486ce0dd8e9c..ac26bcf9b9a5 100644 --- a/certs/blacklist.c +++ b/certs/blacklist.c @@ -307,6 +307,14 @@ 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 the functionality doesn't load and the + * kernel continues on executing. 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