Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp794316ybb; Fri, 3 Apr 2020 11:56:35 -0700 (PDT) X-Google-Smtp-Source: APiQypIvLGgJQMyJWJ8loIVYGJ/8kwsAp3FxvfWUvClTsv1S4lTbmEZGy//AcRrr4J01X1o50VdI X-Received: by 2002:aca:ad8f:: with SMTP id w137mr4022463oie.104.1585940195520; Fri, 03 Apr 2020 11:56:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585940195; cv=none; d=google.com; s=arc-20160816; b=0KJT5oCMTy0uACZM1rzVANNpdeLdsaJhT3KCsa1TTUCVmpKIBEzsqJN7U1SDcFhQK6 Q2gRpk7T/nZ2rWYDxQgmlNp9Eh24PFvKe94ULjPW6Ys0BjADk5hfhGGzq87E5a5zsy8Q aXaoYgIpy4c9ipzk/ttBvcDso8u0q/dql0WuBnzQX+TGWw0UpNPSMfEd4eBTm37v4ZEc XXBxZIXOyXnq8Hyo5aalIEwC465HbzpWnYo2jMrWDAAHwVUzIcSJTiMu69CCbuL9eg3s j+1v2n0K5A7QbLbGObwUjiwuZoynVFbG5d0mKuLYi0sv6Okk+Dga+qvKwEHcOQ/1xJwD 6DTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=VOUDg0bBkoskaJRW3yzegZK1ND5JaxsIvYadibCsTR0=; b=viMYCkJRuLrAyLThXyt7nWkNd+Cb0i148WWEbweCwhcczVqh91KqMoSgXFJaAXFUue YuRBmfTSS32QM3o9+3aRCiUPOSCYstnGnds58Hss7w/3YdlVswOFgkgs9H1Jw1nJz6bd fHw4UFWlovN/zwCWvas+JZm2gCESP5GukSI6Sv/GQTDbH9+4O4lK2JLO1zk8NBsO9+cx zpza0bkCk8z5Zjbpu1ispMWrTwegDw9wsjIVjSm7WREqBXAK/zqC3hg6VawEQSwIPba2 aV4VNExMcUFba4UxgOZE1GAXTymooM+BP16dMsD68RFbYNKCDVzHsVttBbc4CxZjRNsx AZvw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 141si3895729oii.44.2020.04.03.11.56.22; Fri, 03 Apr 2020 11:56:35 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728367AbgDCSyL (ORCPT + 99 others); Fri, 3 Apr 2020 14:54:11 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:40852 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727882AbgDCSyL (ORCPT ); Fri, 3 Apr 2020 14:54:11 -0400 Received: from p5de0bf0b.dip0.t-ipconnect.de ([93.224.191.11] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jKRRp-0002dL-MO; Fri, 03 Apr 2020 20:53:45 +0200 Received: by nanos.tec.linutronix.de (Postfix, from userid 1000) id EEDC6103A01; Fri, 3 Apr 2020 20:53:44 +0200 (CEST) From: Thomas Gleixner To: Peter Zijlstra , Jessica Yu Cc: Rasmus Villemoes , LKML , x86@kernel.org, "Kenneth R. Crudup" , Paolo Bonzini , Fenghua Yu , Xiaoyao Li , Nadav Amit , Thomas Hellstrom , Sean Christopherson , Tony Luck , Steven Rostedt , Greg Kroah-Hartman , jannh@google.com, keescook@chromium.org, vbox-dev@virtualbox.org Subject: Re: [patch 1/2] x86,module: Detect VMX modules and disable Split-Lock-Detect In-Reply-To: <20200403152158.GR20730@hirez.programming.kicks-ass.net> References: <20200402123258.895628824@linutronix.de> <20200402124205.242674296@linutronix.de> <20200403143459.GA30424@linux-8ccs> <20200403152158.GR20730@hirez.programming.kicks-ass.net> Date: Fri, 03 Apr 2020 20:53:44 +0200 Message-ID: <87o8s8l7t3.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Peter Zijlstra writes: > On Fri, Apr 03, 2020 at 04:35:00PM +0200, Jessica Yu wrote: >> +++ Rasmus Villemoes [03/04/20 01:42 +0200]: >> > On 02/04/2020 14.32, Thomas Gleixner wrote: >> > > From: Peter Zijlstra >> > > >> > > It turns out that with Split-Lock-Detect enabled (default) any VMX >> > > hypervisor needs at least a little modification in order to not blindly >> > > inject the #AC into the guest without the guest being ready for it. >> > > >> > > Since there is no telling which module implements a hypervisor, scan the >> > > module text and look for the VMLAUNCH instruction. If found, the module is >> > > assumed to be a hypervisor of some sort and SLD is disabled. >> > >> > How long does that scan take/add to module load time? Would it make >> > sense to exempt in-tree modules? >> > >> > Rasmus >> >> I second Rasmus's question. It seems rather unfortunate that we have >> to do this text scan for every module load on x86, when it doesn't >> apply to the majority of them, and only to a handful of out-of-tree >> hypervisor modules (assuming kvm is taken care of already). >> >> I wonder if it would make sense then to limit the text scans to just >> out-of-tree modules (i.e., missing the intree modinfo flag)? > > It would; didn't know there was one. But that still would not make it complete. I was staring at virtualbox today after Jann pointed out that this sucker does complete backwards things. The kernel driver does not contain any VM* instructions at all. The actual hypervisor code is built as a separate binary and somehow loaded into the kernel with their own magic fixup of relocations and function linking. This "design" probably comes from the original virtualbox implementation which circumvented GPL that way. TBH, I don't care if we wreckage virtualbox simply because that thing is already a complete and utter trainwreck violating taste and common sense in any possible way. Just for illustration: - It installs preempt notifiers and the first thing in the callback function is to issue 'stac()'! - There is quite some other horrible code in there which fiddles in the guts of the kernel just because it can. - Conditionals in release code which check stuff like VBOX_WITH_TEXT_MODMEM_HACK, VBOX_WITH_EFLAGS_AC_SET_IN_VBOXDRV, VBOX_WITH_NON_PROD_HACK_FOR_PERF_STACKS along with the most absurd hacks ever. If you feel the need to look yourself, please use your eyecancer protection gear. Can someone at Oracle please make sure, that this monstrosity gets shred in pieces? Enough vented, but that still does not solve the SLD problem in any sensible way. Thanks, tglx