Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1205447ybg; Tue, 2 Jun 2020 04:11:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxWK0ShtpWPmhT/4YLl7U5NupdhDbQlhfVEuGNLetPfOBktZ5W+rIaA58H8J2H5P7NaJcr X-Received: by 2002:a17:906:2503:: with SMTP id i3mr23791553ejb.293.1591096260763; Tue, 02 Jun 2020 04:11:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591096260; cv=none; d=google.com; s=arc-20160816; b=PPAtqtPQAEPT+1JWVCw/o4hj15I5hKOVcKhqApUYP22QvG9t4GDKxLwT8irTp9ahSO MWU/cq3gE209loFqV0M7/7IXfzYc0HRvc/AcNW1PUAijXIDQo+/Q7t9v7sOAELzwMvcg EL16Nd0DqxCxLhhTL4wuGMJO740a2LvIQ8LkJeyFOTO1zi+GjZUBzqOjgi1Ck+ioTJiL +WvXP7s1fmpEljussxRVAZ87nDQk+cKhRHVLyFtzZLz7cst0jVkMMta5aF4Ac2gRT4qU 1G6TfDxyUlSBw4+PQwqgCkZEP8JfYcdT5umbH2JeJmQuzPdLXoEJ+PHsFbUbQReF0CGU sWgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=HWZXAjp3jQnUrBiMsLUN62fCNiuVDBGdpDfzFJL1WWQ=; b=NSDzbVrAid1YnWya98C2AVp4q0u62dJy5oy2GM055QVuJkk6Fc0bAcEs4Ww0MLO52h u0jhsUbyXdTWLeYiaGTpAIrjrriaE5T1mMYqSBXRT/fuV7ib1BRPnmw5mu1r0XsOxz8P 7AbSjoDNkqqsU1FvTpK2t6iItrDAWwUINZ/FsT38sZO63bsLdn6Op1AvqfZ4efgKUQYr 4E/yogEOheG4Yc/xvXE69JBee55rXqTTkl7mTZAtEdMIow5RqRQ2h+3ijFV+yYzU6YrH vPY5zkJjw4Bhc+jeyhnAFQqlZ8P4eecWIeDOWmDB9O8enAoTW6HXefwgYFZIY/TYFByv nD3g== 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 j8si1202038edp.99.2020.06.02.04.10.37; Tue, 02 Jun 2020 04:11:00 -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 S1726496AbgFBLFy (ORCPT + 99 others); Tue, 2 Jun 2020 07:05:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725921AbgFBLFx (ORCPT ); Tue, 2 Jun 2020 07:05:53 -0400 X-Greylist: delayed 2144 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 02 Jun 2020 04:05:53 PDT Received: from mail.kapsi.fi (mail.kapsi.fi [IPv6:2001:67c:1be8::25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 793BEC061A0E for ; Tue, 2 Jun 2020 04:05:53 -0700 (PDT) Received: from kapsi.fi ([2001:67c:1be8::11] helo=lakka.kapsi.fi) by mail.kapsi.fi with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1jg4B5-0001K0-OB; Tue, 02 Jun 2020 13:29:52 +0300 Received: from jpa by lakka.kapsi.fi with local (Exim 4.92) (envelope-from ) id 1jg4B5-00021k-MV; Tue, 02 Jun 2020 13:29:51 +0300 Date: Tue, 2 Jun 2020 13:29:51 +0300 From: Petteri Aimonen To: Borislav Petkov Cc: Andy Lutomirski , Dave Hansen , "H. Peter Anvin" , x86-ml , lkml Subject: Re: [PATCH] arch/x86: reset MXCSR to default in kernel_fpu_begin() Message-ID: <20200602102951.GE17423@lakka.kapsi.fi> References: <20200602101119.GA11634@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200602101119.GA11634@zn.tnic> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspam-Score: 1.2 (+) X-Rspam-Report: Action: no action Symbol: RCVD_TLS_LAST(0.00) Symbol: ARC_NA(0.00) Symbol: FROM_HAS_DN(0.00) Symbol: TO_MATCH_ENVRCPT_ALL(0.00) Symbol: MIME_GOOD(-0.10) Symbol: DMARC_NA(0.00) Symbol: AUTH_NA(1.00) Symbol: RCPT_COUNT_FIVE(0.00) Symbol: TO_DN_ALL(0.00) Symbol: NEURAL_HAM(-0.00) Symbol: R_SPF_NA(0.00) Symbol: FORGED_SENDER(0.30) Symbol: R_DKIM_NA(0.00) Symbol: MIME_TRACE(0.00) Symbol: ASN(0.00) Symbol: FROM_NEQ_ENVFROM(0.00) Symbol: RCVD_COUNT_TWO(0.00) Message-ID: 20200602102951.GE17423@lakka.kapsi.fi X-Rspam-Bar: + X-SA-Exim-Connect-IP: 2001:67c:1be8::11 X-SA-Exim-Mail-From: jpa@lakka.kapsi.fi X-SA-Exim-Scanned: No (on mail.kapsi.fi); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, > Instead of adding that kernel module which is x86-specific > to a generic lib/ directory, it should be in, say, > tools/testing/selftests/x86/test_fpu_module.c or so and instead of The kernel module is not actually x86-specific, even though it is currently only enabled for x86. amdgpu driver already does kernel mode floating point operations on PPC64 also, and the same module could be used to test the same thing there. > reading /proc/sys/debug/test_fpu, the user portion of the code would > simply modprobe it. To deterministically trigger the bug, the syscall has to come from the same thread that has modified MXCSR. Going through /usr/sbin/modprobe won't work, and manually doing the necessary syscalls for module loading seems too complicated. > What is also missing is the user portion doing ldmxcsr before running > the test and the test should be causing at least one exception which > MXCSR masks off. The fesetround() and feenableexcept() are the portable ways to modify MXCSR. The test module does cause Precision Exception and Denormal Exception if those exceptions are unmasked. -- Petteri