Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2296724pxm; Fri, 4 Mar 2022 13:21:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJziVosz32dS1nmgqNJNplktbE3lXNLRHIoVn8HqmHiFys27t4DsH+GWddMZ8prvC/Uq2yYO X-Received: by 2002:a65:6bc1:0:b0:374:35da:b175 with SMTP id e1-20020a656bc1000000b0037435dab175mr268027pgw.374.1646428860386; Fri, 04 Mar 2022 13:21:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646428860; cv=none; d=google.com; s=arc-20160816; b=JcaH+3wsSA08GbiLUIv8yrIT/4vCroexvoHEDLvNdT0fkaOEVP9aEYYsD1JsonXAov TRspP6vBpAFipsaIcf93vxlAUNqFezve4RERNNEwyQoeawIuEIFBEeZ7HDluI5n4OEDh 0fnes2keYc3YsvVLJ73V97GPhz6IdRO4ttSBK4GrZjtNsqO6JGBkVpzfjWsyg5qUhohK wxKXw/jJSgXbQ8WvbNMUy9InczODXJYZAvXPfMXVlCZ6DUMddY4epQrOLTCKAWfGkGBR N0AyjDI+efCUGobHLLTjgbtrY5UzaxqLXMY8IYQ/HdS7wJ0cw52aBpGB7mPhT8c1rFDu Arxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=jUDouBpgOJWYtyezvaL5EXft0NuB4nkuXXcHorGk0e4=; b=kMsc1XC6EJ1ixRlCAId+qPQkw9ZHQXsnvYErD04hQu64MyIq7uwJGuptTWUYj70eFB HIbtGe19cg5GRLJlggVMRxlzts+u3tetW68dt7BnmvElCs/owqc3/5ShV2+GNt5kIONa fV4m9hdARFzUpywInQLmOUt3quC4t9FDmpyD3mb/qT/FG/TsCRHgv8EKUX9T6n00deHt gUEClJR1EEJrEYV5nX51RBWcEtbLNjQbshwaCNHQbzZTO4HjAi044DTc4JJBnLjDydqy uL4SYVEX/TgSGUQfCc0HNoFrcl/lQYEgXaA+5+4vZzqujekdboXgrB4U24TyC53LqO5A AxZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=pq5RoNsx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id pc2-20020a17090b3b8200b001bf1c0ecb60si575456pjb.101.2022.03.04.13.20.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Mar 2022 13:21:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=pq5RoNsx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 304BC226C15; Fri, 4 Mar 2022 12:40:14 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229812AbiCDUkY (ORCPT + 99 others); Fri, 4 Mar 2022 15:40:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229648AbiCDUkX (ORCPT ); Fri, 4 Mar 2022 15:40:23 -0500 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F007224767 for ; Fri, 4 Mar 2022 12:39:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=jUDouBpgOJWYtyezvaL5EXft0NuB4nkuXXcHorGk0e4=; b=pq5RoNsxsAczkCwyHy0GenNvRp MUiX5MrxgZaOMdsVlZEtG0c1SMLR0kjaIBi1aGD2CUA0gtMsriC5CQPv4Arms7xkU13CIgn8NYDse ETyNUVgIvcQWFvT5ZtDvx/jqrJae/NWPky95/OUUWj1IhgMz3d5VQho6W5s3AjfNsmMEdt09Piq7M a3LthAqwJlnzRVYo/qzowisnFzcSN3aco2meDQlOInA1B0OUnN20JGIssEOrKNR/oc6gpXBu5C37P 8ioZbqnWLF0loOAovrKHQqu6QvUUv7MhnEFR98CFnhQXLHwQoowFkHZUiVZ+hiTxXxxUePHiDWx/l 58SGJBGg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nQEhk-00FJAI-0A; Fri, 04 Mar 2022 20:39:12 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id E308C98624E; Fri, 4 Mar 2022 21:39:10 +0100 (CET) Date: Fri, 4 Mar 2022 21:39:10 +0100 From: Peter Zijlstra To: Josh Poimboeuf Cc: x86@kernel.org, joao@overdrivepizza.com, hjl.tools@gmail.com, andrew.cooper3@citrix.com, linux-kernel@vger.kernel.org, ndesaulniers@google.com, keescook@chromium.org, samitolvanen@google.com, mark.rutland@arm.com, alyssa.milburn@intel.com, mbenes@suse.cz, rostedt@goodmis.org, mhiramat@kernel.org, alexei.starovoitov@gmail.com Subject: Re: [PATCH v3 22/39] x86/ibt: Add IBT feature, MSR and #CP handling Message-ID: <20220304203910.GR11184@worktop.programming.kicks-ass.net> References: <20220303112321.422525803@infradead.org> <20220303112826.299051388@infradead.org> <20220304180720.qkvvjtsbbnfugxxy@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220304180720.qkvvjtsbbnfugxxy@treble> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 04, 2022 at 10:07:20AM -0800, Josh Poimboeuf wrote: > On Thu, Mar 03, 2022 at 12:23:43PM +0100, Peter Zijlstra wrote: > > @@ -310,6 +311,7 @@ void machine_kexec(struct kimage *image) > > /* Interrupts aren't acceptable while we reboot */ > > local_irq_disable(); > > hw_breakpoint_disable(); > > + cet_disable(); > > > > if (image->preserve_context) { > > #ifdef CONFIG_X86_IO_APIC > > --- a/arch/x86/kernel/relocate_kernel_64.S > > +++ b/arch/x86/kernel/relocate_kernel_64.S > > @@ -115,6 +115,14 @@ SYM_CODE_START_LOCAL_NOALIGN(identity_ma > > pushq %rdx > > > > /* > > + * Clear X86_CR4_CET (if it was set) such that we can clear CR0_WP > > + * below. > > + */ > > + movq %cr4, %rax > > + andq $~(X86_CR4_CET), %rax > > + movq %rax, %cr4 > > + > > + /* > > * Set cr0 to a known state: > > * - Paging enabled > > * - Alignment check disabled > > This probably belongs in a separate patch... A x86/ibt,kexec patch has just been born...