From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5171CE79CF for ; Wed, 20 Sep 2023 11:59:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234838AbjITL7Y (ORCPT ); Wed, 20 Sep 2023 07:59:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234833AbjITL7X (ORCPT ); Wed, 20 Sep 2023 07:59:23 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69D56AD for ; Wed, 20 Sep 2023 04:59:18 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9844C433C9; Wed, 20 Sep 2023 11:59:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1695211158; bh=beDzYf9ypK2ZIwWEF+v1TPKNgKJtZENmJ+H+EcUOKio=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cx3caVxxs708ojvHrCO5vv7vOV/QgPv4y1+dAQt5hwUUfpP7Y7hZsHIaMBvaR4u0f Q6utAhR4qBdTYBr2MSPS1w43rx/Erd4njs3NH8SMNHzdBgeZfYdrwDrX/z9LelPviu huECcLXx+9De9eHbK7r1WAlFfGeRtDzEg+USCuBY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Masami Hiramatsu , Mark Rutland , Andrew Morton , Ajay Kaher , Ching-lin Yu , kernel test robot , "Steven Rostedt (Google)" Subject: [PATCH 6.1 129/139] tracefs: Add missing lockdown check to tracefs_create_dir() Date: Wed, 20 Sep 2023 13:31:03 +0200 Message-ID: <20230920112840.415499331@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230920112835.549467415@linuxfoundation.org> References: <20230920112835.549467415@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Steven Rostedt (Google) commit 51aab5ffceb43e05119eb059048fd75765d2bc21 upstream. The function tracefs_create_dir() was missing a lockdown check and was called by the RV code. This gave an inconsistent behavior of this function returning success while other tracefs functions failed. This caused the inode being freed by the wrong kmem_cache. Link: https://lkml.kernel.org/r/20230905182711.692687042@goodmis.org Link: https://lore.kernel.org/all/202309050916.58201dc6-oliver.sang@intel.com/ Cc: stable@vger.kernel.org Cc: Masami Hiramatsu Cc: Mark Rutland Cc: Andrew Morton Cc: Ajay Kaher Cc: Ching-lin Yu Fixes: bf8e602186ec4 ("tracing: Do not create tracefs files if tracefs lockdown is in effect") Reported-by: kernel test robot Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- fs/tracefs/inode.c | 3 +++ 1 file changed, 3 insertions(+) --- a/fs/tracefs/inode.c +++ b/fs/tracefs/inode.c @@ -556,6 +556,9 @@ static struct dentry *__create_dir(const */ struct dentry *tracefs_create_dir(const char *name, struct dentry *parent) { + if (security_locked_down(LOCKDOWN_TRACEFS)) + return NULL; + return __create_dir(name, parent, &simple_dir_inode_operations); }