Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1807398imm; Thu, 9 Aug 2018 02:14:54 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyn6NVYtEw+HXiGL0oJsaDyYBdJkIo6I1UAe2+MmLEpMqvli2C/cTMD3WouI1E4QiEuDwSt X-Received: by 2002:a62:778c:: with SMTP id s134-v6mr1493860pfc.189.1533806094231; Thu, 09 Aug 2018 02:14:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533806094; cv=none; d=google.com; s=arc-20160816; b=j1ZqDpH4moTHfM7cs7UGu6JACD9PKKQLTv6b3dMjxhovmu/gjAY1VwUDzlbQfD3ADy Yka06Gecj819Z293Bg1/PJLOjb9InTb+LwsGTWyHa/gJDxGO3BOmeL4ypULzFBlvLRoV DixriBoN7bvkxftP1SOqIFyz1qxstRuE60WzXSLZTG+wWnrLYrH7p8hxiYKRjWzJUS23 VrpJez++0K1dcQvyHuU+vnoQmHPdByYvcrzeonlNxvlLlahLXhsRl4qnZxFKVI5RO9r4 oYJ2OhBy8nJAOONEuoqrNHHqVyN+I2m8Mj/r4zI1g2G8OUiubczejpRAPTV6+RvSQSz+ F4gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=lODQjq7rPmnKXm3Qvwl29/nAvdMA9DaNfFtNUDRqgQ0=; b=n67DBww2hO6lUDKMJsQwDI+97+XYC9Qxy6Sr3gCHO5q/ALRsQut3QsZEaMYc7qcynu Xyr4zP6BYCyElKSpwlEZLQTWEVC3REXvB3wRthNdnDL1CE7dAKCIjOEph75YN21+6JmB RiCT1nUGi6aR891qa4OBtpIqZPTqvKCfyOzAASyHqM5LynOSVlJI1N5S5HWG3Zcj7wpK f4o2kAcNjWnlufdK0j8EQYlb6/Lri7V86nSzFJQVej+jaQ1rW+y79WkIrTWA7FkE5suS Iyqbkr8JPACXQoB1by/IkQmXopEWxoRUzg/f06wIR2G+3CxIDEoTPRPkH6QQFRa3Yf+o TlNA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z77-v6si6843307pff.100.2018.08.09.02.14.39; Thu, 09 Aug 2018 02:14:54 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730200AbeHILhi (ORCPT + 99 others); Thu, 9 Aug 2018 07:37:38 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:34316 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727579AbeHILhi (ORCPT ); Thu, 9 Aug 2018 07:37:38 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 57097818B123; Thu, 9 Aug 2018 09:13:42 +0000 (UTC) Received: from dhcp-128-65.nay.redhat.com (ovpn-12-178.pek2.redhat.com [10.72.12.178]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1371510AF9D5; Thu, 9 Aug 2018 09:13:37 +0000 (UTC) Date: Thu, 9 Aug 2018 17:13:33 +0800 From: Dave Young To: Mike Galbraith Cc: Baoquan He , Sebastian Andrzej Siewior , lkml , kexec@lists.infradead.org, linux-efi@vger.kernel.org, ard.biesheuvel@linaro.org Subject: Re: [PATCH] x86, kdump: Fix efi=noruntime NULL pointer dereference Message-ID: <20180809091333.GA8008@dhcp-128-65.nay.redhat.com> References: <1533737025.4936.3.camel@gmx.de> <20180809042153.GA4377@dhcp-128-65.nay.redhat.com> <1533800010.5087.71.camel@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1533800010.5087.71.camel@gmx.de> User-Agent: Mutt/1.9.5 (2018-04-13) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 09 Aug 2018 09:13:42 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 09 Aug 2018 09:13:42 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'dyoung@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/09/18 at 09:33am, Mike Galbraith wrote: > On Thu, 2018-08-09 at 12:21 +0800, Dave Young wrote: > > Hi Mike, > > > > Thanks for the patch! > > On 08/08/18 at 04:03pm, Mike Galbraith wrote: > > > When booting with efi=noruntime, we call efi_runtime_map_copy() while > > > loading the kdump kernel, and trip over a NULL efi.memmap.map. Avoid > > > that and a useless allocation when the only mapping we can use (1:1) > > > is not available. > > > > At first glance, efi_get_runtime_map_size should return 0 in case > > noruntime. > > What efi does internally at unmap time is to leave everything except > efi.mmap.map untouched, setting it to NULL and turning off EFI_MEMMAP, > rendering efi.mmap.map accessors useless/unsafe without first checking > EFI_MEMMAP. Probably the x86 efi_init should reset nr_map to zero in case runtime is disabled. But let's see how Ard thinks about this and cc linux-efi. As for efi_get_runtime_map_size, it was introduced for x86 kexec use. for copying runtime maps, so I think it is reasonable this function return zero in case no runtime. Thanks Dave