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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ad81ad1b-b960-4b24-e916-38459479e7f0@huawei.com>
Date:   Wed, 10 Jan 2018 15:40:20 +0800
From:   Hanjun Guo <guohanjun@...wei.com>
To:     Laura Abbott <labbott@...hat.com>,
        Dan Williams <dan.j.williams@...el.com>,
        <linux-kernel@...r.kernel.org>, Mark Rutland <mark.rutland@....com>
CC:     <linux-arch@...r.kernel.org>, <peterz@...radead.org>,
        <netdev@...r.kernel.org>, <gregkh@...uxfoundation.org>,
        <tglx@...utronix.de>, <torvalds@...ux-foundation.org>,
        <alan@...ux.intel.com>, Justin Forbes <jforbes@...hat.com>
Subject: Re: [PATCH 04/18] arm: implement nospec_ptr()

On 2018/1/10 10:04, Laura Abbott wrote:
> On 01/05/2018 05:10 PM, Dan Williams wrote:
>> From: Mark Rutland <mark.rutland@....com>
>>
>> This patch implements nospec_ptr() for arm, following the recommended
>> architectural sequences for the arm and thumb instruction sets.
>>
> Fedora picked up the series and it fails on arm:
> 
> In file included from ./include/linux/compiler.h:242:0,
>                  from ./include/uapi/linux/swab.h:6,
>                  from ./include/linux/swab.h:5,
>                  from ./arch/arm/include/asm/opcodes.h:89,
>                  from ./arch/arm/include/asm/bug.h:7,
>                  from ./include/linux/bug.h:5,
>                  from ./include/linux/mmdebug.h:5,
>                  from ./include/linux/gfp.h:5,
>                  from ./include/linux/slab.h:15,
>                  from kernel/fork.c:14:
> ./include/linux/fdtable.h: In function '__fcheck_files':
> ./arch/arm/include/asm/barrier.h:112:41: error: expected declaration specifiers or '...' before numeric constant
>   __load_no_speculate(&__np_ptr, lo, hi, 0, __np_ptr);  \
>                                          ^
> ./arch/arm/include/asm/barrier.h:68:32: note: in definition of macro '__load_no_speculate_n'
>    (typeof(*ptr)(unsigned long)(failval));  \
>                                 ^~~~~~~
> ./arch/arm/include/asm/barrier.h:112:2: note: in expansion of macro '__load_no_speculate'
>   __load_no_speculate(&__np_ptr, lo, hi, 0, __np_ptr);  \
>   ^~~~~~~~~~~~~~~~~~~
> ./include/asm-generic/barrier.h:122:2: note: in expansion of macro 'nospec_ptr'
>   nospec_ptr(__arr + __idx, __arr, __arr + __sz);   \
>   ^~~~~~~~~~
> ./include/linux/fdtable.h:86:13: note: in expansion of macro 'nospec_array_ptr'
>   if ((fdp = nospec_array_ptr(fdt->fd, fd, fdt->max_fds)))
>              ^~~~~~~~~~~~~~~~
> ./arch/arm/include/asm/barrier.h:112:41: error: expected declaration specifiers or '...' before numeric constant
>   __load_no_speculate(&__np_ptr, lo, hi, 0, __np_ptr);  \
>                                          ^
> ./arch/arm/include/asm/barrier.h:68:32: note: in definition of macro '__load_no_speculate_n'
>    (typeof(*ptr)(unsigned long)(failval));  \
>                                 ^~~~~~~
> ./arch/arm/include/asm/barrier.h:112:2: note: in expansion of macro '__load_no_speculate'
>   __load_no_speculate(&__np_ptr, lo, hi, 0, __np_ptr);  \
>   ^~~~~~~~~~~~~~~~~~~
> ./include/asm-generic/barrier.h:122:2: note: in expansion of macro 'nospec_ptr'
>   nospec_ptr(__arr + __idx, __arr, __arr + __sz);   \
>   ^~~~~~~~~~
> ./include/linux/fdtable.h:86:13: note: in expansion of macro 'nospec_array_ptr'
>   if ((fdp = nospec_array_ptr(fdt->fd, fd, fdt->max_fds)))
>              ^~~~~~~~~~~~~~~~
> ./arch/arm/include/asm/barrier.h:112:41: error: expected declaration specifiers or '...' before numeric constant
>   __load_no_speculate(&__np_ptr, lo, hi, 0, __np_ptr);  \
>                                          ^
> ./arch/arm/include/asm/barrier.h:68:32: note: in definition of macro '__load_no_speculate_n'
>    (typeof(*ptr)(unsigned long)(failval));  \
>                                 ^~~~~~~
> ./arch/arm/include/asm/barrier.h:112:2: note: in expansion of macro '__load_no_speculate'
>   __load_no_speculate(&__np_ptr, lo, hi, 0, __np_ptr);  \
>   ^~~~~~~~~~~~~~~~~~~
> ./include/asm-generic/barrier.h:122:2: note: in expansion of macro 'nospec_ptr'
>   nospec_ptr(__arr + __idx, __arr, __arr + __sz);   \
>   ^~~~~~~~~~
> ./include/linux/fdtable.h:86:13: note: in expansion of macro 'nospec_array_ptr'
>   if ((fdp = nospec_array_ptr(fdt->fd, fd, fdt->max_fds)))
> 
> I can't puzzle out what exactly is the problem here, except that it really
> does not seem to like that failval. Does the arm compiler not like doing
> the typeof with the __arr + __idx?

>> +#define __load_no_speculate_n(ptr, lo, hi, failval, cmpptr, sz)    \
>> +({                                \
>> +    typeof(*ptr) __nln_val;                    \
>> +    typeof(*ptr) __failval =                \
>> +        (typeof(*ptr)(unsigned long)(failval));        \

Just typo,

-         (typeof(*ptr)(unsigned long)(failval));         \
+         (typeof(*ptr))(unsigned long)(failval);             \

Please try it.

Thanks
Hanjun

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ