From owner-freebsd-hackers@FreeBSD.ORG Mon Feb 3 21:20:51 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7BF3A8C0 for ; Mon, 3 Feb 2014 21:20:51 +0000 (UTC) Received: from elf.torek.net (50-73-42-1-utah.hfc.comcastbusiness.net [50.73.42.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 35B0E161A for ; Mon, 3 Feb 2014 21:20:50 +0000 (UTC) Received: from elf.torek.net (localhost [127.0.0.1]) by elf.torek.net (8.14.5/8.14.5) with ESMTP id s13L10PA092761; Mon, 3 Feb 2014 14:01:00 -0700 (MST) (envelope-from torek@elf.torek.net) Received: (from torek@localhost) by elf.torek.net (8.14.5/8.14.5/Submit) id s13L10rm092760; Mon, 3 Feb 2014 14:01:00 -0700 (MST) (envelope-from torek) Date: Mon, 3 Feb 2014 14:01:00 -0700 (MST) From: Chris Torek Message-Id: <201402032101.s13L10rm092760@elf.torek.net> To: freebsd-hackers@freebsd.org, rysto32@gmail.com Subject: Re: Races in ichsmb(9) when accessed from a multithreaded process In-Reply-To: X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (elf.torek.net [127.0.0.1]); Mon, 03 Feb 2014 14:01:00 -0700 (MST) X-Mailman-Approved-At: Mon, 03 Feb 2014 22:13:23 +0000 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Feb 2014 21:20:51 -0000 Yes, we found that the code does not properly allow either multiple threads *or* multiple processes to work. The top level driver makes it a single-open device (which has the obvious drawback that only one process can open() the device). But even then, multiple threads within a process, or forking, or using PF_LOCAL sockets to hand over the file descriptor, result in races. We have a hack that makes it work for our case but the SMB framework needs an overhaul. Chris