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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20260203103000.20206-1-david.laight.linux@gmail.com>
Date: Tue,  3 Feb 2026 10:29:48 +0000
From: david.laight.linux@...il.com
To: Willy Tarreau <w@....eu>,
	Thomas Weißschuh <linux@...ssschuh.net>,
	linux-kernel@...r.kernel.org,
	Cheng Li <lechain@...il.com>
Cc: David Laight <david.laight.linux@...il.com>
Subject: [PATCH next 00/12] tools/nolibc: Enhance printf()

From: David Laight <david.laight.linux@...il.com>

Update printf() so that it handles almost all the non-fp formats.
In particular:
- Left alignment.
- Zero padding.
- Field precision.
- Variable field width and precision.
- Width modifiers q, L, t and z.
- Conversion specifiers i and X (X generates lower case).
About the only thing that is missing is octal.

The tests are updated to match.

There is a slight increase in code size, but it is minimalised
by the the heavy use of bit-pattern matches.

vfprintf() is modified to buffer data for each call and do a single
write system call at the end.
This improves performance somewhat, but is actually most useful when
using strace.

David Laight (12):
  tools/nolibc/printf: Move snprintf length check to callback
  tools/nolibc/printf: Add buffering to vfprintf() callback.
  tools/nolibc: change printf() to output pad in 16 byte chunks
  selftests/nolibc: Improve reporting of vfprintf() errors
  tools/nolibc/stdio: Simplify __nolibc_printf()
  tools/nolibc: Add support for left alignment and %[tzq]d" to printf
  tools/nolibc: printf() prepend the sign after a numeric conversion
  tools/nolibc: use bit-match to detect valid printf conversion
    character
  tools/nolibc: add precision and zero padding to printf()
  tools/nolibc: Use bit-pattern for printf integral formats
  selftests/nolibc: Increase coverage of printf format tests
  selftests/nolibc: Use printf("%.*s", n, "") to align output

 tools/include/nolibc/stdio.h                 | 396 +++++++++++++------
 tools/testing/selftests/nolibc/nolibc-test.c |  96 +++--
 2 files changed, 336 insertions(+), 156 deletions(-)

-- 
2.39.5


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ