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-next>] [day] [month] [year] [list]
Message-ID: <CAHP4M8UK6AYVORHCndpw2ZeRLDN+BMj3enJ-+2SWtbOPSqUe9A@mail.gmail.com>
Date:   Mon, 8 Nov 2021 13:12:37 +0530
From:   Ajay Garg <ajaygargnsit@...il.com>
To:     Andy Shevchenko <andy.shevchenko@...il.com>
Cc:     "andy@...nel.org" <andy@...nel.org>,
        Kees Cook <keescook@...omium.org>,
        "akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
        "adobriyan@...il.com" <adobriyan@...il.com>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        "linux-hardening@...r.kernel.org" <linux-hardening@...r.kernel.org>
Subject: Re: RFC for a new string-copy function, using mixtures of strlcpy and strscpy

>>
>> The output is as follows :
>>
>> ######################################################
>> Using [strlcpy] ::
>>
>> len = [16]
>> a = [123456789]
>>
>>
>> Using [strscpy] ::
>>
>> len = [-7]
>> a = [123456789]
>>
>
> My gosh, this is error code that you must check. We do not need more string copy functions.
>
>

Hmm, having the additional function would make things a lot easier.

For example, in file fs/kernfs/dir.c, there are methods like
"kernfs_name_locked", "kernfs_path_from_node_locked" which simply
consume the return-value without any checks.

All the above functions have a simple motive : copy as much bytes as
possible in the destination buffer, and then consume/return the number
of bytes actually copied (minus the null-terminator byte of course).

If checks are to be put in-place, it would be too much code/churn,
adding if checks all over the place.
If, instead we do a simple replace of "strlcpy" with "strlscpy" at
these places, we would be good to go (while *really* meeting the
requirements of these clients at the same time).


Anyhow, may be we can wait for some more opinions.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ