Files
iputils/ping
Cyril Hrubis 1c4e790b17 ping: Fix unaligned access in struct ping_rts
The outbuf in struct ping_rts is used as a buffer for composing outgoing
packets, the problem was that it was accessed in larger chunks than a
byte but at the same time the buffer is defined as an array of bytes,
hence the memory alignment was not guaranteed.

This was found on SPARC where ping crashed with SIGBUS when attempting
to call gettimeofday() with a pointer inside of the outbuf buffer. There
are many more cases in the code where we access the array by a larger
than byte quantities that were working fine only by a chance as most of
the time the outpack buffer was accidentally aligned to four byte
boundary (since the start of the structure has to be aligned for 64bit
on 64bit machine and the array is preceeded by 32bit integer).

The proper solution is to add the aligned attribute to the array, which
forces the start of the outpack array to be aligned to the largest data
type used on the targed machine.

Fixes: https://github.com/iputils/iputils/issues/598
Closes: https://github.com/iputils/iputils/pull/600
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
Reported-by: Stian Halseth <stian@itx.no>
Tested-by: Stian Halseth <stian@itx.no>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
2025-10-14 12:14:30 +02:00
..
2025-09-01 16:18:27 +02:00
2024-03-14 14:45:29 +01:00
2025-09-01 16:18:27 +02:00
2025-09-01 16:18:27 +02:00
2025-09-01 16:18:27 +02:00