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: <2f4bd46c-664e-4253-8d57-16bd46dd3be8@cornelisnetworks.com>
Date: Fri, 22 Sep 2023 09:25:39 -0500
From: Dean Luick <dean.luick@...nelisnetworks.com>
To: Leon Romanovsky <leon@...nel.org>,
 Dennis Dalessandro <dennis.dalessandro@...nelisnetworks.com>,
 Jason Gunthorpe <jgg@...pe.ca>, Justin Stitt <justinstitt@...gle.com>
Cc: linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org,
 linux-hardening@...r.kernel.org
Subject: Re: [PATCH] IB/hfi1: replace deprecated strncpy

On 9/22/2023 5:29 AM, Leon Romanovsky wrote:
>
> On Thu, 21 Sep 2023 07:17:47 +0000, Justin Stitt wrote:
>> `strncpy` is deprecated for use on NUL-terminated destination strings
>> [1] and as such we should prefer more robust and less ambiguous string
>> interfaces.
>>
>> We see that `buf` is expected to be NUL-terminated based on it's use
>> within a trace event wherein `is_misc_err_name` and `is_various_name`
>> map to `is_name` through `is_table`:
>> | TRACE_EVENT(hfi1_interrupt,
>> |        TP_PROTO(struct hfi1_devdata *dd, const struct is_table *is_entry,
>> |                 int src),
>> |        TP_ARGS(dd, is_entry, src),
>> |        TP_STRUCT__entry(DD_DEV_ENTRY(dd)
>> |                         __array(char, buf, 64)
>> |                         __field(int, src)
>> |                         ),
>> |        TP_fast_assign(DD_DEV_ASSIGN(dd);
>> |                       is_entry->is_name(__entry->buf, 64,
>> |                                         src - is_entry->start);
>> |                       __entry->src = src;
>> |                       ),
>> |        TP_printk("[%s] source: %s [%d]", __get_str(dev), __entry->buf,
>> |                  __entry->src)
>> | );
>>
>> [...]
>
> Applied, thanks!

It is unfortunate that this and the qib patch was accepted so quickly.  The replacement is functionally correct.  However, I was going to suggest using strscpy() since the return value is never looked at and all use cases only require a NUL-terminated string.  Padding is not needed.

>
> [1/1] IB/hfi1: replace deprecated strncpy
>       https://git.kernel.org/rdma/rdma/c/c2d0c5b28a77d5
>
> Best regards,

External recipient

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ