Re: [PATCH v2] scsi: sg: fix SG_DXFER_FROM_DEV transfers

2017-07-07 Thread Chris Clayton


On 07/07/17 09:56, Johannes Thumshirn wrote:
> SG_DXFER_FROM_DEV transfers do not necessarily have a dxferp as we set
> it to NULL for the old sg_io read/write interface, but must have a length
> bigger than 0. This fixes a regression introduced by commit 28676d869bbb
> ("scsi: sg: check for valid direction before starting the request")
> 

I've tested this new patch and the Nero applications can still find the optical 
drives on my laptop.

Tested-by: Chris Clayton <chris2...@googlemail.com>

> Signed-off-by: Johannes Thumshirn <jthumsh...@suse.de>
> Fixes: 28676d869bbb ("scsi: sg: check for valid direction before starting the 
> request")
> Reported-by: Chris Clayton <chris2...@googlemail.com>
> Tested-by: Chris Clayton <chris2...@googlemail.com>
> Cc: Douglas Gilbert <dgilb...@interlog.com>
> Reviewed-by: Hannes Reinecke <h...@suse.com>
> ---
> Changes to v1:
> * Fix breakage of the sg_io v3 interface, verified using sg_inq
> 
>  drivers/scsi/sg.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
> index 21225d62b0c1..1e82d4128a84 100644
> --- a/drivers/scsi/sg.c
> +++ b/drivers/scsi/sg.c
> @@ -758,8 +758,11 @@ static bool sg_is_valid_dxfer(sg_io_hdr_t *hp)
>   if (hp->dxferp || hp->dxfer_len > 0)
>   return false;
>   return true;
> - case SG_DXFER_TO_DEV:
>   case SG_DXFER_FROM_DEV:
> + if (hp->dxfer_len < 0)
> + return false;
> + return true;
> + case SG_DXFER_TO_DEV:
>   case SG_DXFER_TO_FROM_DEV:
>   if (!hp->dxferp || hp->dxfer_len == 0)
>   return false;
> 


Re: Nero 4 Linux applications broken in 4.12

2017-07-05 Thread Chris Clayton


On 05/07/17 13:42, Johannes Thumshirn wrote:
> On Wed, Jul 05, 2017 at 01:19:09PM +0100, Chris Clayton wrote:
>> I'm happy to test any patches you may propose.
> 
> Can you verify this fix? Preferedably with using Nero. It passes my small
> reproducer:
> 
Thanks Johannes.

With your patch applied to 4.12.0, all three of the nero applications can now 
detect my drives again.

Excellent work! Thank you.

Tested-by: Chris Clayton <chris2...@googlemail.com>

> From f52502180cc3843f8acc956253af2575245546a8 Mon Sep 17 00:00:00 2001
> From: Johannes Thumshirn <jthumsh...@suse.de>
> Date: Wed, 5 Jul 2017 14:31:47 +0200
> Subject: [PATCH] scsi: sg: fix SG_DXFER_FROM_DEV transfers
> 
> SG_DXFER_FROM_DEV transfers do not have a dxferp as we set it to NULL,
> but must have a length bigger than 0. This fixes a regression introduced
> by commit 28676d869bbb ("scsi: sg: check for valid direction before
> starting the request")
> 
> Signed-off-by: Johannes Thumshirn <jthumsh...@suse.de>
> Fixes: 28676d869bbb ("scsi: sg: check for valid direction before starting the 
> request")
> ---
>  drivers/scsi/sg.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
> index 21225d62b0c1..3c91593260aa 100644
> --- a/drivers/scsi/sg.c
> +++ b/drivers/scsi/sg.c
> @@ -758,8 +758,11 @@ static bool sg_is_valid_dxfer(sg_io_hdr_t *hp)
>   if (hp->dxferp || hp->dxfer_len > 0)
>   return false;
>   return true;
> - case SG_DXFER_TO_DEV:
>   case SG_DXFER_FROM_DEV:
> + if (hp->dxferp || hp->dxfer_len < 0)
> + return false;
> + return true;
> + case SG_DXFER_TO_DEV:
>   case SG_DXFER_TO_FROM_DEV:
>   if (!hp->dxferp || hp->dxfer_len == 0)
>   return false;
> 


Re: Nero 4 Linux applications broken in 4.12

2017-07-05 Thread Chris Clayton


On 05/07/17 13:09, Johannes Thumshirn wrote:
> On Wed, Jul 05, 2017 at 01:05:46PM +0100, Chris Clayton wrote:
>> Yes, I get:
>>
>> [chris:~/rpm/build]$ su -c "./nerotest /dev/sg0"
>> Password:
>> write: Invalid argument
>> FAIL
> 
> Awesome, thanks for confirming.
> 
You're welcome. I've attached a dmesg log with logging turned on when I ran 
"nerocmd --scanbus".
I set the logging level with "scsi_logging_level -s -T4" (i.e.had to add the -s 
argument to your suggested command.
Sorry, for the delay - had to build a new kernel with scsi logging enabled.

> I'll work on it locally now and hopefully send you something to test soon.
> 

I'm happy to test any patches you may propose.

Thanks,
Chris
> Thanks,
>   Johannes
> 
[0.00] Linux version 4.12.0 (chris@laptop) (gcc version 6.4.0 (GCC) ) #2 SMP PREEMPT Wed Jul 5 12:58:07 BST 2017
[0.00] Command line: BOOT_IMAGE=/boot/vmlinuz-4.12.0 ro root=/dev/sda2 resume=/dev/sda6 rootfstype=ext4 net.ifnames=0
[0.00] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
[0.00] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
[0.00] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'
[0.00] x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256
[0.00] x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'standard' format.
[0.00] e820: BIOS-provided physical RAM map:
[0.00] BIOS-e820: [mem 0x-0x0009d7ff] usable
[0.00] BIOS-e820: [mem 0x0009d800-0x0009] reserved
[0.00] BIOS-e820: [mem 0x000e-0x000f] reserved
[0.00] BIOS-e820: [mem 0x0010-0xd7216fff] usable
[0.00] BIOS-e820: [mem 0xd7217000-0xd721dfff] ACPI NVS
[0.00] BIOS-e820: [mem 0xd721e000-0xd7a0cfff] usable
[0.00] BIOS-e820: [mem 0xd7a0d000-0xd7ca1fff] reserved
[0.00] BIOS-e820: [mem 0xd7ca2000-0xdb4d] usable
[0.00] BIOS-e820: [mem 0xdb4e-0xdb82dfff] reserved
[0.00] BIOS-e820: [mem 0xdb82e000-0xdb88afff] usable
[0.00] BIOS-e820: [mem 0xdb88b000-0xdb9bcfff] ACPI NVS
[0.00] BIOS-e820: [mem 0xdb9bd000-0xdbffefff] reserved
[0.00] BIOS-e820: [mem 0xdbfff000-0xdbff] usable
[0.00] BIOS-e820: [mem 0xdd00-0xdf1f] reserved
[0.00] BIOS-e820: [mem 0xf800-0xfbff] reserved
[0.00] BIOS-e820: [mem 0xfec0-0xfec00fff] reserved
[0.00] BIOS-e820: [mem 0xfed0-0xfed03fff] reserved
[0.00] BIOS-e820: [mem 0xfed1c000-0xfed1] reserved
[0.00] BIOS-e820: [mem 0xfee0-0xfee00fff] reserved
[0.00] BIOS-e820: [mem 0xff00-0x] reserved
[0.00] BIOS-e820: [mem 0x0001-0x00041fdf] usable
[0.00] NX (Execute Disable) protection: active
[0.00] SMBIOS 2.7 present.
[0.00] DMI: Notebook W65_67SZ/W65_67SZ, BIOS 1.03.05 02/26/2014
[0.00] tsc: Fast TSC calibration using PIT
[0.00] e820: update [mem 0x-0x0fff] usable ==> reserved
[0.00] e820: remove [mem 0x000a-0x000f] usable
[0.00] e820: last_pfn = 0x41fe00 max_arch_pfn = 0x4
[0.00] MTRR default type: uncachable
[0.00] MTRR fixed ranges enabled:
[0.00]   0-9 write-back
[0.00]   A-B uncachable
[0.00]   C-C write-protect
[0.00]   D-E7FFF uncachable
[0.00]   E8000-F write-protect
[0.00] MTRR variable ranges enabled:
[0.00]   0 base 00 mask 7C write-back
[0.00]   1 base 04 mask 7FE000 write-back
[0.00]   2 base 00E000 mask 7FE000 uncachable
[0.00]   3 base 00DE00 mask 7FFE00 uncachable
[0.00]   4 base 00DD00 mask 7FFF00 uncachable
[0.00]   5 base 041FE0 mask 7FFFE0 uncachable
[0.00]   6 disabled
[0.00]   7 disabled
[0.00]   8 disabled
[0.00]   9 disabled
[0.00] x86/PAT: Configuration [0-7]: WB  WC  UC- UC  WB  WC  UC- WT  
[0.00] e820: update [mem 0xdd00-0x] usable ==> reserved
[0.00] e820: last_pfn = 0xdc000 max_arch_pfn = 0x4
[0.00] found SMP MP-table at [mem 0x000fd820-0x000fd82f] mapped at [880fd820]
[0.00] Base memory trampoline at [88097000] 97000 size 24576
[0.00] Using GB pages for direct mapping
[0.00] BRK [0x01df9000, 0x01df9fff] PGT

Re: Nero 4 Linux applications broken in 4.12

2017-07-05 Thread Chris Clayton


On 05/07/17 12:52, Johannes Thumshirn wrote:
> On Wed, Jul 05, 2017 at 10:06:49AM +0100, Chris Clayton wrote:
>> I'll do this  and send dmesg(?) output as soon as I've got 
>> scsi_logging_level installed.
> 
> Hi Chris,
> 
> does this reproducer work (i.e. output FAIL) for you?
> 
Hi Johannes.

Yes, I get:

[chris:~/rpm/build]$ su -c "./nerotest /dev/sg0"
Password:
write: Invalid argument
FAIL


Chris


Re: Nero 4 Linux applications broken in 4.12

2017-07-05 Thread Chris Clayton


On 05/07/17 09:48, Johannes Thumshirn wrote:
> On Wed, Jul 05, 2017 at 10:44:47AM +0200, Johannes Thumshirn wrote:
>> On Wed, Jul 05, 2017 at 08:57:54AM +0100, Chris Clayton wrote:
>>> Thanks for the reply, Johannes.
>>> The strace log for 4.12.0 is attached.
>>
>> Thanks Chris.
>>
>> Can I have a known good version as well? The counterpart to this snippet 
>> would
>> be great:
>>
>> open("/dev/sg0", O_RDWR)= 6
>> ioctl(6, SG_SET_RESERVED_SIZE, [131072]) = 0
>> ioctl(6, SG_SET_TIMEOUT, [1080])= 0
>> write(6, 
>> "\0\0\0\0H\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 42) = 
>> -1 EINVAL (Invalid argument)
> 

Thanks Johannes.

The counterpart is shown in the diff snippet in my original post, but I've 
attached the strace log from 4.11.8 in any case.

> And please activate the SG debug prints. Should be via
> 'scsi_logging_level -T 4'.
> 

I'll do this  and send dmesg(?) output as soon as I've got scsi_logging_level 
installed.

Chris
execve("/usr/bin/nerocmd", ["nerocmd", "--scanbus"], 0x7fff08a0c1d8 /* 48 vars 
*/) = 0
brk(NULL)   = 0x1053000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x7f251fb79000
access("/etc/ld.so.preload", R_OK)  = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=205457, ...}) = 0
mmap(NULL, 205457, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f251fb46000
close(3)= 0
open("/usr/lib/libgthread-2.0.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\6\0\0\0\0\0\0"..., 
832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=5944, ...}) = 0
mmap(NULL, 2101304, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 
0x7f251f755000
mprotect(0x7f251f756000, 2093056, PROT_NONE) = 0
mmap(0x7f251f955000, 8192, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0) = 0x7f251f955000
close(3)= 0
open("/usr/lib/libglib-2.0.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\\246\1\0\0\0\0\0"..., 
832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1114952, ...}) = 0
mmap(NULL, 3212968, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 
0x7f251f444000
mprotect(0x7f251f553000, 2093056, PROT_NONE) = 0
mmap(0x7f251f752000, 8192, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x10e000) = 0x7f251f752000
mmap(0x7f251f754000, 1704, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f251f754000
close(3)= 0
open("/usr/lib/libgtk-x11-2.0.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, 
"\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\220\312\6\0\0\0\0\0"..., 832) = 
832
fstat(3, {st_mode=S_IFREG|0755, st_size=4419752, ...}) = 0
mmap(NULL, 6525176, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 
0x7f251ee0a000
mprotect(0x7f251f236000, 2097152, PROT_NONE) = 0
mmap(0x7f251f436000, 45056, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x42c000) = 0x7f251f436000
mmap(0x7f251f441000, 8440, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f251f441000
close(3)= 0
open("/usr/lib/libgdk-x11-2.0.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, 
"\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360\342\1\0\0\0\0\0"..., 832) = 
832
fstat(3, {st_mode=S_IFREG|0755, st_size=723960, ...}) = 0
mmap(NULL, 2820600, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 
0x7f251eb59000
mprotect(0x7f251ec05000, 2093056, PROT_NONE) = 0
mmap(0x7f251ee04000, 24576, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xab000) = 0x7f251ee04000
close(3)= 0
open("/usr/lib/libatk-1.0.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p\261\0\0\0\0\0\0"..., 
832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=155064, ...}) = 0
mmap(NULL, 2251480, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 
0x7f251e933000
mprotect(0x7f251e955000, 2097152, PROT_NONE) = 0
mmap(0x7f251eb55000, 16384, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x22000) = 0x7f251eb55000
close(3)= 0
open("/usr/lib/libgdk_pixbuf-2.0.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\240g\0\0\0\0\0\0"..., 
832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=146632, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x7f251fb44000
mmap(NULL, 2242224, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 
0x7

Re: Nero 4 Linux applications broken in 4.12

2017-07-05 Thread Chris Clayton


On 05/07/17 08:39, Johannes Thumshirn wrote:
> On Wed, Jul 05, 2017 at 08:06:17AM +0100, Chris Clayton wrote:
>> I can provide the full traces or any other diagnostics, if they would help.
> 
> Yes this would definitively help. An strace log would be great so I
> can make a local reproducer.
> 

Thanks for the reply, Johannes.
The strace log for 4.12.0 is attached.

Chris

> Thanks,
>   Johannes
> 
execve("/usr/bin/nerocmd", ["nerocmd", "--scanbus"], 0x7ffc5e7f3b28 /* 48 vars 
*/) = 0
brk(NULL)   = 0x252e000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x7f46404d
access("/etc/ld.so.preload", R_OK)  = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=205457, ...}) = 0
mmap(NULL, 205457, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f464049d000
close(3)= 0
open("/usr/lib/libgthread-2.0.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\6\0\0\0\0\0\0"..., 
832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=5944, ...}) = 0
mmap(NULL, 2101304, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 
0x7f46400ac000
mprotect(0x7f46400ad000, 2093056, PROT_NONE) = 0
mmap(0x7f46402ac000, 8192, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0) = 0x7f46402ac000
close(3)= 0
open("/usr/lib/libglib-2.0.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\\246\1\0\0\0\0\0"..., 
832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1114952, ...}) = 0
mmap(NULL, 3212968, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 
0x7f463fd9b000
mprotect(0x7f463feaa000, 2093056, PROT_NONE) = 0
mmap(0x7f46400a9000, 8192, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x10e000) = 0x7f46400a9000
mmap(0x7f46400ab000, 1704, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f46400ab000
close(3)= 0
open("/usr/lib/libgtk-x11-2.0.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, 
"\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\220\312\6\0\0\0\0\0"..., 832) = 
832
fstat(3, {st_mode=S_IFREG|0755, st_size=4419752, ...}) = 0
mmap(NULL, 6525176, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 
0x7f463f761000
mprotect(0x7f463fb8d000, 2097152, PROT_NONE) = 0
mmap(0x7f463fd8d000, 45056, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x42c000) = 0x7f463fd8d000
mmap(0x7f463fd98000, 8440, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f463fd98000
close(3)= 0
open("/usr/lib/libgdk-x11-2.0.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, 
"\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360\342\1\0\0\0\0\0"..., 832) = 
832
fstat(3, {st_mode=S_IFREG|0755, st_size=723960, ...}) = 0
mmap(NULL, 2820600, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 
0x7f463f4b
mprotect(0x7f463f55c000, 2093056, PROT_NONE) = 0
mmap(0x7f463f75b000, 24576, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xab000) = 0x7f463f75b000
close(3)= 0
open("/usr/lib/libatk-1.0.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p\261\0\0\0\0\0\0"..., 
832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=155064, ...}) = 0
mmap(NULL, 2251480, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 
0x7f463f28a000
mprotect(0x7f463f2ac000, 2097152, PROT_NONE) = 0
mmap(0x7f463f4ac000, 16384, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x22000) = 0x7f463f4ac000
close(3)= 0
open("/usr/lib/libgdk_pixbuf-2.0.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\240g\0\0\0\0\0\0"..., 
832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=146632, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x7f464049b000
mmap(NULL, 2242224, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 
0x7f463f066000
mprotect(0x7f463f088000, 2097152, PROT_NONE) = 0
mmap(0x7f463f288000, 8192, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x22000) = 0x7f463f288000
close(3)= 0
open("/usr/lib/libpangocairo-1.0.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\340O\0\0\0\0\0\0"..., 
832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=52424, ...}) = 0
mmap(NULL, 2147896, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 
0x7f463ee59000
mprotect(0x7f463ee65000, 2093056, PROT_NONE) = 0
mmap(0x7f463f064000, 8192, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE

Nero 4 Linux applications broken in 4.12

2017-07-05 Thread Chris Clayton
Hi.

I use the applications from Nero 4 Linux to write to blu-ray media, 
principally, but not exclusively, as part of my
back-up regime. Those applications have stopped working with Linux 4.12 because 
they fail to detect my drives (one built
in to my laptop and the other attached via USB). The applications successfully 
detect my drives with 4.11.8 and 4.9.35
kernels. I have been using the applications since 3.x.x days. Unfortunately, 
development of the applications has deeb
discontinued.

I've bisected the problem and the outcome is:

28676d869bbb5257b5f14c0c95ad3af3a7019dd5 is the first bad commit
commit 28676d869bbb5257b5f14c0c95ad3af3a7019dd5
Author: Johannes Thumshirn 
Date:   Fri Apr 7 09:34:15 2017 +0200

scsi: sg: check for valid direction before starting the request

Check for a valid direction before starting the request, otherwise we
risk running into an assertion in the scsi midlayer checking for valid
requests.

[mkp: fixed typo]

Signed-off-by: Johannes Thumshirn 
Link: http://www.spinics.net/lists/linux-scsi/msg104400.html
Reported-by: Dmitry Vyukov 
Signed-off-by: Hannes Reinecke 
Tested-by: Johannes Thumshirn 
Reviewed-by: Christoph Hellwig 
Signed-off-by: Martin K. Petersen 

:04 04 5f268585ddc59bdc4e7bd3b473b8e041f59083af 
6d44c177d8eb1df63a3e285e8a77010de0368d01 M  drivers

With this change reversed in 4.12.0, the applications can detect my drive 
again, although I haven't tried burning
anything to media yet.

Using kernels 4.11.8 and 4.12.0, I ran the console command "nerocmd --scanbus" 
under strace and logged the resultant
traces. The first material difference between the traces seems to be:

diff -up nerocmd-strace.log-4.11.8 nerocmd-strace.log-4.12.0  > 
nerocmd-strace.log.diff
--- nerocmd-strace.log-4.11.8   2017-07-04 22:25:19.251996566 +0100
+++ nerocmd-strace.log-4.12.0   2017-07-04 22:31:05.575997661 +0100
...
 open("/dev/sg0", O_RDWR)= 6
 ioctl(6, SG_SET_RESERVED_SIZE, [131072]) = 0
 ioctl(6, SG_SET_TIMEOUT, [1080])= 0
-write(6, "\0\0\0\0H\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 
42) = 42
-read(6, "H\0\0\0H\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 
72) = 72
+write(6, "\0\0\0\0H\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 
42) = -1 EINVAL (Invalid argument)
 close(6)= 0
 open("/dev/sg1", O_RDWR)= 6
 ioctl(6, SG_SET_RESERVED_SIZE, [131072]) = 0
 ioctl(6, SG_SET_TIMEOUT, [1080])= 0
-write(6, "\0\0\0\0H\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 
42) = 42
-read(6, "H\0\0\0H\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 
72) = 72
+write(6, "\0\0\0\0H\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 
42) = -1 EINVAL (Invalid argument)
 close(6)= 0
 open("/usr/lib64/nero/libMmc.so", O_RDONLY|O_CLOEXEC) = 6
 read(6, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0k\v\0\0\0\0\0"..., 
832) = 832
...

I can provide the full traces or any other diagnostics, if they would help.

Thanks

Chris