diff options
author | John Klug <john.klug@multitech.com> | 2017-02-01 12:44:43 -0600 |
---|---|---|
committer | John Klug <john.klug@multitech.com> | 2017-02-01 12:44:43 -0600 |
commit | 70bc629b902f50f1c16d366056440519e6ed2cca (patch) | |
tree | 29d8be88325680053cf819504ea3e186d76c7783 /recipes-navigation/gpsd/gpsd-3.16/0006-sysclockcrash.patch | |
parent | 3426d916c562b17fdbd6cf36f5879ef8b28336be (diff) | |
download | meta-mlinux-70bc629b902f50f1c16d366056440519e6ed2cca.tar.gz meta-mlinux-70bc629b902f50f1c16d366056440519e6ed2cca.tar.bz2 meta-mlinux-70bc629b902f50f1c16d366056440519e6ed2cca.zip |
Prevent gpsd from crashing when system clock changes with debug >= 4
Diffstat (limited to 'recipes-navigation/gpsd/gpsd-3.16/0006-sysclockcrash.patch')
-rw-r--r-- | recipes-navigation/gpsd/gpsd-3.16/0006-sysclockcrash.patch | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/recipes-navigation/gpsd/gpsd-3.16/0006-sysclockcrash.patch b/recipes-navigation/gpsd/gpsd-3.16/0006-sysclockcrash.patch new file mode 100644 index 0000000..e6b90f0 --- /dev/null +++ b/recipes-navigation/gpsd/gpsd-3.16/0006-sysclockcrash.patch @@ -0,0 +1,48 @@ +Before the fix, sample PPS Logs: +gpsd:PROG: KPPS:/dev/pps0 Clear cycle: -1236963952, duration: 1000000 @ (null) +gpsd:PROG: PPS:/dev/pps0 Clear cycle: 0, duration: 1000000 @ (null) + +With this fix, we see logs like this: +gpsd:PROG: KPPS:/dev/pps0 Clear cycle: 1000010, duration: 100003 @ 1577729345.554599378 +gpsd:PROG: PPS:/dev/pps0 Clear cycle: 1000010, duration: 100003 @ 1577729345.554599378 + +When the system clock changes without this fix, and the +debug level is 4 or greater, GPSD crashes on 32 bit ARM. +This fix prevents strlen() in vfprintf() from being given +a garbage pointer. cycle, cycle_kpps, duration and +duration_kpps are defined as long long, so by the C +standard, the format string is %lld. +======================================================================= +diff -Naur old/ppsthread.c new/ppsthread.c +--- old/ppsthread.c 2017-02-01 11:36:31.575212221 -0600 ++++ new/ppsthread.c 2017-02-01 11:44:48.269536679 -0600 +@@ -770,10 +770,9 @@ + edge_str = edge ? "Assert" : "Clear"; + cycle = cycle_tio; + duration = duration_tio; +- + timespec_str( &clock_ts, ts_str1, sizeof(ts_str1) ); + thread_context->log_hook(thread_context, THREAD_PROG, +- "TPPS:%s %.10s cycle: %d, duration: %d @ %s\n", ++ "TPPS:%s %.10s cycle: %lld, duration: %lld @ %s\n", + thread_context->devicename, edge_str, cycle, duration, + ts_str1); + +@@ -840,7 +839,7 @@ + + timespec_str( &clock_ts_kpps, ts_str1, sizeof(ts_str1) ); + thread_context->log_hook(thread_context, THREAD_PROG, +- "KPPS:%s %.10s cycle: %7d, duration: %7d @ %s\n", ++ "KPPS:%s %.10s cycle: %7lld, duration: %7lld @ %s\n", + thread_context->devicename, + edge_str, + cycle_kpps, duration_kpps, ts_str1); +@@ -898,7 +897,7 @@ + state_last = state; + timespec_str( &clock_ts, ts_str1, sizeof(ts_str1) ); + thread_context->log_hook(thread_context, THREAD_PROG, +- "PPS:%s %.10s cycle: %7d, duration: %7d @ %s\n", ++ "PPS:%s %.10s cycle: %7lld, duration: %7lld @ %s\n", + thread_context->devicename, + edge_str, + cycle, duration, ts_str1); |