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-next>] [day] [month] [year] [list]
Message-ID: <Y0LsreRGq3nbe2xC@localhost.localdomain>
Date:   Sun, 9 Oct 2022 18:45:49 +0300
From:   Alexey Dobriyan <adobriyan@...il.com>
To:     Willy Tarreau <w@....eu>
Cc:     lkp@...el.com, linux-kselftest@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        "Paul E. McKenney" <paulmck@...nel.org>
Subject: Re: tools/nolibc: fix missing strlen() definition and infinite loop
 with gcc-12

Willy Tarreau wrote:
> +#if defined(__GNUC__) && (__GNUC__ >= 12)
> +__attribute__((optimize("no-tree-loop-distribute-patterns")))
> +#endif
>  static __attribute__((unused))
> -size_t nolibc_strlen(const char *str

I'd suggest to use asm("") in the loop body. It worked in the past
to prevent folding division loop back into division instruction.

Or switch to 

	size_t f(const char *s)
	{
		const char *s0 = s;
		while (*s++)
			;
		return s - s0 - 1;
	}

which compiles to 1 branch, not 2.

But of course they could recognise this pattern too.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ