about summary refs log tree commit diff
path: root/elf/dl-printf.c
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright dates with scripts/update-copyrightsPaul Eggert2024-01-011-1/+1
|
* elf: Fix _dl_debug_vdprintf to work before self-relocationAdhemerval Zanella2023-11-211-2/+14
| | | | | | | | | | | | | The strlen might trigger and invalid GOT entry if it used before the process is self-relocated (for instance on dl-tunables if any error occurs). For i386, _dl_writev with PIE requires to use the old 'int $0x80' syscall mode because the calling the TLS register (gs) is not yet initialized. Checked on x86_64-linux-gnu. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* elf: fix handling of negative numbers in dl-printfRoy Eldar2023-05-251-3/+10
| | | | | | | | | | | | _dl_debug_vdprintf is a bare-bones printf implementation; currently printing a signed integer (using "%d" format specifier) behaves incorrectly when the number is negative, as it just prints the corresponding unsigned integer, preceeded by a minus sign. For example, _dl_printf("%d", -1) would print '-4294967295'. Signed-off-by: Roy Eldar <royeldar0@gmail.com> Reviewed-by: Florian Weimer <fweimer@redhat.com>
* Update copyright dates with scripts/update-copyrightsJoseph Myers2023-01-061-1/+1
|
* elf: Remove allocate use on _dl_debug_printfAdhemerval Zanella2022-11-021-8/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The maximum number of directives is already limited by the maximum value of iovec, and current padding usage on _dl_map_object_from_fd specifies a value of 16 (2 times sizeof (void *)) in hexa, which is less than the INT_STRLEN_BOUND(void *) (20 for LP64). This works if pointers are larger than 8 bytes, for instance 16. In this case the maximum padding would be 32 and the IFMTSIZE would be 40. The resulting code does use a slightly larger static stack, the output of -fstack-usage (for x86_64): * master: dl-printf.c:35:1:_dl_debug_vdprintf 1344 dynamic * patch: dl-printf.c:36:1:_dl_debug_vdprintf 2416 static However, there is an improvement in code generation: * master text data bss dec hex filename 3309 0 0 3309 ced elf/dl-printf.os * patch text data bss dec hex filename 3151 0 0 3151 c4f elf/dl-printf.os Checked on x86_64-linux-gnu. Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
* elf: Fix alloca size in _dl_debug_vdprintfSzabolcs Nagy2022-10-281-2/+5
| | | | | | | | | | | | | The alloca size did not consider the optional width parameter for padding which could cause buffer underflow. The width is currently used e.g. by _dl_map_object_from_fd which passes 2 * sizeof(void *) which can be larger than the alloca buffer size on targets where sizeof(void *) >= 2 * sizeof(unsigned long). Even if large width is not used on existing targets it is better to fix the formatting code to avoid surprises. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* Use '%z' instead of '%Z' on printf functionsAdhemerval Zanella Netto2022-09-221-1/+1
| | | | | | | | The Z modifier is a nonstandard synonymn for z (that predates z itself) and compiler might issue an warning for in invalid conversion specifier. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* elf: Split dl-printf.c from dl-misc.cFlorian Weimer2022-01-141-0/+292
This allows to use different compiler flags for the diagnostics code. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>