Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp442752yba; Fri, 26 Apr 2019 02:53:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqyDnv7pyvX8jZ6QW7J0dzp8523DtgMosC+LjfyeY27rw8RyK2xKie9RXIyEz/qPDNtrocUT X-Received: by 2002:a17:902:9b92:: with SMTP id y18mr36635344plp.187.1556272437549; Fri, 26 Apr 2019 02:53:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556272437; cv=none; d=google.com; s=arc-20160816; b=GhMnwZgtDjopZZvCx3GsGOTTXLNWsTNcb6JrQ2S5jH7QuFMmfygjgvlJvKwfKurBeh kMiKomtTWLS5Bkv/+f6UaBydu0IPq1PCv131xp23ixwqFkkPnbpGvvSPkxmDk+yCp3wG TiwLFRurVkP//0R4xSg4GlS+4r5iwRDLCvriAOfzcKot3xhuBttQRNHbXRuuJNr7SicS urtndnPFSBQqQXOPDMP2mTuirLyNyK6+HUJpYV5xhdgflHRdt6Scbmfs2OoSsRiJ5xo/ WtsNE7QGOP9iftajKh4/lUoT5vTQ4MFvc2LWGEFkhODZXSFdJFiincI9K/C/q/6E96Z9 YJlQ== 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; bh=J+4D9lONrrssGmxU3SIdnQ91HgdtWaEHeNyVweSpG1Y=; b=dt386ltBfZ8A+TYnHNeSE16xNoY1Yly3I7UsNBtNct2F2Omo7zC8Vqr20lnqEVtivR RxFsaxW4rgI+uecUlxg4tHX/ls98ArGj6XOqTcn6zo2NuE3RFlqbPW9WPXA9U+WjqjGm 2Y2a5SqLx6f6wpJ5MJ0eHjnGDH9lqGS3X1sXiDJR62Xmj8RCDBcFTax9K01uE8W5XBo/ 8EnyTGA4plFNRWzG9c+rZ/QK7TOEcQIPB9AUhxyN6jKq8vg1A8df+9aBV/r9J3rsEu8C /SHepBxJCGkTYY8OcwhbjYs5SjEk2qQ2KiBXoDdHeDiCekKK13cYUnQICDBgYVWXLAK5 eQCw== 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 w8si2082273plz.301.2019.04.26.02.53.42; Fri, 26 Apr 2019 02:53:57 -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 S1726392AbfDZJvl (ORCPT + 99 others); Fri, 26 Apr 2019 05:51:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55025 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725944AbfDZJvk (ORCPT ); Fri, 26 Apr 2019 05:51:40 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A4092285BE; Fri, 26 Apr 2019 09:51:40 +0000 (UTC) Received: from localhost (ovpn-12-17.pek2.redhat.com [10.72.12.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7AA9010018E0; Fri, 26 Apr 2019 09:51:37 +0000 (UTC) Date: Fri, 26 Apr 2019 17:51:34 +0800 From: Baoquan He To: Borislav Petkov Cc: "H. Peter Anvin" , Junichi Nomura , dyoung@redhat.com, Kairui Song , Thomas Gleixner , linux-kernel@vger.kernel.org, Chao Fan , "x86@kernel.org" , "kexec@lists.infradead.org" Subject: Re: [RFC PATCH] kexec, x86/boot: map systab region in identity mapping before accessing it Message-ID: <20190426095134.GP3584@localhost.localdomain> References: <20190419101733.GA10324@zn.tnic> <20190419105014.GE11060@MiWiFi-R3L-srv> <20190419112801.GB10324@zn.tnic> <20190419113621.GD10324@zn.tnic> <20190422143346.GD3584@localhost.localdomain> <20190422151723.GD21457@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190422151723.GD21457@zn.tnic> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 26 Apr 2019 09:51:40 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/22/19 at 05:17pm, Borislav Petkov wrote: > + hpa > > On Mon, Apr 22, 2019 at 10:33:46PM +0800, Baoquan He wrote: > > On 04/19/19 at 01:36pm, Borislav Petkov wrote: > > > On Fri, Apr 19, 2019 at 01:28:01PM +0200, Borislav Petkov wrote: > > > > Read again what I said: "should all be passed through boot_params". > > > > Which means, boot_params should be extended with a field of a flag to > > > > say: "this is a kexec'ed kernel". > > > > > > And by that I mean similar to the XLF_EFI_KEXEC mechanism. The first > > > kernel or kexec(1) should prepare the info needed by the kexec'ed > > > kernel. > > > > We have set the loader type to '0x0D << 4' for kexec specifically, in both > > kexec_load and kexec_file_load. We can check this to identify if it's > > kexec-ed kernel or not. > > > > Update patch with it? > > > > static void *bzImage64_load(struct kimage *image, char *kernel, > > unsigned long kernel_len, char *initrd, > > unsigned long initrd_len, char *cmdline, > > unsigned long cmdline_len) > > { > > > > ... > > /* bootloader info. Do we need a separate ID for kexec kernel loader? */ > > params->hdr.type_of_loader = 0x0D << 4; > > That's already documented in Documentation/x86/boot.txt > > Field name: type_of_loader > Type: write (obligatory) > Offset/size: 0x210/1 > Protocol: 2.00+ > > ... > > D kexec-tools > > And yes, the question in the code is still valid: do we need a separate ID. > > I'd say no and we'll simply call 0xD all kernels loaded using a > kexec-type syscall. Yes, agree. Time has proved we don't need a separate ID, just 0x0D is fine for both kexec/kdump. We can clear it away now. I can make a patch to add a bit into xloadflags, to indicate that this is kexec-ed kernel. It can help to differentiate kexec-ed kernel from kdump kernel. As we know, kdump kernel is recognized with /proc/vmcore existence. While during kernel initialization stage, or /proc/vmcore is not validated in some cases, the adding bit may help. Thoughts? Thanks Baoquan