Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1723957pxb; Mon, 12 Apr 2021 05:21:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxuq0oa1Xps57an//Xwa92kt+JNbghzvNdrXHjGaMAdURDBvtvcTiLCC+5ytYZmpjM0nXJ1 X-Received: by 2002:a17:90b:715:: with SMTP id s21mr6970209pjz.183.1618230109898; Mon, 12 Apr 2021 05:21:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618230109; cv=none; d=google.com; s=arc-20160816; b=t6pGDylqm9B4M6x5nabZzaZobtShi83bLRcudLxexn+KKDR4x74ueyvWl5ylAyy0wp G1iUcPiykkGnR2WT9o7+WIK0CGwdJ46cZX2M3NdAH0msU12HozigDaoqTmVi/tRDmhF1 A489ld4tuy6cZochVfLK+mXaoIacSOoEV96BVsb4nIhiNEc1Yjwi+TJ05M2ojesEDNtG Dl2+z+mf71/wE54FqqKckeb1onGf0gR0dOtryS7vvG3whiPZabeLzYxax2EGLvTjiiHU HndZ1HPq5sL7K6BNxSLBzyRsFuTKANbmGdIOUQDYguSTUV9S6uBEG3ZB+1PeqhQgZWhY LVwA== 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=kD7vbGhEK0qnsfsKWL7qZgyEpxDWyfq7hGq9uI0D3VU=; b=SFnBm0gFLK8pFLe62QmzOsLc14FzDCcVN8uTSpHW7twpPjBp3mO/8EYZJA8tE8CaU+ 5Quewf4r4eGAFBPxPm0tToiiti1O8aR4oXHRv/E6rw67cXktgMDAF6hyAzOiM9LEUmTw k35efP6+OYtcx+Ldvlk2yxTDBNx219nthFaNlyB29N1d2/H4rnhsoINRErlFax5zw1xf u5n8N/NWrU/35aCt0FApXgFsafdbSDtPsN2dTe+F2l87AwzTFXM1SViUbq3atM2G2X35 xVHbBw/AUUBTHKk2VCPAstKR824tJgHud8JE393kU4w5ansqjWvON5vn89DHDR1B4jB4 kqfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=LCsmTk8j; 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 l6si13519725pjr.35.2021.04.12.05.21.37; Mon, 12 Apr 2021 05:21: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; dkim=pass header.i=@alien8.de header.s=dkim header.b=LCsmTk8j; 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 S239439AbhDLMUJ (ORCPT + 99 others); Mon, 12 Apr 2021 08:20:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238443AbhDLMUI (ORCPT ); Mon, 12 Apr 2021 08:20:08 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B293C061574; Mon, 12 Apr 2021 05:19:50 -0700 (PDT) Received: from zn.tnic (p200300ec2f052100338fe73c52330fca.dip0.t-ipconnect.de [IPv6:2003:ec:2f05:2100:338f:e73c:5233:fca]) (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 0B6F21EC036C; Mon, 12 Apr 2021 14:19:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1618229989; 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:in-reply-to:in-reply-to: references:references; bh=kD7vbGhEK0qnsfsKWL7qZgyEpxDWyfq7hGq9uI0D3VU=; b=LCsmTk8jVRXuAL6SekTZ2EL8U88N5RFH2nN88t/2o6trKZZQV6z0gvUOXcuvFc8lC79kO3 glnan1rZJ3fsG3HGVcgp9wNlUkDeqljeMENQn5hEelXJyV8F+Q3nE2MG8ucxfLownR9nwz jvCSbSM6J5G3OEk7eFe9hFmfyx1d8V8= Date: Mon, 12 Apr 2021 14:19:47 +0200 From: Borislav Petkov To: Len Brown Cc: Andy Lutomirski , David Laight , Dave Hansen , Greg KH , "Bae, Chang Seok" , X86 ML , LKML , libc-alpha , Florian Weimer , Rich Felker , Kyle Huey , Keno Fischer , Linux API Subject: Re: Candidate Linux ABI for Intel AMX and hypothetical new related features Message-ID: <20210412121947.GC24283@zn.tnic> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Apr 11, 2021 at 03:07:29PM -0400, Len Brown wrote: > If it is the program, how does it know that the library wants to use > what instructions? > > If it is the library, then you have just changed XCR0 at run-time and > you expose breakage of the thread library that has computed XSAVE size. So, when old programs which cannot possibly know about the arch_prctl() extension we're proposing here, link against that library, then that library should not be allowed to go use "fat" states. Unless the library can "tell" the process which links to it, that it has dynamically enlarged the save state. If it can and the process can handle that, then all is fine, save state gets enlarged dynamically and it all continues merrily. Also, in order for the library to use fat states, it needs to ask the kernel for such support - not CPUID - because the kernel is doing the state handling for everybody and doing all the CR4.OSXSAVE setup etc. Which also means that the kernel can help here by telling the library: - No, you cannot use fat states with this process because it hasn't called arch_prctl() so it cannot handle them properly. - Yes, this process allowes me to handle fat states for it so you can use those states and thus those instructions when doing operations for it. So the kernel becomes the arbiter in all this - as it should be - and then all should work fine. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette