Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2357513ybh; Fri, 24 Jul 2020 10:44:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbmPY93zT+Su3US/VkWAuHrB3t0Anx1oXJPTOGSVSMQ5lyM5hwovVwVTM3Xm2zFQVGw2E5 X-Received: by 2002:a50:ee8a:: with SMTP id f10mr9774855edr.383.1595612661410; Fri, 24 Jul 2020 10:44:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595612661; cv=none; d=google.com; s=arc-20160816; b=X3ub0mpJlbrV367/YwOTMyszjnGRRwU6b9EPwRkPDjXfaijgKd0a7aLK6OFavK6FY7 bzNI7DPCF97yWANkrpK2gyw87Vwqs826eGzCr2SQ2Qn3HiFbkfTb4NNwsGQ6Gr1qWcX1 nHtcmyPQLdBMFfjkzEJ+C48NBBeXx08fpAP/7NUhZKJar1nxGjjwnTppJBZBDQzFxlf1 z/gd08rni+i4hbDtnFitPt2uxIMXsz6VFoOc/K27CPfehnAPg4ilmkM9hz8EoGo2K0XQ HwLcfvF5GRCkkICSxW0ZXj1EgiumtjdfWuvEYgSifOXHHWWLYx+fDBu9duOc5xqbj1aF QtgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=aaWhQPcSW3bE7rs+REjPzCquXYXIKucEYvw8vc6PND4=; b=aUrv1/eeOfRnNlatnRGijTw+pCW6gRai4vq5WhCMcrN4kA/kF5ArhsgJuY/2GjlrjR vRHL0E+F5H6pgl2gBsCNQBJ6P1ma3GFXYJxmVtr3T808CzAYxbE0ZbWd1siY3VnVLIGE gAKwyBu3RCqhUaJen4PCtck57W7ys9/1l2bgP5zqbujZI7GlaIgLdK0YCRTs8lm8Z4Rw dV5UQGAQyG7+2Y6PSwAmsEUKCvwP9CdDHLzAbAh6/ecn99UnVNMJJEM8bpLjFeEPuIHs PQJrykzS+vB8tmGWxt+EwthoE5z9ehsCdQtNuKkq4m1iVcB2xT7NXntG11OKpBhbsT2D kLbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=GhnZGzFM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p8si952686ejf.352.2020.07.24.10.43.59; Fri, 24 Jul 2020 10:44:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=GhnZGzFM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726895AbgGXRnw (ORCPT + 99 others); Fri, 24 Jul 2020 13:43:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726593AbgGXRnw (ORCPT ); Fri, 24 Jul 2020 13:43:52 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43B5FC0619E4 for ; Fri, 24 Jul 2020 10:43:52 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id o13so5697133pgf.0 for ; Fri, 24 Jul 2020 10:43:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=aaWhQPcSW3bE7rs+REjPzCquXYXIKucEYvw8vc6PND4=; b=GhnZGzFM9H5MZ1G8rKO9LRqg8IW3cO1w1wH/BXcQWPilam/lAlnkxGLmZrE9vV4u52 K4DmyhZRZKHcPv0GEdH0K9KyLtYBYiIg8Y7BKPfji1nPew2uVmw2Cu0KJWgn0+QrhCy6 J33pUtSnzj+iojGpXI+KpUUcr8S8iTr9Qn8UQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=aaWhQPcSW3bE7rs+REjPzCquXYXIKucEYvw8vc6PND4=; b=tozqq9mUKJ4uKxe4DiHwmbKXW1qPJDbKHQO59PmzNnWIIJDE2Deo1fs7nduimMN3Fv gTr1kysNt+0Eb3KfoNYX8MN1z7uj8e6cDrbRlyu361UOg0c55o6SJEdDHTDlMOgGuXXa sQM50hiKpnPQNjjHx0LQ+EjfjAFLGCb0ru3KDXwT54lXAB6WBtoGTJRZkS+72PQEeT6v +88FDHYTDP/TvLMKuMR7ge+k/gUIr1lo0DKmgTFG6zQ0ly9YoeTaeyLXp33nS9rqi36S O4T3h8BFiXh9v0kTFSV8qKwt8CRLV8k5PmdM/LpG6acg4NyAEEo2Hx3bQyG67nNZg+yW C5bw== X-Gm-Message-State: AOAM531Aj+Q2Z62xqQv0ofebAdJ+k0x2TUEPgA5+p8FcTw1ALy/z5Eby hwYnuy6jsBXl0bfKlwHcxQnLLA== X-Received: by 2002:aa7:8096:: with SMTP id v22mr10436021pff.132.1595612631874; Fri, 24 Jul 2020 10:43:51 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id o136sm6832398pfg.24.2020.07.24.10.43.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jul 2020 10:43:51 -0700 (PDT) Date: Fri, 24 Jul 2020 10:43:50 -0700 From: Kees Cook To: Joerg Roedel Cc: x86@kernel.org, Joerg Roedel , hpa@zytor.com, Andy Lutomirski , Dave Hansen , Peter Zijlstra , Jiri Slaby , Dan Williams , Tom Lendacky , Juergen Gross , David Rientjes , Cfir Cohen , Erdem Aktas , Masami Hiramatsu , Mike Stunes , Sean Christopherson , Martin Radev , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: Re: [PATCH v5 11/75] x86/boot/compressed/64: Disable red-zone usage Message-ID: <202007241043.654ABB2@keescook> References: <20200724160336.5435-1-joro@8bytes.org> <20200724160336.5435-12-joro@8bytes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200724160336.5435-12-joro@8bytes.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 24, 2020 at 06:02:32PM +0200, Joerg Roedel wrote: > From: Joerg Roedel > > The x86-64 ABI defines a red-zone on the stack: > > The 128-byte area beyond the location pointed to by %rsp is considered > to be reserved and shall not be modified by signal or interrupt > handlers. Therefore, functions may use this area for temporary data > that is not needed across function calls. In particular, leaf > functions may use this area for their entire stack frame, rather than > adjusting the stack pointer in the prologue and epilogue. This area is > known as the red zone. > > This is not compatible with exception handling, because the IRET frame > written by the hardware at the stack pointer and the functions to handle > the exception will overwrite the temporary variables of the interrupted > function, causing undefined behavior. So disable red-zones for the > pre-decompression boot code. > > Signed-off-by: Joerg Roedel Reviewed-by: Kees Cook -- Kees Cook