This very very likely was fixed a long time ago, but I wanted to be sure.
So I used this simple test program:
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <time.h>
void timespec_diff(const struct timespec *start, const struct timespec *stop,
struct timespec *result)
{
if ((stop->tv_nsec - start->tv_nsec) < 0) {
result->tv_sec = stop->tv_sec - start->tv_sec - 1;
result->tv_nsec = stop->tv_nsec - start->tv_nsec + 1000000000UL;
} else {
result->tv_sec = stop->tv_sec - start->tv_sec;
result->tv_nsec = stop->tv_nsec - start->tv_nsec;
}
return;
}
void timecheck(clockid_t clkid, int argc, char **argv)
{
struct timespec start, stop, dur;
if( clock_gettime( clkid, &start) == -1 ) {
perror( "clock gettime" );
exit( EXIT_FAILURE );
}
system( argv[1] );
if( clock_gettime( clkid, &stop) == -1 ) {
perror( "clock gettime" );
exit( EXIT_FAILURE );
}
timespec_diff(&start, &stop, &dur);
printf( "%4ld.%-12ld\n", dur.tv_sec, dur.tv_nsec);
}
int main( int argc, char **argv )
{
timecheck(CLOCK_REALTIME, argc, argv);
timecheck(CLOCK_REALTIME_COARSE, argc, argv);
timecheck(CLOCK_MONOTONIC, argc, argv);
timecheck(CLOCK_MONOTONIC_COARSE, argc, argv);
timecheck(CLOCK_MONOTONIC_RAW, argc, argv);
timecheck(CLOCK_BOOTTIME, argc, argv);
timecheck(CLOCK_PROCESS_CPUTIME_ID, argc, argv);
timecheck(CLOCK_THREAD_CPUTIME_ID, argc, argv);
return( EXIT_SUCCESS );
}
$ gcc -Wall -o test test.c
$ ./test "sleep 0.3s"
All working on aarch64.
That said we can drop this Delta from libqb.
I have used a libqb synced from Debian in a ppa that doesn't have this fix
without issues.
That said we can drop this on the next merge/sync of libqb.
Setting the tasks here to Fix released (the issue reported in this bug no more
exists).
** Changed in: linux (Ubuntu)
Status: Confirmed => Fix Released
** Changed in: libqb (Ubuntu)
Status: New => Fix Released
--
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1239109
Title:
aarch64 clock_gettime with CLOCK_REALTIME_COARSE or
CLOCK_MONOTONIC_COARSE fails with SIGBUS or SIGSEGV
Status in libqb package in Ubuntu:
Triaged
Status in linux package in Ubuntu:
Fix Released
Bug description:
The aarch64 vDSO __kernel_clock_gettime implementation crashes when
clock_gettime is called with CLOCK_MONOTONIC_COARSE or
CLOCK_REALTIME_COARSE, with a SIGSEGV or SIGBUS respectively.
In the implementation
(http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/kernel/vdso/gettimeofday.S#n89)
a value other than CLOCK_REALTIME or CLOCK_MONOTONIC branches past the
usual "mov x2, x30" which preserves lr for return later. Anything
other than CLOCK_REALTIME_COARSE and CLOCK_MONOTONIC_COARSE then
branches directly to the svc call, which correctly returns to the
caller. But CLOCK_REALTIME_COARSE and CLOCK_MONOTONIC_COARSE execute
the special coarse path then fall through to the normal
CLOCK_REALTIME/CLOCK_MONOTONIC path, which does a 'ret x2' at the end,
despite not having saved x30 to x2 in the _COARSE case. So it ends up
setting pc to clk_id, which is either 4 or 5, giving a translation or
alignment fault.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/libqb/+bug/1239109/+subscriptions
--
Mailing list: https://launchpad.net/~kernel-packages
Post to : [email protected]
Unsubscribe : https://launchpad.net/~kernel-packages
More help : https://help.launchpad.net/ListHelp