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] [day] [month] [year] [list]
Date:   Fri, 13 May 2022 11:14:34 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Daniel Borkmann' <daniel@...earbox.net>,
        liqiong <liqiong@...china.com>, Yonghong Song <yhs@...com>,
        Andrii Nakryiko <andrii@...nel.org>,
        "Martin KaFai Lau" <kafai@...com>, Song Liu <songliubraving@...com>
CC:     Alexei Starovoitov <ast@...nel.org>,
        John Fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...nel.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "bpf@...r.kernel.org" <bpf@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "hukun@...china.com" <hukun@...china.com>,
        "qixu@...china.com" <qixu@...china.com>,
        "yuzhe@...china.com" <yuzhe@...china.com>,
        "renyu@...china.com" <renyu@...china.com>
Subject: RE: [PATCH 1/2] kernel/bpf: change "char *" string form to "char []"

From: Daniel Borkmann
> Sent: 12 May 2022 22:00
> 
> On 5/12/22 7:08 PM, liqiong wrote:
> > 在 2022年05月12日 23:16, Yonghong Song 写道:
> >>
> >> On 5/12/22 7:28 AM, liqiong wrote:
> >>> The string form of "char []" declares a single variable. It is better
> >>> than "char *" which creates two variables.
> >>
> >> Could you explain in details about why it is better in generated codes?
> >> It is not clear to me why your patch is better than the original code.
> >
> > The  string form of "char *" creates two variables in the final assembly output,
> > a static string, and a char pointer to the static string.  Use  "objdump -S -D  *.o",
> > can find out the static string  occurring  at "Contents of section .rodata".
> 
> There are ~360 instances of this type in the tree from a quick grep, do you
> plan to convert all them ?

There are also all the places with const char *names[] = ...;
where the actual names are all similar length so replacing with
const char names[][n] saves space.

Although that transformation has a bigger effect on shared libs.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ