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]
Date:   Sun, 16 Jul 2023 00:26:58 +0200
From:   Willy Tarreau <w@....eu>
To:     Zhangjin Wu <falcon@...ylab.org>
Cc:     arnd@...db.de, linux-kernel@...r.kernel.org,
        linux-kselftest@...r.kernel.org, thomas@...ch.de
Subject: Re: [PATCH v4 00/18] tools/nolibc: shrink arch support

Hi Zhangjin,

On Sun, Jul 16, 2023 at 02:16:36AM +0800, Zhangjin Wu wrote:
> Hi, Willy, Thomas
> 
> Thanks very much for your careful review and great suggestions, now, we
> get v4 revision of the arch shrink series [1], it mainly include a new
> fixup for -O0 under gcc < 11.1.0, the stackprotector support for
> _start_c(), new testcases for startup code and two new test targets.
> 
> All of the tests passed or skipped (tinyconfig + few options +
> qemu-system) for both -Os and -O0:
(...)

First, good news, it looks OK from the nolibc-test perspective and
by looking at the code, so I merged all this into branch

  20230715-nolibc-next-1

Second, bad news, my preinit code doesn't build anymore due to missing
definitions for statx. It's built using the default method which involves
just including nolibc.h (and getting linux includes from the default path).
I could simplify it to this one-liner:

  $ printf "int test_stat(const char *p, struct stat *b) { return stat(p,b); }\n" |
    gcc -c -o test.o -xc - -nostdlib -include ./sysroot/x86/include/nolibc.h

  In file included from ././sysroot/x86/include/nolibc.h:98:0,
                   from <command-line>:32:
  ././sysroot/x86/include/sys.h:952:78: warning: 'struct statx' declared inside parameter list will not be visible outside of this definition or declaration
   int sys_statx(int fd, const char *path, int flags, unsigned int mask, struct statx *buf)
                                                                                ^~~~~
  ././sysroot/x86/include/sys.h:962:74: warning: 'struct statx' declared inside parameter list will not be visible outside of this definition or declaration
   int statx(int fd, const char *path, int flags, unsigned int mask, struct statx *buf)
                                                                            ^~~~~
  ././sysroot/x86/include/sys.h: In function 'statx':
  ././sysroot/x86/include/sys.h:964:51: warning: passing argument 5 of 'sys_statx' from incompatible pointer type [-Wincompatible-pointer-types]
    return __sysret(sys_statx(fd, path, flags, mask, buf));
                                                     ^~~
  ././sysroot/x86/include/sys.h:952:5: note: expected 'struct statx *' but argument is of type 'struct statx *'
   int sys_statx(int fd, const char *path, int flags, unsigned int mask, struct statx *buf)
       ^~~~~~~~~
  ././sysroot/x86/include/sys.h: In function 'stat':
  ././sysroot/x86/include/sys.h:971:15: error: storage size of 'statx' isn't known
    struct statx statx;
                 ^~~~~
  ././sysroot/x86/include/sys.h:974:60: error: 'STATX_BASIC_STATS' undeclared (first use in this function)
    ret = __sysret(sys_statx(AT_FDCWD, path, AT_NO_AUTOMOUNT, STATX_BASIC_STATS, &statx));
                                                              ^~~~~~~~~~~~~~~~~
  ././sysroot/x86/include/sys.h:974:60: note: each undeclared identifier is reported only once for each function it appears in

I finally found that it's due to the lack of -Isysroot/x86/include, so
it used to get linux includes from those provided by glibc and these ones
were missing statx since packaged for an older kernel.

I knew that sooner or later I'd have to reinstall this machine but I
can't get out of my head that to date I have yet not been convinced by
the absolute necessity of this modification which is progressively adding
more burden :-/  Time will tell...

Cheers,
Willy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ