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>] [day] [month] [year] [list]
Message-ID: <526C39EB.2000103@interlog.com>
Date:	Sat, 26 Oct 2013 17:53:47 -0400
From:	Douglas Gilbert <dgilbert@...erlog.com>
To:	SCSI development list <linux-scsi@...r.kernel.org>,
	James Bottomley <james.bottomley@...senpartnership.com>
CC:	vaughan <vaughan.cao@...cle.com>,
	linux-kernel <linux-kernel@...r.kernel.org>
Subject: [PATCH] 3.13 series, sg: O_EXCL and other lock handling

The lk 3.12.0-rc series contained four patches against the
sg driver from Vaughan Cao introduced by this post:
    [PATCH v7 0/4][SCSI] sg: fix race condition in sg_open
    http://marc.info/?l=linux-scsi&m=137774159020002&w=2

Doubt was thrown on the implementation by Madper Xie in
this thread:
    [Bug] 12.864681  BUG: lock held when returning to user space!
    http://marc.info/?l=linux-kernel&m=138121455020314&w=2

There was a second bug report. A patch from me (that needed to
be revised) was judged to be too late in the lk 3.12 rc cycle
to be accepted. Hence Vaughan's patch is queued to be reverted.
That means the sg driver will remain unchanged for at least
three releases: 3.10, 3.11 and 3.12

The patch presented here targets the lk 3.13 merge window
and is functionally equivalent to Vaughan's four part patch
with my revised patch on top.

Testing:
   In the sg3_utils package (version 1.37) examples directory
   there are the sg_tst_excl2 and sg_tst_excl3 ** programs.
   They use multiple threads to bombard the sg driver (or bsg
   or the block layer) with open calls varying the O_EXCL and
   O_NONBLOCK flags. Writer threads check for an even number
   then do a double increment on a given LBA; reader threads
   just read that LBA and check it is even. If the integer
   (4 bytes at the beginning of the LB) starts even, then it
   should remain even, if O_EXCL is doing its job properly.

** sg_tst_excl3 came after version 1.37 was released and is
    in the News section here: http://sg.danny.cz/sg

ChangeLog:
   - introduce a finer grain (per device) lock to protect
     access and changes to the file descriptor objects
   - introduce a semaphore for mutual exclusion of co-incident
     open and release calls to the same device
   - improve the O_EXCL handling of sg_open() when multiple
     callers are waiting for an O_EXCL condition to clear
   - change some seq_printf()s to seq_puts()s as requested
     by checkpatch.pl
   - update copyright notice, version number and date


Signed-off-by: Douglas Gilbert <dgilbert@...erlog.com>



View attachment "sg.c313excl_dg1.patch" of type "text/x-patch" (14843 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ