Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp829608ybf; Thu, 27 Feb 2020 00:12:55 -0800 (PST) X-Google-Smtp-Source: APXvYqyMyObygrEiIUxo2pD5R3O1+zjg1XktiICoPlndEC0o2G9dYXOyjl4gTrep9lmtfV+3T1RV X-Received: by 2002:a05:6808:9ba:: with SMTP id e26mr2369502oig.81.1582791175641; Thu, 27 Feb 2020 00:12:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582791175; cv=none; d=google.com; s=arc-20160816; b=OnKSl4fJidyxIKXTgmbhhZIA3odEFIJKSTMfMB1iEhAEfJCrnS0TaP044789M5ZkNx 9TXXkucOLbaUq+A9/2xKHEYKrEjRBNjH6Z+DUqEbFkI1ZHdnyCtuxPLhPInS3wM2f0et lt5EAr2/+f1gf1UQVXn9hTYuObqJRXY0qwXMIVtkSaDFT+YHzh6+HYVPr1Rpr9wpG8q/ AR3tjztKhuJmops1wNRL9mxOe3ZMmu1ALNKRi3edvcPM5MISErmfBY0+Aeu1JFtdhrnF 8pbDqIo9/c0nyJq0eIMQUuU/5+g/zubZXzFr5HgevWxGqxE1rLhLmOlxXzQ5CVazjyQ2 m6Nw== 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:dkim-signature; bh=J70rt/SASdatn2Lg2thrZdSBV7BG+LKMP1dazjE3yCQ=; b=P87CHLqT8AWgSRyBTy8Wts3M5j34RBhY+PWWni0Yvx0LC0vqGiiiGQyxgQPl/5fCst n7kSynKpSho3bnBqN+eE4JhaHyDCoYskiaUayeu4VtLOxrU4U5nnEilhPpmFsR0dFRWy 1tB0r7U9vC4EOf4G/ahjE9MM0V7NhkeI0Ct8EYeDxvIVXCKejODqnnejbgooOm+xjb1T YjQZNi1tDk89UPSzR2G5581XjyZrLQrdjIkcq9Izz8QFdjn7b2hB6fGhEId7kSK+06sS t/TriaNrFnthOUvVJ40A5Lxnaxq+LP4+vj8NtedH5m4gFC3L6zVQ0amTj4mb0jmkMRNV qbJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=GpV0H2SJ; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j18si837019oii.42.2020.02.27.00.12.43; Thu, 27 Feb 2020 00:12:55 -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=fail header.i=@gmail.com header.s=20161025 header.b=GpV0H2SJ; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728483AbgB0IMe (ORCPT + 99 others); Thu, 27 Feb 2020 03:12:34 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:35041 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726999AbgB0IMe (ORCPT ); Thu, 27 Feb 2020 03:12:34 -0500 Received: by mail-wr1-f68.google.com with SMTP id w12so2139417wrt.2; Thu, 27 Feb 2020 00:12:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=J70rt/SASdatn2Lg2thrZdSBV7BG+LKMP1dazjE3yCQ=; b=GpV0H2SJkE/VG0/Sjyv1Ph+zb12roV9bLHMK+R9OPUeDx0uLxGYGD5f9zB+pBdbbHC UXCNbhNdEowLPwchddkt7HdjEogyvo16lzhpKc7lewXiJDaTogUWxXye3Syvb9sW15pV DAWQ6NifJE/0QOU6jnw6XWQd9v6wm1EaArj5yN42hm/Q/MTZj17IY4ujc6kl1VgPvfF9 e9hw6teZl5BZjGORRXaxr1EDxa/5XIP4pOVw7JVHn2wNzTFh+gRVDJF5RtYZlHhUzG3l kpsTvMI5CdrBmaWy1c0UvMrCYhKUuqKTLlcr+yqZFhSP02Agbiy3EoNEgRWrUqZnev4v w4ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=J70rt/SASdatn2Lg2thrZdSBV7BG+LKMP1dazjE3yCQ=; b=XEzAFOmaXQ/vBaoidepD9cciUEgkD9Pim1LSp8vrQ8tilVEfI5oWaa7rp9VHQa/Nxg DNXyD48PSs97POKSlqMkh4qk0FvSe39e4jFCLF6EMLorBQBvPkQX5P5kp1gFHUvlph6R LfVGnHQ9/CZ4IcIwwYW0ikuK2QRyq7TnCHAb+PRKyKvskJR62G0HhEVwelW3m9g1QI/j TosN4kyWzB24tUW0zH7a38AWD9VtdMI4p6qhGvRfIUczQXGu/ZXDtTD3XPBLU8muAKzg ilPXsZubp2b9uZaIFzKGYD4Tv8a1nJ9zHYYf/N3d5ImYKoXCK8CrU8Gu65qxQdP4CptW vPWw== X-Gm-Message-State: APjAAAWX1VOvjV28JA/+ZGLxv+DvCEAmeWtiTTs5ydTIKCEPTEkgsx6L lJdXzreeIdHr/RBnIhcv0+E= X-Received: by 2002:adf:edd0:: with SMTP id v16mr3529303wro.357.1582791152118; Thu, 27 Feb 2020 00:12:32 -0800 (PST) Received: from gmail.com (54033286.catv.pool.telekom.hu. [84.3.50.134]) by smtp.gmail.com with ESMTPSA id 18sm6488515wmf.1.2020.02.27.00.12.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2020 00:12:31 -0800 (PST) Date: Thu, 27 Feb 2020 09:12:29 +0100 From: Ingo Molnar To: Arvind Sankar Cc: Ard Biesheuvel , linux-efi@vger.kernel.org, Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org, Borislav Petkov Subject: Re: [PATCH v2 1/1] x86/boot/compressed: Fix reloading of GDTR post-relocation Message-ID: <20200227081229.GA29411@gmail.com> References: <20200226204515.2752095-1-nivedita@alum.mit.edu> <20200226230031.3011645-2-nivedita@alum.mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200226230031.3011645-2-nivedita@alum.mit.edu> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Arvind Sankar wrote: > Commit ef5a7b5eb13e ("efi/x86: Remove GDT setup from efi_main") > introduced GDT setup into the 32-bit kernel's startup_32, and reloads > the GDTR after relocating the kernel for paranoia's sake. > > Commit 32d009137a56 ("x86/boot: Reload GDTR after copying to the end of > the buffer") introduced a similar GDTR reload in the 64-bit kernel. > > The GDTR is adjusted by init_size - _end, however this may not be the > correct offset to apply if the kernel was loaded at a misaligned address > or below LOAD_PHYSICAL_ADDR, as in that case the decompression buffer > has an additional offset from the original load address. > > This should never happen for a conformant bootloader, but we're being > paranoid anyway, so just store the new GDT address in there instead of > adding any offsets, which is simpler as well. > > Signed-off-by: Arvind Sankar > Fixes: ef5a7b5eb13e ("efi/x86: Remove GDT setup from efi_main") > Fixes: 32d009137a56 ("x86/boot: Reload GDTR after copying to the end of the buffer") Have you or anyone else observed this condition practice, or have a suspicion that this could happen - or is this a mostly theoretical concern? Thanks, Ingo