Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp27773lqb; Tue, 4 Jun 2024 04:09:52 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV2jAwta6bMLW4LF5oB8qLkPdxONlo6ObRI7BO0f9l3UVcfEqI/HZX0uLAMLyhYAmw+CLY5GaS+TDEMb/uQaLV+qCyzosV0Sy7s2WB4Jg== X-Google-Smtp-Source: AGHT+IGPRHByNi8iSFr0WHFGG794wzFKEOBDR/viw3+3oeRJ/uxyk7NFMrEOMcy5CawRfTWDYbDc X-Received: by 2002:ac8:5d56:0:b0:440:25f2:4abe with SMTP id d75a77b69052e-44025f24eaamr7299021cf.60.1717499392231; Tue, 04 Jun 2024 04:09:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717499392; cv=pass; d=google.com; s=arc-20160816; b=MHLqa+5ctUA9V5jkg+yhQJFzQLC4L2+qcZmWM3WmCRINBvXuZLlABzirXNGsmsNvsb xwzqDcdGoInHUBWziRDR2OTt+dCcxN6Q5CdTPUJ0eLJmiEkShcERCBK5CiMPHqH9N53r wom4Dpg5wvC7h2uqfFEmzBpgQ6LddUHUCB5lxUCRWuBV9jnTjKqVf8QlVBBpdoBOt9cG 2h9Oc9mxcqJ6uH92U4prEjwZ46kO19QasOYx5TYzWfNPRH5vTi4VV0hT+BzjRAQuTGEX irOUKHt7vGT0m6LLAQxrL3N/jJSipX8Qq6fom+VhPfUtlnr0G3gy2T9T4Ql0z9NjKuwR bYag== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=g1CYcVwVGdFbPFSwugJtb1aKEbbUUrRo/R593DHF02Q=; fh=mw68oReqBN+cda8uib7DAxHd7JnkkjwsAFcZz5p1l+g=; b=Cn12TDUUa7AdrOC2xRPZXgHvPj8CkGdxCyAr8hHFFQFnNwhCZprlNZNLy0d7KKbrdH vThUHW19XZieY2fChOOycc1Y2OFLJG3DWCH9nQ9G7mI23/o8Da5t9XVibQao7/vCnYl4 TYvRh8Ug8aoYR8ogPEKMs1zCo35CjNdjjEmn4Ie6v35TD8QC5r4H11fMpHLXBGGfDNA4 DbNQYZ2vcxRYEYKxwXPmf6gTVNsNCQMe/9bQRgE0ioRvOHD4Iu90HYnLQfR1pkceU13N fyRlERAY7FR7SD1es58zbu51+cCqcmkV8sJzBk6ane0h7EAP3h1fth/PEP+dxoWmOqpB sMdw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dg+bcibE; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-200490-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200490-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-440287c7090si832371cf.309.2024.06.04.04.09.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 04:09:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-200490-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dg+bcibE; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-200490-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200490-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id EB5551C20CAE for ; Tue, 4 Jun 2024 11:09:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6F955145339; Tue, 4 Jun 2024 11:09:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="dg+bcibE" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 39D95145B02 for ; Tue, 4 Jun 2024 11:09:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717499385; cv=none; b=GBsyonXLjM+Euij1wukQGTzXjrRjNAVzTN44ARQquH36JfSse8eIkT+NeMkpEXeRcy2fGpsTXLK8q/61CATykXVXxbedfRLhZksYCvhYXhmJbyEgDjXhxhlzUEzFVi0Cz0vaLh777Nlo0nlnD5VoIRsCFnm0eG03vCxt62lFHmU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717499385; c=relaxed/simple; bh=lYunvJ6GmzDvX5Mv0MNwlWNQS4u2NfOKF2xbK6rhKRo=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=VX9/kncHIcYkUjbNQhdMJuc7lMvb3pfsml99AtD6+ywwY7eQaZ9kcdIAUY5GSlWh94j/LupRPO1qVNbgNXH7e877Ufd5vlWOJTHFoNy5Ffdc6Be4wcm1cB0TapsNn+rYlTOpk8Z7arMw38hjPq0in0xESov2LekAFP4e11Pu5jg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=dg+bcibE; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1717499383; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=g1CYcVwVGdFbPFSwugJtb1aKEbbUUrRo/R593DHF02Q=; b=dg+bcibE8locu5CjNq2G/Ce9zuSNbUIVbyXGcFXlLuk8vORcancxrd7fXBuH7ErGXeGIS5 Zw4ma5wTMX3uT6lkTEtrabBw3aVxFQGr4G+ZbtrKagXc7hXlWS8iw3J4egGplH2/pw3mVa 4XrqB7ZgFs7NeREYzbSc04tKg0bN/Os= Received: from mail-il1-f197.google.com (mail-il1-f197.google.com [209.85.166.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-645-KjJ2ed1JNEy0R-ZGN-0_aw-1; Tue, 04 Jun 2024 07:09:41 -0400 X-MC-Unique: KjJ2ed1JNEy0R-ZGN-0_aw-1 Received: by mail-il1-f197.google.com with SMTP id e9e14a558f8ab-374907a1f84so6601305ab.0 for ; Tue, 04 Jun 2024 04:09:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717499380; x=1718104180; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=g1CYcVwVGdFbPFSwugJtb1aKEbbUUrRo/R593DHF02Q=; b=DVOKtEvALQdz7D3LOs/P1YvBblyQFuafbddibn3Hv++RolhBZxkYZS+X6r6xmy9+Mt jRYE8YTdMkenPpRncaafWG5LZ1a/DaKzwjSjLAxE/fkY9iSFBEaSzzKVjmG8/hJq4R7V MYNitjNOTtxUYhXuzG7KT/j2QMU8I/zc7n/vmPc4Xq78wPlMNQaJfGkmY8RbqJZwPCfD YUisFUEVdVa40OriegNbkMoOvL8l/ZrUHRRSJTsafPO2xh+oLy9KzVFf1X0RvR1vGlzh uJ+W2ptgQ0oR/n3oEflefYEPxYON8xZVXvSnXZhrGy0Qj5BAkL6CndhzMjB62gzfdZyp ufWw== X-Forwarded-Encrypted: i=1; AJvYcCXMxMnt5t/U262KsmGJQFQbdHrZyKo2vb2aQK/UBD0PcQc+KQ76hW8wmJwmIwOwUTgjhRgx2OFDjRdu4DYd9iCPhS2hipcFHFRn7SU/ X-Gm-Message-State: AOJu0YwAoVBJ2uzW/Q/4KjKXuSGh+/FC1WfZOoPT6hkC4eMBvzAfi40d DuAlCd4TisRt0Pz7yd9Y3KbtItX1r82BO7+MOV88tNNQmCvpwHt9eOeKV43CZdz/KswNR6M/AB3 zY7aiHrzi4i04pBQfIDRs1GdAUe52vaeK0c30cXxdrZ/sPpnI8ZOhR0dGI4DqBiGb8xb0w+Jwgq WF4qFb0WXKjGkcftTMS7yfLz36FIBiqB/Q/Kq0 X-Received: by 2002:a05:6e02:1e08:b0:374:85bb:7592 with SMTP id e9e14a558f8ab-3748b8f5126mr139247975ab.0.1717499380382; Tue, 04 Jun 2024 04:09:40 -0700 (PDT) X-Received: by 2002:a05:6e02:1e08:b0:374:85bb:7592 with SMTP id e9e14a558f8ab-3748b8f5126mr139247745ab.0.1717499379997; Tue, 04 Jun 2024 04:09:39 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240528095522.509667-1-kirill.shutemov@linux.intel.com> <20240603085654.GBZl2FVjPd-gagt-UA@fat_crate.local> <8e3dfc15-f609-4839-85c7-1cc8cefd7acc@amd.com> <1ef36309-8d7f-447b-a54a-3cdafeccca64@amd.com> <20240603144639.GCZl3XTwmFHwi-KUZW@fat_crate.local> <20240604094358.GBZl7h3otTCYJ5rkkt@fat_crate.local> In-Reply-To: <20240604094358.GBZl7h3otTCYJ5rkkt@fat_crate.local> From: Dave Young Date: Tue, 4 Jun 2024 19:09:56 +0800 Message-ID: Subject: Re: [PATCH v7 1/3] efi/x86: Fix EFI memory map corruption with kexec To: Borislav Petkov Cc: Mike Rapoport , "Kalra, Ashish" , tglx@linutronix.de, mingo@redhat.com, dave.hansen@linux.intel.com, x86@kernel.org, rafael@kernel.org, hpa@zytor.com, peterz@infradead.org, adrian.hunter@intel.com, sathyanarayanan.kuppuswamy@linux.intel.com, jun.nakajima@intel.com, rick.p.edgecombe@intel.com, thomas.lendacky@amd.com, michael.roth@amd.com, seanjc@google.com, kai.huang@intel.com, bhe@redhat.com, kirill.shutemov@linux.intel.com, bdas@redhat.com, vkuznets@redhat.com, dionnaglaze@google.com, anisinha@redhat.com, jroedel@suse.de, ardb@kernel.org, kexec@lists.infradead.org, linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" On Tue, 4 Jun 2024 at 17:44, Borislav Petkov wrote: > > On Tue, Jun 04, 2024 at 09:23:58AM +0800, Dave Young wrote: > > kexec_in_progress is only for checking if this is in a reboot (kexec) code path. > > But eif_mem_reserve is only called during the boot time so checking > > kexec_in_progress is meaningless here. > > current_kernel_is_booted_via_kexec != is_rebooting_with_kexec > > That's exactly what I wanna check: whether this is a kexec-ed kernel. Or > is there a better helper for that? No general way to check if it is a kexec-ed kernel or not, for x86 one can check the efi_setup as Ashish's original patch did, as the kexec booted kernel (efi boot) will have efi setup_data passed in. Otherwise there is a type_of_loader field for x86 boot protocol, kexec-tools is 0x0D, the kexec_file_load also uses this. But adding the type_of_loader was only added in kexec-tools code when Yinghai worked on the kexec-tools bzImage64 load, so older kexec-tools will not set this field. Anyway the in-kernel kexec_file_load code for x86 added 0x0D as loader type from the beginning. Anyway there is not such a helper for all cases. > > -- > Regards/Gruss, > Boris. > > https://people.kernel.org/tglx/notes-about-netiquette >