From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751963AbdKICRw (ORCPT ); Wed, 8 Nov 2017 21:17:52 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:58980 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751749AbdKICRt (ORCPT ); Wed, 8 Nov 2017 21:17:49 -0500 Subject: Re: Firmware signing -- Re: [PATCH 00/27] security, efi: Add kernel lockdown From: Mimi Zohar To: "AKASHI, Takahiro" , "Luis R. Rodriguez" Cc: Greg Kroah-Hartman , Linus Torvalds , Jan Blunck , Julia Lawall , David Howells , Marcus Meissner , Gary Lin , linux-security-module@vger.kernel.org, gnomes@lxorguk.ukuu.org.uk, linux-efi , linux-kernel@vger.kernel.org, Matthew Garrett Date: Wed, 08 Nov 2017 21:17:37 -0500 In-Reply-To: <20171109014841.GF7859@linaro.org> References: <1509660086.3416.15.camel@linux.vnet.ibm.com> <150842463163.7923.11081723749106843698.stgit@warthog.procyon.org.uk> <14219.1509660259@warthog.procyon.org.uk> <1509660641.3416.24.camel@linux.vnet.ibm.com> <20171107230700.GJ22894@wotan.suse.de> <20171108061551.GD7859@linaro.org> <20171108194626.GQ22894@wotan.suse.de> <20171109014841.GF7859@linaro.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.5 (3.20.5-1.fc24) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 17110902-0012-0000-0000-0000058B368A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17110902-0013-0000-0000-00001905E00F Message-Id: <1510193857.4484.95.camel@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-11-08_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1711090030 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Archived-At: List-Archive: List-Post: > > IMHO that should just fail then, ie, a "locked down" kernel should not want to > > *pass* a firmware signature if such thing could not be done. > > > > Its no different than trying to verify a signed module on a "locked down" for > > which it has no signature. > > > > But perhaps I'm not understanding the issue well, let me know. > > My point is quite simple: > my_deviceA_init() { > err = request_firmware(&fw, "deviceA"); <--- (a) > if (err) > goto err_request; > > err = verify_firmware(fw); <--- (b) > if (err) > goto err_verify; > > load_fw_to_deviceA(fw); <--- (c) > ... > } > > As legacy device drivers does not have (b), there is no chance to > prevent loading a firmware at (c) for locked-down kernel. > > If you allow me to bring in yet another function, say > request_firmware_signable(), which should be used in place of (a) > for all verification-aware drivers, that would be fine. I really don't understand why you need a new function.  The request_firmware() eventually calls kernel_read_file_from_path(), which already calls the pre and post LSM hooks. IMA-appraisal is already on these hooks verifying the requested firmware's signature.  For systems with "lockdown" enabled, but without IMA-appraisal enabled, define a small, builtin LSM that sits on these LSM hooks and denies the unsigned firmware requests. Mimi > In this case, all the invocation of request_firmware() in legacy code > could be forced to fail in locked-down kernel. > > But I think that "signable" should be allowed to be combined with other > features of request_firmware variants like _(no)wait or _direct. > > -Takahiro AKASHI