Wind River Support Network

HomeSafety and Security NoticesThe leap second handling in WRLinux (update 07/22/2015)
Recommended

The leap second handling in WRLinux (update 07/22/2015)

Released: Feb 9, 2015     Updated: Jul 22, 2015

Summary

The leap second handling in WRLinux


Affected Product Versions

Wind River Linux 5, Wind River Linux 6, Wind River Linux 4, Linux Platforms 2.0

Downloads


Description

 

If you have already readed and applied the patches of the page prior to 07/22/2015, you only need to read the UPDATE section.

UPDATE 07/22/2015
==================

A new issue LIN4-32844 (Leap Second Isssue and Deadlock) has been found:

a) Description:

A system dead lock can be triggered by certain system configuration and workload
after the leap second insertion because of a recursive locking of the time keeper lock.

b) WRLinux Affected Version:

WRlinux 4.3 and all RCPLs are VULNERABLE.
WRlinux 5.0.1/6.0/7.0 and all RCPLs are INVULNERABLE.

c) Hot patches

Upgrading to WRLinux 4.3 RCPL 29.

For standard/preempt-rt kernel

$cd project/build/linux
$tar xzvf LIN4-32844.tgz
$git am 0001-time-Refactor-accumulation-of-nsecs-to-secs.patch
$git am 0002-timekeeping-Indicate-that-clock-was-set-in-the-pvclo.patch
$git am 0003-timekeeping-Fix-potential-lost-pv-notification-of-ti.patch
$git am 0004-timekeeping-call-clock_was_set_delayed-outside-of-xt.patch
$cd ../
$make linux.rebuild

For cgl kernel

$cd project/build/linux
$tar xzvf LIN4-32844.tgz
$git am 0001-time-Refactor-accumulation-of-nsecs-to-secs.patch
$git am 0002-timekeeping-Indicate-that-clock-was-set-in-the-pvclo.patch
$git am 0003-timekeeping-Fix-potential-lost-pv-notification-of-ti.patch
$git am 0004-timekeeping-call-clock_was_set_delayed-outside-of-xt.patch
$git am 0005-Allow-PMEM-to-call-do_gettimeofday-without-a-lock-to.patch
$cd ../
$make linux.rebuild

d) Test

Download the test case from below link:
https://access.redhat.com/sites/default/files/attachments/leap-a-day.c

Compile:
corss-gcc -o leap-a-day leap-a-day.c -lrt

Run the test case on the target board:
leap-a-day -s
(Without the patches, sometimes the system hangs)

e) Official release

We will ship the patches in WRLinux 4.3 RCPL 31 around mid Sep 2015.

f) The 2.0.x/3.0.x are End of Life (EOL), please contact Wind River Support at +1-800-872-4977 or your local Wind River representative for the Wind River Linux 2.0.x/3.0.x fix.


ORIGIN
==================

A positive leap second will again be inserted at the end of June 30, 2015 at 23:59:60 UTC (http://hpiers.obspm.fr/iers/bul/bulc/bulletinc.dat). We have verfied following WRLinux kernels can handle the leap second correctly.

WRLinux4.3.0.28 and later
WRLinux5.0.1 and later
WRLinux6.0 and later
WRLinux7.0 and later

Besides kernel, the Time Zone Data and Code v2015a has been released to handle the incoming leap second. We will upgrade the v2015a in WRLinux 4.3.0.29/5.0.1.24/6.0.0.18/7.0.0.3. The release date of each RCPL is:

WRLinux 4.3.0.29  -- 4/27/2015
WRLinux 5.0.1.24  -- 3/09/2015
WRLinux 6.0.0.18  -- 3/09/2015
WRLinux 7.0.0.3   -- 3/09/2015

In the meantime, if you want to upgrade it by yourselve, you can dowload the tzdata and tzcode from

ftp://ftp.iana.org/tz/releases/tzdata2015a.tar.gz
ftp://ftp.iana.org/tz/releases/tzcode2015a.tar.gz

For WRLinux5.0.1.27/6.0.0.17/7.0.0.2
$cd project/layers/oe-core
$git am 0001-tzcode-update-to-2015a-leap-second-changes-too.patch
$git am 0002-tzdata-update-to-2015a-including-leap-second.patch

For WRLinux 5.0.1.27
$cp tzdata2015a.tar.gz tzcode2015a.tar.gz project/layers/oe-core-dl/downloads

For WRLinux 6.0.0.17
$cp tzdata2015a.tar.gz tzcode2015a.tar.gz project/layers/oe-core-dl-1.5/downloads

For WRLinux 7.0.0.2
$cp tzdata2015a.tar.gz tzcode2015a.tar.gz project/layers/oe-core-dl-1.7/downloads

And then

$make -C build tzdata.distclean;
$make make -C build tzdata;
$make -C build tzdata-right.addpkg;
$make fs


For WRlinux4.3.0.28

$cp tzdata2015a.tar.gz tzcode2015a.tar.gz installdir/wrlinux-4/layers/updates/RCPL-4.3-WRL.0028/wrll-userspace/core/packages/
$cd installdir/wrlinux-4/layers/updates/RCPL-4.3-WRL.0028/wrll-userspace/
$patch -p1 < 0001-timezone-upgrade-timezone-to-2015a.patch
$cd project
$make -C build timezone.distclean;
$make -C build timezone;
$make fs

Verification:

Boot target

UTC
$cp /usr/share/zoneinfo/right/UTC /etc/localtime
$date --date='2015-06-30 23:59:60'

(Without the patch)
date: invalid date `2015-06-30 23:59:60'
(With the patch)
Tue Jun 30 23:59:60 UTC 2015

Other timezones, for example China or Japan

For Japan:
$cp /usr/share/zoneinfo/right/Japan /etc/localtime
$date --date='2015-07-01 08:59:60'
Wed Jul  1 08:59:60 JST 2015

For China:
$cp /usr/share/zoneinfo/right/Asia/Shanghai /etc/localtime
$date --date='2015-07-01 07:59:60'
Wed Jul  1 07:59:60 CST 2015

Run the timezone.py on the target:

(Without the patch)
$./timezone.py
1972-07-01 00:00:00
1973-01-01 00:00:00
...
2009-01-01 00:00:00
2012-07-01 00:00:00

(With the patch)
$./timezone.py
1972-07-01 00:00:00
1973-01-01 00:00:00
...
2009-01-01 00:00:00
2012-07-01 00:00:00
2015-07-01 00:00:00 (New insert)

The 2.0.x/3.0.x are End of Life (EOL), please contact Wind River Support at +1-800-872-4977 or your local Wind River representative for the Wind River Linux 2.0.x/3.0.x fix.


Live chat
Online