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: <62441255-45fc-4edb-a8e5-c208b36ca2c2@web.de>
Date: Thu, 30 Oct 2025 10:33:07 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: Julia Lawall <julia.lawall@...ia.fr>, cocci@...ia.fr
Cc: LKML <linux-kernel@...r.kernel.org>, kernel-janitors@...r.kernel.org,
 Miaoqian Lin <linmq006@...il.com>
Subject: Re: [cocci] [RFC] Increasing usage of direct pointer assignments from
 memcpy() calls with SmPL?

>> It can be determined then from the generated diff file that mentioned
>> implementation details can be transformed in 304 source files at the moment.
>> Thus I became curious if it would be supported to adjust any places there
>> according to (Linux) coding style preferences.
> 
> If you have a concern, you have to say what it is.

I expressed something for further development considerations.
The source code analysis result can be interpreted in some directions.


>                                                     It doesn't seem it is
> about the running time,

Not directly in this case.


>                         so why do you include that information?

Further software users can compare such a measurement with other observations.


> I should not have to repeat your experiment to figure out what you are
> asking about.

You can recognise recurring development challenges, can't you?

* Change resistance

* Varying coding style preferences

* Code improvement possibilities

* Development resources

* Pretty-printing issues


Another test result representation for your convenience:
https://elixir.bootlin.com/linux/v6.18-rc3/source/arch/arm64/kvm/arm.c#L2554-L2726

Markus_Elfring@...ne:…/Projekte/Linux/next-analyses> time /usr/bin/spatch --max-width 100 --no-loops …/Projekte/Coccinelle/janitor/use_memcpy_assignment.cocci arch/arm64/kvm/arm.c
…
@@ -2600,8 +2600,8 @@ static int __init init_hyp_mode(void)
                        goto out_err;
                }
 
-               page_addr = page_address(page);
-               memcpy(page_addr, CHOOSE_NVHE_SYM(__per_cpu_start), nvhe_percpu_size());
+               page_addr =
+               memcpy(page_address(page), CHOOSE_NVHE_SYM(__per_cpu_start), nvhe_percpu_size());
                kvm_nvhe_sym(kvm_arm_hyp_percpu_base)[cpu] = (unsigned long)page_addr;
        }
 

real    0m0,606s
user    0m0,576s
sys     0m0,030s



Another SmPL script example might become helpful.

@replacement2@
expression object, size, source, target;
@@
 target =
-         object; memcpy(target, source, size)
+         memcpy(object, source, size)
 ;


Markus_Elfring@...ne:…/Projekte/Linux/next-analyses> time /usr/bin/spatch --max-width 100 --no-loops …/Projekte/Coccinelle/janitor/use_memcpy_assignment2.cocci arch/arm64/kvm/arm.c
…
@@ -2600,8 +2600,8 @@ static int __init init_hyp_mode(void)
                        goto out_err;
                }
 
-               page_addr = page_address(page);
-               memcpy(page_addr, CHOOSE_NVHE_SYM(__per_cpu_start), nvhe_percpu_size());
+               page_addr =memcpy(page_address(page), CHOOSE_NVHE_SYM(__per_cpu_start),
+                                 nvhe_percpu_size());
                kvm_nvhe_sym(kvm_arm_hyp_percpu_base)[cpu] = (unsigned long)page_addr;
        }
 

real    0m0,626s
user    0m0,588s
sys     0m0,037s


Regards,
Markus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ