Message ID | 20240204011829.008666210@goodmis.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-51350-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp147992dyb; Sat, 3 Feb 2024 17:22:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IEaIGk9YPUAmNIJaBBTCb+1yGR2OGhIZpKOF0mx6WUpnAwUi5rBpCwgnajFqCPEtF+L1Wu4 X-Received: by 2002:a92:ce4f:0:b0:363:c305:1032 with SMTP id a15-20020a92ce4f000000b00363c3051032mr1266796ilr.19.1707009725546; Sat, 03 Feb 2024 17:22:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707009725; cv=pass; d=google.com; s=arc-20160816; b=VtfzVYC9+7Sbr3FdoHRNqz8jcdGa3Yf9Cab/E9OJEesjnaV8wpE6t4exNXrv4t1pgA RFosAxC6J3Ca3lYjVYfPG271HHtXuskbAqZOcOQoySgaHrSdGbdN9ubAAtCgskbPN+2I rOUy9ZD4ieFs4TZVheD0uCyz2eGkD+zBsjlosqcQ0SIONffbTKI+u07GBjLPwrmWHS7a m7WkWlBi9E0jB/VL7R9+bvHz7wWqR4NUzHDT55bMNqYd0g1wn0/a2g/Ru1bdZ0JvO3ff bnFA3ulcSQu7uPJ5SCt75FCkHnq5+UmQM1h1QzP8cmxtmbZ5DUnSls9TcypJa7Vphpy+ +vgQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:subject:cc:to:from:date:user-agent:message-id; bh=9a6mlKxBAB+nG1o/FkoaS+LuUNdfuJ0NPVKe/J3/wfQ=; fh=iHEdDgS3o4pcBBJDecpITgeTklN0PS7zqd498i0z4q4=; b=klbKmPePZWhgn+tZZaynNztn+Tkb8sRah5uwDLG/oUcmZwWjRl27tMdSOqgyDuy2VQ UsXlveQYUWdYPY0OLN3fZzaLT7uJ0lZtrKWVXvLCPjM+MBAivs9gcS0nt9i3N2Abdx4u I4bKXrVjpP4pFGq93zQ1/13sk/ZCDHpJh+SdwrcQA9r0047K4ITfs0QfqRK4ozZhSdwN NMJLpwl2raAwN4RVpK0oU0I4tyXAqRD1iGrcuHNwvTwBzmBvWJ6fx/ph3wEoCKKH5CKZ dNgZdfzh38MmAWPZ0p1AK8X5IPhDSoF1cM0B8hisSGxEkYsEXBj3fU6dPaYgZNMJp5c1 opEw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-51350-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51350-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCVTlwyBEvU1lYm28U/Yz4K6SgKFpOUfJLfXmF/tW5U8pM1v31bItRiT7UNc8NtOP+exskHLWHQOPPsg780WCMY6mgsZeg== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id l19-20020a635b53000000b005d8e38097ffsi3749578pgm.715.2024.02.03.17.22.05 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 17:22:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51350-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-51350-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51350-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 50380285BAC for <ouuuleilei@gmail.com>; Sun, 4 Feb 2024 01:22:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 06D3E171AC; Sun, 4 Feb 2024 01:18:11 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4DA1AB654; Sun, 4 Feb 2024 01:18:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707009487; cv=none; b=Na4nM/pjeQwVasU9jqD2rinphziaZZ8/Ed+Yia5ChwDZ9u9Yarmz4qs34PNsh6TrDZpVH55FWgt4R4gE6hjr8zRRYxAfHHVRHmVhaHoJkgNGexCqOrCAP/tPl/UlwFPW/iad8ByIXRdYd4vYB91sXXVgG66gaUvs1bSA+9MEjFg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707009487; c=relaxed/simple; bh=3adZE3XRvsxSdhBsQIqBjy7xLEJW/dok2uD8qBYZMss=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=GInzBFKRQE0+viDe0f/tRVUB9NcdtQpJizeH2zONviJRj1+2feSJZY3NLUfAjVdzAxKQTbePJ3+kLn9hDNMoc6lCaK455mT/QMSsX2wFwWHgf98iIViywwbnO3NCVgjGnAbb7RYxVJ7ARn48YqllFx4/EE7i3UiiQFEmzBTm3sg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DA0CC4AF75; Sun, 4 Feb 2024 01:18:06 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from <rostedt@goodmis.org>) id 1rWR9R-00000006Oqs-0cRt; Sat, 03 Feb 2024 20:18:29 -0500 Message-ID: <20240204011829.008666210@goodmis.org> User-Agent: quilt/0.67 Date: Sat, 03 Feb 2024 20:16:28 -0500 From: Steven Rostedt <rostedt@goodmis.org> To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Linus Torvalds <torvalds@linux-foundation.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Sasha Levin <sashal@kernel.org>, Masami Hiramatsu <mhiramat@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Mathieu Desnoyers <mathieu.desnoyers@efficios.com>, Andrew Morton <akpm@linux-foundation.org>, Christian Brauner <brauner@kernel.org>, Al Viro <viro@ZenIV.linux.org.uk>, Ajay Kaher <ajay.kaher@broadcom.com>, kernel test robot <oliver.sang@intel.com> Subject: [v6.7][PATCH 13/23] tracefs: Zero out the tracefs_inode when allocating it References: <20240204011615.703023949@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789929429957581686 X-GMAIL-MSGID: 1789929429957581686 |
Series |
eventfs: Linus's updates for 6.7
|
|
Commit Message
Steven Rostedt
Feb. 4, 2024, 1:16 a.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org> eventfs uses the tracefs_inode and assumes that it's already initialized to zero. That is, it doesn't set fields to zero (like ti->private) after getting its tracefs_inode. This causes bugs due to stale values. Just initialize the entire structure to zero on allocation so there isn't any more surprises. This is a partial fix to access to ti->private. The assignment still needs to be made before the dentry is instantiated. Link: https://lore.kernel.org/linux-trace-kernel/20240131185512.315825944@goodmis.org Cc: stable@vger.kernel.org Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Christian Brauner <brauner@kernel.org> Cc: Al Viro <viro@ZenIV.linux.org.uk> Cc: Ajay Kaher <ajay.kaher@broadcom.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Fixes: 5790b1fb3d672 ("eventfs: Remove eventfs_file and just use eventfs_inode") Reported-by: kernel test robot <oliver.sang@intel.com> Closes: https://lore.kernel.org/oe-lkp/202401291043.e62e89dc-oliver.sang@intel.com Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org> --- fs/tracefs/inode.c | 6 ++++-- fs/tracefs/internal.h | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c index e1b172c0e091..888e42087847 100644 --- a/fs/tracefs/inode.c +++ b/fs/tracefs/inode.c @@ -38,8 +38,6 @@ static struct inode *tracefs_alloc_inode(struct super_block *sb) if (!ti) return NULL; - ti->flags = 0; - return &ti->vfs_inode; } @@ -779,7 +777,11 @@ static void init_once(void *foo) { struct tracefs_inode *ti = (struct tracefs_inode *) foo; + /* inode_init_once() calls memset() on the vfs_inode portion */ inode_init_once(&ti->vfs_inode); + + /* Zero out the rest */ + memset_after(ti, 0, vfs_inode); } static int __init tracefs_init(void) diff --git a/fs/tracefs/internal.h b/fs/tracefs/internal.h index 91c2bf0b91d9..7d84349ade87 100644 --- a/fs/tracefs/internal.h +++ b/fs/tracefs/internal.h @@ -11,9 +11,10 @@ enum { }; struct tracefs_inode { + struct inode vfs_inode; + /* The below gets initialized with memset_after(ti, 0, vfs_inode) */ unsigned long flags; void *private; - struct inode vfs_inode; }; /*