Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp172193pxb; Fri, 15 Oct 2021 03:14:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwW7tTvR06SpyVy6JdYmVPsIJs8p2pIsihXb1FVOQtkAZZiX9kpfB1AML4ukq/2flYG/zU8 X-Received: by 2002:a17:906:a0c9:: with SMTP id bh9mr5677219ejb.51.1634292862903; Fri, 15 Oct 2021 03:14:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634292862; cv=none; d=google.com; s=arc-20160816; b=tNQKTGQOCl3qSmQNj+Dn6mnxHh/jJlQckzu/ugKJUBrdWttCS8bAqpT2Fof6GEe9l7 Nkd1riftdvdKZdQvVYQ6E/Ldw823hEx60DQG13dGtLe8mSyR77mZLMYdTb2Ojh7OT37X 6yM5wPWL7efi/n1cR6CP7CGdr5v1zTgDNE4gI2cLPSa0+vwj3DcW1jDRHROZkhPz+e1m JQEUj0BRBZoLXoAWTxgXIiqfsuDMpEtistR7vlwpycBl7zEiWcasEyjnbOcMeUQIzoyh 5dVOOTxcoVMlc4OPh3qmchzLfISS851ujYLMrX+OkWiRKxoBqaKjaoQXbR7Q7V7+dCHz Y6aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:mime-version:references:subject:cc:to:from :dkim-signature:dkim-signature:message-id; bh=i1kz6jZJsBK77znZm+uKwkWxRf7TFLfVlxwf5q30Gk0=; b=mUJW4n50APOA2ybhiJSOm/s9rTSxmocjZfkzbp5xn4dgBK2PdR471vZ4aUrQCWsUnJ dGKLVdQTU3bm7LM9kE0mVzOM7QrQXnxvPgxVBmb1ic1tqiPBCSKSsPtoQryj05++C/ZN FXN45SSm8GaxEqgqIngUxSqFQjMAWXfxzJWZLXsP/TmZJlCN4QepcRvjkzNyzW9tBm91 sbACL11fbQnKVcdpbo6PlHh1ToNgyrEr49093bLxvKyq1xOcGp1HU8LwvW0KOqTGusWI HDUnaGsfLdlH0c0s2jJ/zo8B/p0+gdLGfD/WGlIdlBUtAU79or+OMALbPxSrIHvDi3hb nHbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=DOTmXuXG; dkim=neutral (no key) header.i=@linutronix.de; 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=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e3si7881098ejm.466.2021.10.15.03.13.58; Fri, 15 Oct 2021 03:14:22 -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=@linutronix.de header.s=2020 header.b=DOTmXuXG; dkim=neutral (no key) header.i=@linutronix.de; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234760AbhJOBSR (ORCPT + 99 others); Thu, 14 Oct 2021 21:18:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233020AbhJOBSK (ORCPT ); Thu, 14 Oct 2021 21:18:10 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF805C061570; Thu, 14 Oct 2021 18:16:04 -0700 (PDT) Message-ID: <20211015011538.722854569@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1634260563; 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: references:references; bh=i1kz6jZJsBK77znZm+uKwkWxRf7TFLfVlxwf5q30Gk0=; b=DOTmXuXGVblCRPywIpGoR1TjViFut3fHZ+Hmro8oejUAcm0XpiiJN6/5AG86SOuYZILw66 80LF0dR8qbnXhkExOxFYOA8S45RUNdSTH0S4YgXiJuJej8Kl2OfnWnjgmEGBK2APTeRu3+ zFMrA9XF0ODUCAus8V8sDluh492p788FOvGcYhDXPg+EyctlwvJJBQZOLKUzBnF+ULd6Pt ja3gJH8sCVXMe60xZ8bPOYG4NUu6790VOC0msAJ/jBVIjIYsRgQhYoKWgvy5XHtifahyoq XMbAcivpjBX+qBIGKJNJUp+0S/I0KEmLpppVL+ATL+1IEpyrcmoo/3Xwtl4fSw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1634260563; 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: references:references; bh=i1kz6jZJsBK77znZm+uKwkWxRf7TFLfVlxwf5q30Gk0=; b=vJchbI6TWMY8QbTB0y9qZ6i4C1kU/HpVMArljnrkGYRNtmcaUn7AOnvoBcWqtUIxR5unhU GuOd6XQ08xpPBCCg== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, "Chang S. Bae" , Dave Hansen , Arjan van de Ven , kvm@vger.kernel.org, Paolo Bonzini , "Liu, Jing2" , Sean Christopherson , Xiaoyao Li Subject: [patch V2 06/30] x86/fpu: Remove pointless memset in fpu_clone() References: <20211015011411.304289784@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Fri, 15 Oct 2021 03:16:02 +0200 (CEST) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Zeroing the forked task's FPU register buffer to avoid leaking init optimized stale data into the clone is a pointless exercise for the case where the current task has TIF_NEED_FPU_LOAD set. In that case the FPU register state is copied from current's FPU register buffer which can contain stale init optimized data as well. The alledged information leak is non-existant because this stale init optimized data is nowhere used and cannot leak anywhere. Signed-off-by: Thomas Gleixner --- arch/x86/kernel/fpu/core.c | 6 ------ 1 file changed, 6 deletions(-) --- diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c index 7ada7bd03a32..191269edac97 100644 --- a/arch/x86/kernel/fpu/core.c +++ b/arch/x86/kernel/fpu/core.c @@ -260,12 +260,6 @@ int fpu_clone(struct task_struct *dst) return 0; /* - * Don't let 'init optimized' areas of the XSAVE area - * leak into the child task: - */ - memset(&dst_fpu->state.xsave, 0, fpu_kernel_xstate_size); - - /* * If the FPU registers are not owned by current just memcpy() the * state. Otherwise save the FPU registers directly into the * child's FPU context, without any memory-to-memory copying.