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: <98c83922-6ab1-98ca-7682-7796ae1facf4@infradead.org>
Date:   Sun, 1 Sep 2019 19:10:11 -0700
From:   Randy Dunlap <rdunlap@...radead.org>
To:     Linus Torvalds <torvalds@...ux-foundation.org>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Al Viro <viro@...iv.linux.org.uk>,
        "Steven J. Magnani" <steve@...idescorp.com>,
        Michal Simek <monstr@...str.eu>,
        Jason Gunthorpe <jgg@...lanox.com>,
        Leon Romanovsky <leonro@...lanox.com>,
        Doug Ledford <dledford@...hat.com>,
        Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH v3] arch/microblaze: add support for get_user() of size 8
 bytes

On 9/1/19 12:10 PM, Randy Dunlap wrote:
> On 9/1/19 10:31 AM, Linus Torvalds wrote:
>> On Sun, Sep 1, 2019 at 10:07 AM Linus Torvalds
>> <torvalds@...ux-foundation.org> wrote:
>>>
>>> I guess I'll apply it. I'm not sure why you _care_ about microblaze, but ...
> 
> It was just a response to the 0day build bot reporting build errors.
> 
> 
>> Ugh. As I was going to apply it, my code cleanliness conscience struck.
>>
>> I can't deal with that unnecessary duplication of code. Does something
>> like the attached patch work instead?
>>
>> Totally untested, but looks much cleaner.
> 
> Hm, I'm getting one (confusing) build error, in block/scsi_ioctl.c:
> 
>   CC      block/scsi_ioctl.o
> In file included from ../include/linux/uaccess.h:11,
>                  from ../include/linux/highmem.h:9,
>                  from ../include/linux/pagemap.h:11,
>                  from ../include/linux/blkdev.h:16,
>                  from ../block/scsi_ioctl.c:9:
> ../block/scsi_ioctl.c: In function 'sg_scsi_ioctl':
> ../arch/microblaze/include/asm/uaccess.h:167:25: error: invalid initializer
>   typeof(ptr) __gu_ptr = (ptr);   \
>                          ^
> ../block/scsi_ioctl.c:426:6: note: in expansion of macro 'get_user'
>   if (get_user(opcode, sic->data))
>       ^~~~~~~~

	if (get_user(opcode, sic->data))
		return -EFAULT;

where sic->data is unsigned char data[0] here:

typedef struct scsi_ioctl_command {
	unsigned int inlen;
	unsigned int outlen;
	unsigned char data[0];
} Scsi_Ioctl_Command;

On x86_64 this builds as a call to get_user_1().
(cannot do objdump on arch/microblaze/, unknown arch/machine)

I guess we need a way to coerce that to call get_user_1(),
such as a typecast.  This _seems_ to work (i.e., call get_user_1()):

	if (get_user(opcode, (unsigned char *)(sic->data)))
		return -EFAULT;

??

-- 
~Randy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ