Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4360316pxu; Tue, 20 Oct 2020 15:18:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxY0Zqo8Nt2qRvaLUob6y5Co2SZ5i8gR6PlTGTiMwJCOiLGRBUcawlTXYuQJiE7WDybBY4G X-Received: by 2002:a17:906:fad8:: with SMTP id lu24mr247317ejb.486.1603232291837; Tue, 20 Oct 2020 15:18:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603232291; cv=none; d=google.com; s=arc-20160816; b=SGtfmxyb4eZhv2pJjXzybQlMeak+YRb5VE/sify0B+re0SZi0GaxqELMVlUzk3taPA 3r7HNJpQXCJVXGOmO4kAgIXVXLInl2RkoMW1ysnSa7L5P4E2QYDJeqvKKO4MxQst52MW Hr43OMeHVNb1atNUbO9LWUak9zp/Bfdd2Tn6qnJP+rfMhZR86vfXkF+EtCI9Y4wjBSBX afsE1PXab0cq1prYl/ZrklIZNuxE1Tj8VehaSzMI7rCsdhzmpF14vWRujUP3G3BlDMYG Sklu2waV9rOdXJwNb8QCQULCBgKWf3jAo51ibb2F7UJwNQDUbAqb7g1LhdPemgX9y5vW iMgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=kukO0WBbLlSUxCRbmP3vWy8NBY6ekvIVnFUlXJDxWns=; b=KI6kHTmaTCyVRvBzmU5pLJ/Ni0+9qG4Di0SqGUNJ9NccCq8I5AHvl2OdPKpxi6Dy6u Xr70uJmW2dGDAlAtu/Lib+wUh825XTi688MFNZn79Tw0zvIN4BNQZdTwCbndeSndGQHY kFgt+zkr9H6oRj8RfPvOkCw2d2k0p/Grnp5oEDvtk+zXD/WJKWDD9219s4wkAVprP7MI f+OA8p4wzt4mMuImA78EhZqF5Lo34FpRSmYYceUAXPe5V7UI8SspzNTTGcYp3ScN+1Wi ntecnplIj2iAUd1YuKQRGXtmFCEkJ0PUGnQrrc6URm8HNOy4ARp67EUdXlfP3G1w9CIJ +m7Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y18si108774edw.556.2020.10.20.15.17.49; Tue, 20 Oct 2020 15:18:11 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392237AbgJTJAE (ORCPT + 99 others); Tue, 20 Oct 2020 05:00:04 -0400 Received: from mx2.suse.de ([195.135.220.15]:34926 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392231AbgJTJAC (ORCPT ); Tue, 20 Oct 2020 05:00:02 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id D0325B2D6; Tue, 20 Oct 2020 09:00:00 +0000 (UTC) Date: Tue, 20 Oct 2020 10:59:57 +0200 From: Joerg Roedel To: Arvind Sankar Cc: Joerg Roedel , x86@kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Kees Cook , Martin Radev , Tom Lendacky , linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/5] x86/boot/compressed/64: Check SEV encryption in 64-bit boot-path Message-ID: <20201020085957.GF9328@suse.de> References: <20201019151121.826-1-joro@8bytes.org> <20201019151121.826-4-joro@8bytes.org> <20201019170008.GA2701355@rani.riverdale.lan> <20201019175447.GA2720155@rani.riverdale.lan> <20201019203935.GG3635@8bytes.org> <20201019213106.GB2815942@rani.riverdale.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201019213106.GB2815942@rani.riverdale.lan> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 19, 2020 at 05:31:06PM -0400, Arvind Sankar wrote: > Is it possible to take advantage of this to make the check independent > of the original page tables? i.e. switch to the new pagetables, then > write into .data or .bss the opcodes for a function that does > movabs $imm64, %rax > jmp *%rdi // avoid using stack for the return > filling in the imm64 with the RDRAND value, and then try to execute it. > If the C-bit value is wrong, this will probably crash, and at any rate > shouldn't return with the correct value in %rax. That could work, but is not reliable. When the C bit is wrong the CPU would essentially execute random data, which could also be a valid instruction stream. A crash is not guaranteed. Regards, Joerg