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: <65bad926-22fc-41da-b9c4-5857a002b377@suse.com>
Date: Mon, 13 Oct 2025 09:36:58 +0200
From: Jürgen Groß <jgross@...e.com>
To: Jan Beulich <jbeulich@...e.com>, Thorsten Blum <thorsten.blum@...ux.dev>
Cc: linux-hardening@...r.kernel.org, xen-devel@...ts.xenproject.org,
 linux-kernel@...r.kernel.org, Stefano Stabellini <sstabellini@...nel.org>,
 Oleksandr Tyshchenko <oleksandr_tyshchenko@...m.com>,
 Jason Andryuk <jason.andryuk@....com>,
 "Dr. David Alan Gilbert" <linux@...blig.org>
Subject: Re: [PATCH] drivers/xen/xenbus: Replace deprecated strcpy in
 xenbus_transaction_end

On 13.10.25 08:59, Jan Beulich wrote:
> On 12.10.2025 21:55, Thorsten Blum wrote:
>> --- a/drivers/xen/xenbus/xenbus_xs.c
>> +++ b/drivers/xen/xenbus/xenbus_xs.c
>> @@ -546,16 +546,13 @@ int xenbus_transaction_start(struct xenbus_transaction *t)
>>   EXPORT_SYMBOL_GPL(xenbus_transaction_start);
>>   
>>   /* End a transaction.
>> - * If abandon is true, transaction is discarded instead of committed.
>> + * If abort is true, transaction is discarded instead of committed.
>>    */
>> -int xenbus_transaction_end(struct xenbus_transaction t, int abort)
>> +int xenbus_transaction_end(struct xenbus_transaction t, bool abort)
>>   {
>>   	char abortstr[2];
>>   
>> -	if (abort)
>> -		strcpy(abortstr, "F");
>> -	else
>> -		strcpy(abortstr, "T");
> 
> While at least in principle a compiler might be able to transform this into
> code not using any library function at all, ...
> 
>> +	strscpy(abortstr, abort ? "F" : "T");
> 
> ... the use of a n on-standard function (without equivalent compiler builtin)
> doesn't permit this. IOW why not simply switch to e.g.
> 
>      char abortstr[2] = { [0] = abort ? 'F' : 'T' };

I would even go further and drop abortstr[] completely:

diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c
index 528682bf0c7f..c891af7165f5 100644
--- a/drivers/xen/xenbus/xenbus_xs.c
+++ b/drivers/xen/xenbus/xenbus_xs.c
@@ -550,14 +550,8 @@ EXPORT_SYMBOL_GPL(xenbus_transaction_start);
   */
  int xenbus_transaction_end(struct xenbus_transaction t, int abort)
  {
-       char abortstr[2];
-
-       if (abort)
-               strcpy(abortstr, "F");
-       else
-               strcpy(abortstr, "T");
-
-       return xs_error(xs_single(t, XS_TRANSACTION_END, abortstr, NULL));
+       return xs_error(xs_single(t, XS_TRANSACTION_END, abort ? "F" : "T",
+                       NULL));
  }
  EXPORT_SYMBOL_GPL(xenbus_transaction_end);


Juergen

Download attachment "OpenPGP_0xB0DE9DD628BF132F.asc" of type "application/pgp-keys" (3684 bytes)

Download attachment "OpenPGP_signature.asc" of type "application/pgp-signature" (496 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ