From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752948AbdKJNpW (ORCPT ); Fri, 10 Nov 2017 08:45:22 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:52626 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752257AbdKJNpU (ORCPT ); Fri, 10 Nov 2017 08:45:20 -0500 Subject: Re: Firmware signing -- Re: [PATCH 00/27] security, efi: Add kernel lockdown From: Mimi Zohar To: "Luis R. Rodriguez" , "AKASHI, Takahiro" , Linus Torvalds Cc: Greg Kroah-Hartman , Jan Blunck , Julia Lawall , David Howells , Andy Lutomirski , David Woodhouse , Marcus Meissner , Gary Lin , Josh Triplett , James Bottomley , Peter Jones , linux-security-module@vger.kernel.org, gnomes@lxorguk.ukuu.org.uk, linux-efi , linux-kernel@vger.kernel.org, Matthew Garrett Date: Fri, 10 Nov 2017 08:45:06 -0500 In-Reply-To: <20171110014641.GO22894@wotan.suse.de> 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> <20171110014641.GO22894@wotan.suse.de> 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: 7bit X-TM-AS-GCONF: 00 x-cbid: 17111013-0008-0000-0000-000004A9DD9C X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17111013-0009-0000-0000-00001E3C8388 Message-Id: <1510321506.3359.42.camel@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-11-10_06:,, 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-1711100192 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2017-11-10 at 02:46 +0100, Luis R. Rodriguez wrote: > On Thu, Nov 09, 2017 at 10:48:43AM +0900, AKASHI, Takahiro wrote: > > On Wed, Nov 08, 2017 at 08:46:26PM +0100, Luis R. Rodriguez wrote: > > > 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. > > Ah, I think your example requires another piece of code to make it clearer. > Here is an example legacy driver: > > my_legacy_deviceB_init() { > err = request_firmware(&fw, "deviceB"); <--- (a) > if (err) > goto err_request; > > load_fw_to_deviceA(fw); <--- (c) > ... > } > > There is no verify_firmware() call here, and as such the approach Linus > suggested a while ago cannot possibly fail on a "locked down kernel", unless > *very* legacy API call gets a verify_firmware() sprinkled. > > One sensible thing to say here is then that all request_firmware() calls should > just fail on a "locked down kernel", however if this were true then even calls > which *did* issue a subsequent verify_firmware() would fail earlier therefore > making verify_firmware() pointless on new drivers. As long as these "*very* legacy API calls", are calling kernel_read_file_from_path() to read the firmware, there shouldn't be a problem. Mimi