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: <200811201027.07860.knikanth@suse.de>
Date:	Thu, 20 Nov 2008 10:27:06 +0530
From:	Nikanth Karthikesan <knikanth@...e.de>
To:	Jens Axboe <jens.axboe@...cle.com>
Cc:	linux-kernel@...r.kernel.org, Fabio Checconi <fchecconi@...il.com>
Subject: Re: [PATCH] Exiting queue and task might race to free cic

On Wednesday 19 November 2008 19:45:31 Jens Axboe wrote:
> On Wed, Nov 19 2008, Nikanth Karthikesan wrote:

> Not sure this is enough, we probably need to copy the key to ensure that
> we get a fresh value. How does this look?
>

Agreed. Read barrier required. But the compiler hint, "likely" can stay?

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 6a062ee..4504b94 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1318,7 +1318,15 @@ static void cfq_exit_single_io_context(struct 
io_context *ioc,
 		unsigned long flags;
 
 		spin_lock_irqsave(q->queue_lock, flags);
-		__cfq_exit_single_io_context(cfqd, cic);
+
+		/*
+		 * Ensure we get a fresh copy of the ->key to prevent
+		 * race between exiting task and queue
+		 */
+		smp_read_barrier_depends();
+		if (likely(cic->key))
+			__cfq_exit_single_io_context(cfqd, cic);
+
 		spin_unlock_irqrestore(q->queue_lock, flags);
 	}
 }


> Did you actually trigger this, or is it just from code inspection?
>

No. But I am looking at another bug report on Suse Kernel where the bug is 
triggered during reboot when the kernel thread usb_stor_scan_thread exits.

Thanks
Nikanth Karthikesan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ