lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200419194529.4872-6-mcgrof@kernel.org>
Date:   Sun, 19 Apr 2020 19:45:24 +0000
From:   Luis Chamberlain <mcgrof@...nel.org>
To:     axboe@...nel.dk, viro@...iv.linux.org.uk, bvanassche@....org,
        gregkh@...uxfoundation.org, rostedt@...dmis.org, mingo@...hat.com,
        jack@...e.cz, ming.lei@...hat.com, nstange@...e.de,
        akpm@...ux-foundation.org
Cc:     mhocko@...e.com, yukuai3@...wei.com, linux-block@...r.kernel.org,
        linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org, Luis Chamberlain <mcgrof@...nel.org>
Subject: [PATCH v2 05/10] blktrace: upgrade warns to BUG_ON() on unexpected circmunstances

Now that the request_queue removal is scheduled synchronously again,
we have certain expectations on when debugfs directories used for
blktrace are used. Any violation of these expecations should reflect
core bugs we want to hear about.

Signed-off-by: Luis Chamberlain <mcgrof@...nel.org>
---
 kernel/trace/blktrace.c | 32 ++++++++------------------------
 1 file changed, 8 insertions(+), 24 deletions(-)

diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index 8f87979d0971..909db597b551 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -498,10 +498,7 @@ static struct dentry *blk_trace_debugfs_dir(struct blk_user_trace_setup *buts,
 	struct dentry *dir = NULL;
 
 	/* This can only happen if we have a bug on our lower layers */
-	if (!q->kobj.parent) {
-		pr_warn("%s: request_queue parent is gone\n", buts->name);
-		return NULL;
-	}
+	BUG_ON(!q->kobj.parent);
 
 	/*
 	 * From a sysfs kobject perspective, the request_queue sits on top of
@@ -510,32 +507,19 @@ static struct dentry *blk_trace_debugfs_dir(struct blk_user_trace_setup *buts,
 	 * that if blktrace is going to be done for it.
 	 */
 	if (blk_trace_target_disk(buts->name, kobject_name(q->kobj.parent))) {
-		if (!q->debugfs_dir) {
-			pr_warn("%s: expected request_queue debugfs_dir is not set\n",
-				buts->name);
-			return NULL;
-		}
+		BUG_ON(!q->debugfs_dir);
+
 		/*
 		 * debugfs_lookup() is used to ensure the directory is not
 		 * taken from underneath us. We must dput() it later once
 		 * done with it within blktrace.
+		 *
+		 * This is also a reaffirmation that debugfs_lookup() shall
+		 * always return the same dentry if it was already set.
 		 */
 		dir = debugfs_lookup(buts->name, blk_debugfs_root);
-		if (!dir) {
-			pr_warn("%s: expected request_queue debugfs_dir dentry is gone\n",
-				buts->name);
-			return NULL;
-		}
-		 /*
-		 * This is a reaffirmation that debugfs_lookup() shall always
-		 * return the same dentry if it was already set.
-		 */
-		if (dir != q->debugfs_dir) {
-			dput(dir);
-			pr_warn("%s: expected dentry dir != q->debugfs_dir\n",
-				buts->name);
-			return NULL;
-		}
+		BUG_ON(!dir || dir != q->debugfs_dir);
+
 		bt->backing_dir = q->debugfs_dir;
 		return bt->backing_dir;
 	}
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ