Commit Graph

9 Commits

Author SHA1 Message Date
Joseph Myers 38d01bd6df Fix elf/sotruss-lib format-truncation error.
Building 64-bit glibc with GCC mainline fails with:

../elf/sotruss-lib.c: In function 'la_version':
../elf/sotruss-lib.c:91:28: error: '%lu' directive output may be truncated writing between 1 and 20 bytes into a region of size 11 [-Werror=format-truncation=]
      snprintf (endp, 12, ".%lu", (unsigned long int) pid);
                            ^~~
../elf/sotruss-lib.c:91:26: note: using the range [1, 18446744073709551615] for directive argument
      snprintf (endp, 12, ".%lu", (unsigned long int) pid);
                          ^~~~~~
../elf/sotruss-lib.c:91:6: note: format output between 3 and 22 bytes into a destination of size 12
      snprintf (endp, 12, ".%lu", (unsigned long int) pid);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Pids from getpid cannot actually be negative, but the compiler doesn't
know this.  Other places in this file use (signed) long int for
printing, so this patch makes this place do so as well.  Then it
increases the buffer size by one byte to allow for the minus sign that
can't actually occur.  It doesn't seem worth using diagnostic pragmas
to save one byte; other place in this file just use a cruder 3 *
sizeof (pid_t) calculation for number of digits.

Tested with GCC mainline with compilation for aarch64 with
build-many-glibcs.py, and with glibc testsuite for x86_64 (built with
GCC 6).

	* elf/sotruss-lib.c (init): Increase space allocated for pid by
	one byte.  Print it with %ld, cast to long int.
2017-01-11 13:57:59 +00:00
Joseph Myers bfff8b1bec Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
Joseph Myers f7a9f785e5 Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
Joseph Myers b168057aaa Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
Allan McRae d4697bc93d Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
Joseph Myers 568035b787 Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
David S. Miller 2d2cd51564 Fix bugs in sparc PLT profiling register management, and add sparc sotruss support.
* sysdeps/sparc/sparc32/dl-machine.h (elf_machine_rela): Protect local
	variables with appropriate CPP guards.
	* sysdeps/sparc/sparc32/dl-trampoline.S: Propagate the stack_ptr from the
	frame pointer, not the stack pointer.  Correct layout comments.  Fix test
	on resulting framesize and the management of the outregs buffer for pltexit.
	Preserve floating point return values across _dl_call_pltexit call.
	* sysdeps/sparc/sparc64/dl-trampoline.S: Fix test on resulting
	framesize and the management of the outregs buffer for pltexit.
	Preserve floating point return values across _dl_call_pltexit
	call.
	* elf/sotruss-lib.c (la_sparc32_gnu_pltenter, la_sparc64_gnu_pltenter,
	la_sparc32_gnu_pltexit, la_sparc64_gnu_pltexit): New functions.
	(print_exit): Fix format string for return register value.
2012-03-09 20:48:06 -08:00
Paul Eggert 59ba27a63a Replace FSF snail mail address with URLs. 2012-02-09 23:18:22 +00:00
Ulrich Drepper a917104752 Add sotruss program 2011-05-28 13:20:12 -04:00