Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp88269pxb; Tue, 31 Aug 2021 15:50:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkvEcWqZ1xf/KbaCnudDvEiBtZQ5NdrPDiyAurjeuyChCvd7GxPbdakoUCciZ5F8RdGK/Y X-Received: by 2002:a17:906:3a4d:: with SMTP id a13mr19689772ejf.220.1630450249251; Tue, 31 Aug 2021 15:50:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630450249; cv=none; d=google.com; s=arc-20160816; b=SsBfWMvw5+wtd+9SOJbAevoF7wvdidIvN8Axw8hHxX0lllnUy5s6OHslZfTWlXFp2u 0mMIhOA8OAfNWXaO0bp6eIka/CNBibVfbJvjenfRsnJ9Vasmq6sTVxUXkDP85ILEFxER pZKPNo/TbZMNJLo4955Hjvf82I4o5gGzSreIuoZLZFdWT0ubZSBPy/HxMHbf+c5CpnFg 6QsL9BQucqhQiFbxPyptzu9770ffUn+Wc/remO6sM3TeNB8zNIW45RZivoRJ9/rEqy42 BfD87WI+BUkUWrn9h9N42Zi9JMIs8PxjN6e5yEfc9U0sl9AYIW4YUTEQ67QVIKUADoB3 yEAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:organization:message-id:date:subject:cc:to :from; bh=oj+6+0XBPUHZCNbv47Aaj80qN//+xph+F/fJNeGKluY=; b=O91GBwz7HTClbUxPTnJceul05bSlo4DKl4faf2cntHtmXClp3VBcLIydGiQ/BbnWkL eRY70JJwpExTqI1DNF1H+eGAoQF4uUYMf+ZQ+S5s81FYxuSz5q+yEA267sgj21QnyBYK lZKBV6iRrW+lq3N+yF1mPJ6iIOItWKIOgFqpcJlDE+tWZoNeGytIJtOn+wlWkZzWT2Eq /qay9Q9gLu/3yEdMWz7B8C3qUmFblL6aNbeZaWf9jZfxvsJ8j5flPe9USHxVmaZfegJr sZyuBxleVfWt95eOefkPDQ2s+1yDRHffJgh61X6oiMmy7cyrKQB7PggJhhwJyIaOY8dt 1xRw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j13si20099927edw.440.2021.08.31.15.50.20; Tue, 31 Aug 2021 15:50:49 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234343AbhHaWkH (ORCPT + 99 others); Tue, 31 Aug 2021 18:40:07 -0400 Received: from mga12.intel.com ([192.55.52.136]:17393 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229602AbhHaWkG (ORCPT ); Tue, 31 Aug 2021 18:40:06 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10093"; a="198142851" X-IronPort-AV: E=Sophos;i="5.84,367,1620716400"; d="scan'208";a="198142851" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2021 15:39:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,367,1620716400"; d="scan'208";a="466607443" Received: from irsmsx605.ger.corp.intel.com ([163.33.146.138]) by orsmga007.jf.intel.com with ESMTP; 31 Aug 2021 15:39:08 -0700 Received: from tjmaciei-mobl5.localnet (10.212.209.231) by IRSMSX605.ger.corp.intel.com (163.33.146.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Tue, 31 Aug 2021 23:39:05 +0100 From: Thiago Macieira To: Dave Hansen , Len Brown CC: Borislav Petkov , "Chang S. Bae" , Andy Lutomirski , Thomas Gleixner , "Ingo Molnar" , X86 ML , "Brown, Len" , "Liu, Jing2" , "Ravi V. Shankar" , Linux Kernel Mailing List Subject: Re: [PATCH v9 12/26] x86/fpu/xstate: Use feature disable (XFD) to protect dynamic user state Date: Tue, 31 Aug 2021 15:39:02 -0700 Message-ID: <2020841.9MqWvG71rC@tjmaciei-mobl5> Organization: Intel Corporation In-Reply-To: References: <20210730145957.7927-1-chang.seok.bae@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Originating-IP: [10.212.209.231] X-ClientProxiedBy: orsmsx605.amr.corp.intel.com (10.22.229.18) To IRSMSX605.ger.corp.intel.com (163.33.146.138) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday, 31 August 2021 15:15:55 PDT Len Brown wrote: > Indeed, I believe that there is universal agreement that a synchronous > return code > from a system call is a far superior programming model than decoding > the location of a failure in a system call. (no, the IP isn't random -- it > is always the 1st instruction in that thread to touch a TMM register). That instruction is actually likely going to be a memory load, probably an LDTILECFG. So the developer will see a crashing instruction with a pointer and will spend time trying to figure out why that pointer was wrong, when there was nothing wrong with it. That's why I suggested (and Chang implemented) a SIGILL for when #NM is received and the arch_prctl() wasn't previously done. The OOM condition, if the extra state is dynamically allocated, was meant to stay a SIGSEGV, but maybe should change to SIGKILL. On the other hand, if it it's allocated at the syscall, then the kernel can return -ENOMEM for it (which would allow for graceful degradation) or for a later clone() syscall starting a new thread (which I don't expect to ever gracefully degrade). > decoding the location of the failure in a *signal hander* That's a separate problem. We can't be sure that the portion of the userspace doing the alt-stack crash handler is aware of the portion using AMX. There's no way to enforce this. The prctl() is a good indication, but I have no clue how high the correlation will be. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel DPG Cloud Engineering