Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp321379ybt; Wed, 17 Jun 2020 01:38:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8x75a1FAMkiNgyI46MbgJ9FlDxnMY3Vd2G6MHuFi8M3DaOa655Wrb5RHf1e0p1UqmkB6z X-Received: by 2002:a05:6402:229b:: with SMTP id cw27mr6129253edb.346.1592383126858; Wed, 17 Jun 2020 01:38:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592383126; cv=none; d=google.com; s=arc-20160816; b=TQFaREr7VG+6PKZr4HyLU/xYkdNVX/v1auwlmIm+mGguVIduLK6DX3VYMPUjxx+xpe 5vRk9UCIAS7SY2qxpfKieJSaAVXeu1QiPLuRmcY90lnBcBr1tEgg25/le1YVL6Q0lGts 9gycJMuPi8+sJ1qg63lSUmTqAL+GXfutZIFzGqCzljJvoeL1D40Ypbu+p7W/OBCLfJBB 30bU2KyxcqGY+eLr0inZQX+BnUIBbJzep6NiglJBt63VZFnlwJTxhfZvtD4UffZthxph y/krv0kVfDQZcnrAenAItMkj/ynAwFyK+BgCQ1+GFgIInDLCn8F3ctbF/Mw6cWJ8rmA/ r+gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=IZY6q1xLb46Qw2A0y/61CE7mLrcbuaJLnqA/2DXo42k=; b=nus7fA9+dgJZFf6+R9sycETGWDdB4NL5Ebyt+sNF4wcT0ncdePcTJvfK54LxilMchv yrhn46v59A/+oORCeZg1+/seh2KqUCT/Z7xTQ4tZnJWQdF2BjdyOp2apJLU3bq781uLa zMC2ZX0MvnWm/OlKLPVhgwlvxyy+Wqe168AxNgY0G7furKNT7/VvhkEhiBnCtUDZ0Pjq 68gRZTG8PGwPa7sejavVHnDQtfZcj0z9xChRdKBLs2av0l5xDy9mjChRdzqa5umDNPwI FmzDAWQK+QkeTnyFJ1IL/tg6d3cJ6T0oNc67koQ8dPVejbEHgOMQlrUVSKybiULCZa3a 8hVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=EepktTXR; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c26si13159350edj.238.2020.06.17.01.38.24; Wed, 17 Jun 2020 01:38:46 -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; dkim=pass header.i=@alien8.de header.s=dkim header.b=EepktTXR; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726999AbgFQIdY (ORCPT + 99 others); Wed, 17 Jun 2020 04:33:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725894AbgFQIdX (ORCPT ); Wed, 17 Jun 2020 04:33:23 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBA10C06174E for ; Wed, 17 Jun 2020 01:33:23 -0700 (PDT) Received: from zn.tnic (p200300ec2f0bb0009537e5b82667a549.dip0.t-ipconnect.de [IPv6:2003:ec:2f0b:b000:9537:e5b8:2667:a549]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 42A401EC03E3; Wed, 17 Jun 2020 10:33:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1592382802; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IZY6q1xLb46Qw2A0y/61CE7mLrcbuaJLnqA/2DXo42k=; b=EepktTXRU8hLQXOmORsTXLXG5gkWlapk4a4Mv0/3VWR9m18DJ4wpejAdo2Gnj8rzdrYVHC AFtQegr/Ru/HsI3Aq6G4UcuXAfjTZKffZd2gTQryrOcgSDnODy4zu8PHZFYERnkM7VSYmS 7QvNqgI/FSwHNjXpBtJgeQyQ431za1Q= Date: Wed, 17 Jun 2020 10:33:14 +0200 From: Borislav Petkov To: Andy Lutomirski Cc: x86-ml , jpa@kernelbug.mail.kapsi.fi, Dave Hansen , "H. Peter Anvin" , Sebastian Andrzej Siewior , lkml Subject: Re: [PATCH] x86/fpu: Reset MXCSR to default in kernel_fpu_begin() Message-ID: <20200617083314.GC10118@zn.tnic> References: <20200616180123.GL13515@zn.tnic> <1D569B6B-B8C3-497E-8A74-2E1A3D46299E@amacapital.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1D569B6B-B8C3-497E-8A74-2E1A3D46299E@amacapital.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 16, 2020 at 02:17:16PM -0700, Andy Lutomirski wrote: > We definitely need to sanitize MXCSR for kernel fpu if kernel fpu > means SSE2. If kernel fpu means x87, we need to fix the fpu control > word. Bah, there's no need to beat around the bush - let's just do: if (boot_cpu_has(X86_FEATURE_XMM)) ldmxcsr(MXCSR_DEFAULT); if (boot_cpu_has(X86_FEATURE_FPU)) asm volatile ("fninit"); and be sure that kernel users get a squeaky-clean FPU. > On x86_64, I suspect the UEFI ABI technically requires a clean x87 > control word too. If we’re willing to declare that the kernel proper > won’t use x87, then we could shove that into the UEFI code. Nah, we don't trust the firmware. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette