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]
Date:   Thu, 14 Mar 2019 12:07:22 +0100
From:   Rasmus Villemoes <linux@...musvillemoes.dk>
To:     David Laight <David.Laight@...LAB.COM>,
        'Nick Desaulniers' <ndesaulniers@...gle.com>,
        "akpm@...ux-foundation.org" <akpm@...ux-foundation.org>
Cc:     "clang-built-linux@...glegroups.com" 
        <clang-built-linux@...glegroups.com>,
        "linux-kbuild@...r.kernel.org" <linux-kbuild@...r.kernel.org>,
        "stable@...r.kernel.org" <stable@...r.kernel.org>,
        Nathan Chancellor <natechancellor@...il.com>,
        Adhemerval Zanella <adhemerval.zanella@...aro.org>,
        Arnd Bergmann <arnd@...db.de>,
        James Y Knight <jyknight@...gle.com>,
        Masahiro Yamada <yamada.masahiro@...ionext.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Dan Williams <dan.j.williams@...el.com>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4] lib/string.c: implement a basic bcmp

On 14/03/2019 10.57, David Laight wrote:
> From: Nick Desaulniers
>> Sent: 13 March 2019 21:14
> ...
>> diff --git a/include/linux/string.h b/include/linux/string.h
>> index 7927b875f80c..6ab0a6fa512e 100644
>> --- a/include/linux/string.h
>> +++ b/include/linux/string.h
>> @@ -150,6 +150,9 @@ extern void * memscan(void *,int,__kernel_size_t);
>>  #ifndef __HAVE_ARCH_MEMCMP
>>  extern int memcmp(const void *,const void *,__kernel_size_t);
>>  #endif
>> +#ifndef __HAVE_ARCH_BCMP
>> +extern int bcmp(const void *,const void *,__kernel_size_t);
>> +#endif
> 
> Shouldn't that prototype always be present?

Yes and no. The problem is that asm/string.h may decide to implement
bcmp (or memcpy, memset, strcpy, ...) as a macro, which would break
rather badly when used to declare the function. And we can't undef the
macro temporarily. So I think the convention is that asm/string.h
provides the prototype before it #defines the macro, see e.g.
arch/x86/include/asm/string_32.h which has a #define of memcpy.

There is a fix for the "may be defined as a function-like macro", which is

extern int (bcmp)(const void *,const void *,__kernel_size_t);

I'd like to see that used rather than the ad hoc convention, but it is
of course somewhat unconventional C.

Rasmus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ