From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 041FCC433DF for ; Tue, 20 Oct 2020 09:00:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A2749222C8 for ; Tue, 20 Oct 2020 09:00:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392241AbgJTJAF (ORCPT ); Tue, 20 Oct 2020 05:00:05 -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