Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3478972imu; Fri, 30 Nov 2018 00:38:52 -0800 (PST) X-Google-Smtp-Source: AFSGD/XW2iQO++nG6raKbuYLw3oOKxwhRus2+zvUq14HagaEMbt0IRkD9iDxpCLqE6Faf2faQiUx X-Received: by 2002:a63:42c1:: with SMTP id p184mr4058398pga.202.1543567132171; Fri, 30 Nov 2018 00:38:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543567132; cv=none; d=google.com; s=arc-20160816; b=Q7he7c92aDppyRA1NPbyCuxPe8UgO1NonTuZyitXsLp+/5e/3LGa7GNuE2p1o44mFq y37xitgv0cc+H1FI1fy9xsK1/Rn21Cta1o9sbW5D/Stnq1igStMdEJvp6k538OVfdnKI US3zwjQZPj0spZRcSPu/URs/nX97zuY9ewSAPUFWi95iRmiWI7gIu/fbjI0r3+TBOxoG ZJMubNPDYUf/82bzdTTf1uEfcJUBnhkkxdbrRa9BpO89CY9ht7CkFkBo3eL8lrFatLpP PStLdA9rP+lMA0Py8Ab9xAYSob56OTzsIdNs/ZmgFLpijtqzYwQ8S2V06fgSDRtrUQ/F jRjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=/h8BiSmw8To6VjvcNvZZ2C/1DCYc8B6gk98cB0p8pQA=; b=fUeZSGWvpBB2HBJzwGmqbb03Qq62MPPnjGvZ6NjMttigFKZTwxHEv9FT7fJvUrMsim xcZjubXZRZXxMNKPoPxGPO0t3xvpHMPDVs5LpiNHTwRMCRtKi26HSe3eOYxje3SrrFwm rEZSghMCEC9uMidZkYI67N1Zzqbc1DPjLcgOFoUo2e5P1mzcQRjzWvbZMCCkAuSTsdg0 jPNQx8bsilLTUTeooFKNq4onXi6/WP1MCi2crZ0co6/WWlmWLIYSYTETgtq/rRb6ATLM oxxeBTVxJxOxFSqvEKVP98LsCkv57vJGZg1wQh00WbMT/n6UTO+V2BAouduhrmWUKf0t cR+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UYcbtplB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y6si4320467plr.186.2018.11.30.00.38.37; Fri, 30 Nov 2018 00:38:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UYcbtplB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726948AbeK3Tq3 (ORCPT + 99 others); Fri, 30 Nov 2018 14:46:29 -0500 Received: from mail-io1-f65.google.com ([209.85.166.65]:43526 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726551AbeK3Tq3 (ORCPT ); Fri, 30 Nov 2018 14:46:29 -0500 Received: by mail-io1-f65.google.com with SMTP id g8so3862383iop.10 for ; Fri, 30 Nov 2018 00:37:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/h8BiSmw8To6VjvcNvZZ2C/1DCYc8B6gk98cB0p8pQA=; b=UYcbtplBNk4CiAS5gj/ZNATX0PaUxTu22jnonznqBwprQmY4XUTVV/CYTk+TVsG4IA LdWz6TUXvQBF927eh0ZXTr4COGCME5To1kP8ueoz7L1h3cOh/dMzoszif3Al3ZN2zZa5 VkaSPGO542W9YuFLS5DBiqhdAgCpHNNzMoIHU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/h8BiSmw8To6VjvcNvZZ2C/1DCYc8B6gk98cB0p8pQA=; b=tAh20SrDhnYNrrsiyIMMddyCyQAbOHU4MDyhT6SJZEofFCkf97RkS8JBaYsxYVMtQn uHbkVdlmxrWWApTRizdrCfB1ZAXkPAdzFRnsMWXzmCuLnlkkZ12vybEjfS85vUCLMT0h 2xLUdY0BvdocFgLV9cwCV0MtLSvN5C/RpbxnVCJYBbthGtolAlWNdkbHxG6u7UmM/pvM xidb8MwsxEej6ztgwBjDwRssL2Cimqb5yAzpaX6AKwcCV8ePEXolylffA6AxO+omxXdX GpwmlfBMx02UeVpBI9pyuzZMSM2HclVI2+YPWAqs6w0km/pgRvCzx9xAhcVUvmkRZs1/ d1jA== X-Gm-Message-State: AA+aEWaSPO4O081I5xskxZaIollwqkZhiu26TTxb9/U6ljSZur9BB8z+ Wpv79L8naDt1o2aANUceCqQOal8cbAGA7S59/rMxqg== X-Received: by 2002:a6b:7a46:: with SMTP id k6mr4154483iop.60.1543567075753; Fri, 30 Nov 2018 00:37:55 -0800 (PST) MIME-Version: 1.0 References: <20181129171230.18699-1-ard.biesheuvel@linaro.org> <20181129171230.18699-9-ard.biesheuvel@linaro.org> <20181130081159.GD16084@gmail.com> In-Reply-To: <20181130081159.GD16084@gmail.com> From: Ard Biesheuvel Date: Fri, 30 Nov 2018 09:37:44 +0100 Message-ID: Subject: Re: [PATCH 08/11] firmware: efi: add NULL pointer checks in efivars api functions To: Ingo Molnar Cc: linux-efi , Thomas Gleixner , Linux Kernel Mailing List , Andy Lutomirski , Arend Van Spriel , Bhupesh Sharma , Borislav Petkov , Dave Hansen , Eric Snowberg , Hans de Goede , Joe Perches , Jon Hunter , Julien Thierry , Marc Zyngier , Nathan Chancellor , Peter Zijlstra , "Prakhya, Sai Praneeth" , Sedat Dilek , YiFei Zhu Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 30 Nov 2018 at 09:12, Ingo Molnar wrote: > > > * Ard Biesheuvel wrote: > > > From: Arend van Spriel > > > > Since commit: > > > > ce2e6db554fa ("brcmfmac: Add support for getting nvram contents from > > EFI variables") > > This commit ID is not upstream AFAICS. Which tree is it from? Mentioning > non-upstream sha1's is discouraged in changelogs, as there's no guarantee > that the sha1 will make it upstream. > This is a commit ID from Arend's own tree which is pulled into -next, so I assumed that he'd only include commit IDs like this if they are stable. In any case, the fix itself is rather obvious, so much of the context provided by the commit log could be summarized as '__efivars may be NULL so check for that before you dereference it' > > we have a device driver accessing the efivars API. Several functions in > > the efivars API assume __efivars is set, i.e., that they will be accessed > > only after efivars_register() has been called. However, the following NULL > > pointer access was reported calling efivar_entry_size() from the brcmfmac > > device driver. > > > > Unable to handle kernel NULL pointer dereference at virtual address 00000008 > > pgd = 60bfa5f1 > > [00000008] *pgd=00000000 > > Internal error: Oops: 5 [#1] SMP ARM > > ... > > Hardware name: NVIDIA Tegra SoC (Flattened Device Tree) > > Workqueue: events request_firmware_work_func > > PC is at efivar_entry_size+0x28/0x90 > > LR is at brcmf_fw_complete_request+0x3f8/0x8d4 [brcmfmac] > > pc : [] lr : [] psr: a00d0113 > > sp : ede7fe28 ip : ee983410 fp : c1787f30 > > r10: 00000000 r9 : 00000000 r8 : bf2b2258 > > r7 : ee983000 r6 : c1604c48 r5 : ede7fe88 r4 : edf337c0 > > r3 : 00000000 r2 : 00000000 r1 : ede7fe88 r0 : c17712c8 > > Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none > > Control: 10c5387d Table: ad16804a DAC: 00000051 > > > > Disassembly showed that the local static variable __efivars is NULL, > > which is not entirely unexpected given that it is a non-EFI platform. > > So add a NULL pointer check to efivar_entry_size(), and to related > > functions while at it. In efivars_register() a couple of sanity checks > > are added as well. > > > > Cc: Hans de Goede > > Reported-by: Jon Hunter > > Signed-off-by: Arend van Spriel > > Signed-off-by: Ard Biesheuvel > > Will that new commit be backported? If yes I suppose we could mark this > fix -stable too? If not then it's fine for a v4.21 merge. > That commit is not -stable material at all, as far as I can tell.