Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1102904rwb; Thu, 8 Dec 2022 06:50:00 -0800 (PST) X-Google-Smtp-Source: AA0mqf4M6IE+fRpFBB1Exhb6FN2oCB89pZToPvJBWC+16zEtEY8IBCOAbcANSPQqiWkS48+5fiy7 X-Received: by 2002:a17:90b:4ccf:b0:21c:3fc7:6434 with SMTP id nd15-20020a17090b4ccf00b0021c3fc76434mr1351744pjb.206.1670511000708; Thu, 08 Dec 2022 06:50:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670511000; cv=none; d=google.com; s=arc-20160816; b=s0iSWEjiRryGPGR9AxqWLJBlR2/4pASeXqy3SQbbHdbwjA3bpxhqRS/j6p8Zsc+WJc 6amRE8TLQcuhI0xBnNWYLC59aRPgVxWniptMta9ZI0W9M/w3Vc48rXZ6Bp6pl+W4XTWH YqWPsTHCv4nu7CAigJp+hNau8uD1qgqZVy+EMJotnvyciDmQXJzNnYryRzj+Akylb0RG qGfswyF43nWXENIDwlJVtx1LFV3Kqu37lULWOwc+S83+vrtuWaWxddUyMc5+amMc1SYm MA5mSEpiTRC1S/AJN14Sy7uSvktWTA8eQ4kQKo7Fut7xfM7zQ8TFlTdhGUI90LM+rw/L ELgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:message-id:user-agent:cc:to:references :in-reply-to:from:subject:content-transfer-encoding:mime-version :dkim-signature; bh=dikuhIELZ1flKupHZqNkVCgQu36IUiN1yEZUoDzZvNg=; b=c/bIKoZJtwwsbNrY2H92y3NGURo1JPTmCgivXdcksAkvWNg5UsYXyZGwlFfCAC3GMQ axgDXFx54M20sxfNRir4RInlAceZMnjPxHSEzeCD9jCD785Uh2PiEXOZ2ss+UqmRRFIi Pp9aMgBv2/rjyuEX3S4T4Rza1zVj80x6E8/7TmzGom7Qh5xgYTqFwWN6vTUcIZ5GaGRv fJ2cbktWKUliWb7WMK1di76NGGG9Wc+aQc9BroKNuXDZ0GRw8dMyrNWev9IuGMfi0a49 fc2hATKQOsTUb5op3II4kjNXc/mnpYfFj0Vl1TRcFFFRvmb5Kil+U3xXnM7YJRiqLbcv Xx/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qh7K3RoG; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s18-20020a056a00179200b0053652e1c0b6si26186443pfg.12.2022.12.08.06.49.52; Thu, 08 Dec 2022 06:50:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qh7K3RoG; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229888AbiLHOrt (ORCPT + 65 others); Thu, 8 Dec 2022 09:47:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229758AbiLHOrr (ORCPT ); Thu, 8 Dec 2022 09:47:47 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00770BC18 for ; Thu, 8 Dec 2022 06:47:44 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 96690B82407 for ; Thu, 8 Dec 2022 14:47:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B8A1C433D7; Thu, 8 Dec 2022 14:47:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1670510862; bh=9vrFXw+w9zyJeuVoJgnWYnTSEQu1EDA2aAQctMsJb88=; h=Subject:From:In-Reply-To:References:To:Cc:Date:From; b=qh7K3RoGM9l1buurT7g9uArwz1JWurE3D4rmQY7jqrfSKhw/9j6V8WTWPjRWXpn/9 LstEe3r492yx8eJW5Qk6lfLNO1O7hixc53OhwOEo146lvsfk7+ocYYEAYSVpR0sBaa tw1YdgnZvzRy8hZfJ8EXM5fKRYkltFAqdtbbaRnyyEvd7R1ZOIWGvR3qVjQx2WerQJ 6WvuGvN8Fz7BeFj+cfhlqtRt+BQJyGUNbJpyLFMl5+o9XQQfq5G/y6zH5BExEd/bUj YCCjviSB4VDhZ3XmPnoRDjHI+6vM0FSe9yBGeQBUSOZ2t+70zHa5fJICMKQU9nzgwf mDaJy6Im5UwmA== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [PATCH 1/2] wifi: rtw89: don't request partial firmware if SECURITY_LOADPIN_ENFORCE From: Kalle Valo In-Reply-To: <20221202060521.501512-2-pkshih@realtek.com> References: <20221202060521.501512-2-pkshih@realtek.com> To: Ping-Ke Shih Cc: , User-Agent: pwcli/0.1.1-git (https://github.com/kvalo/pwcli/) Python/3.7.3 Message-ID: <167051085972.9839.9335859470213768636.kvalo@kernel.org> Date: Thu, 8 Dec 2022 14:47:41 +0000 (UTC) X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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-wireless@vger.kernel.org Ping-Ke Shih wrote: > From: Zong-Zhe Yang > > Kernel logs on platform enabling SECURITY_LOADPIN_ENFORCE > ------ > ``` > LoadPin: firmware old-api-denied obj= pid=810 cmdline="modprobe -q -- rtw89_8852ce" > rtw89_8852ce 0000:01:00.0: loading /lib/firmware/rtw89/rtw8852c_fw.bin failed with error -1 > rtw89_8852ce 0000:01:00.0: Direct firmware load for rtw89/rtw8852c_fw.bin failed with error -1 > rtw89_8852ce 0000:01:00.0: failed to early request firmware: -1 > ``` > > Trace > ------ > ``` > request_partial_firmware_into_buf() > > _request_firmware() > >> fw_get_filesystem_firmware() > >>> kernel_read_file_from_path_initns() > >>>> kernel_read_file() > >>>>> security_kernel_read_file() > // It will iterate enabled LSMs' hooks for kernel_read_file. > // With loadpin, it hooks loadpin_read_file. > ``` > > If SECURITY_LOADPIN_ENFORCE is enabled, doing kernel_read_file() on partial > files will be denied and return -EPERM (-1). Then, the outer API based on it, > e.g. request_partial_firmware_into_buf(), will get the error. > > In the case, we cannot get the firmware stuffs right, even though there might > be no error other than a permission issue on reading a partial file. So we have > to request full firmware if SECURITY_LOADPIN_ENFORCE is enabled. It makes us > still have a chance to do early firmware work on this kind of platforms. > > Signed-off-by: Zong-Zhe Yang > Signed-off-by: Ping-Ke Shih 2 patches applied to wireless-next.git, thanks. 3ddfe3bdd3cf wifi: rtw89: don't request partial firmware if SECURITY_LOADPIN_ENFORCE 13eb07e0be1b wifi: rtw89: request full firmware only once if it's early requested -- https://patchwork.kernel.org/project/linux-wireless/patch/20221202060521.501512-2-pkshih@realtek.com/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches