Skip to contentSkip to conversation

linux: arm: vdso: nullpatch vdso_clock_gettime64 for non-virtual timers

PATCH In review Alex Bee 2 participants 3 messages Jul 16, 2020

Subsystems (2)
lore
Share & tools
lore

Alex Bee

author
#0 lore raw

PATCH 1/1 linux: arm: vdso: nullpatch vdso_clock_gettime64 for non-virtual timers

Along with commit commit 74d06efb9c2f ("ARM: 8932/1: Add clock_gettime64 entry point") clock_gettime64 was added for ARM platform to solve the y2k38 problem on 32-bit platforms. glibc from version 2.31 onwards started using this vdso-call on ARM platforms.
However it was (probably) forgotten to "nullpatch" this call, when no reliable timer source is available, for example when "arm,cpu-registers-not-fw-configured" is defined in devicetree for "arm,armv7-timer".
This results in erratic time jumps whenever "gettimeofday" gets called, since the (non-working) vdso-call will be used instead of a syscall.

This patch adds clock_gettime64 to get nullpatched as well. It has been verified to work and solve this issue on Rockchip RK322x, RK3288 and RPi4 (32-bit kernel build) platforms.

---
 arch/arm/kernel/vdso.c | 1 +
 1 file changed, 1 insertion(+)
arch/arm/kernel/vdso.c +1 -0
index 6bfdca4769a7..fddd08a6e063 100644
@@ -184,6 +184,7 @@ static void __init patch_vdso(void *ehdr)
 	if (!cntvct_ok) {
 		vdso_nullpatch_one(&einfo, "__vdso_gettimeofday");
 		vdso_nullpatch_one(&einfo, "__vdso_clock_gettime");
+		vdso_nullpatch_one(&einfo, "__vdso_clock_gettime64");
 	}
 }
 
Signature · 1 line
2.17.1
#1 lore raw

Hi Alex,

Quoted 11 lines · Alex Bee

Along with commit commit 74d06efb9c2f ("ARM: 8932/1: Add clock_gettime64 entry point") clock_gettime64 was added for ARM platform to solve the y2k38 problem on 32-bit platforms. glibc from version 2.31 onwards started using this vdso-call on ARM platforms.
However it was (probably) forgotten to "nullpatch" this call, when no reliable timer source is available, for example when "arm,cpu-registers-not-fw-configured" is defined in devicetree for "arm,armv7-timer".
This results in erratic time jumps whenever "gettimeofday" gets called, since the (non-working) vdso-call will be used instead of a syscall.

Quoted 3 lines

This patch adds clock_gettime64 to get nullpatched as well. It has been verified to work and solve this issue on Rockchip RK322x, RK3288 and RPi4 (32-bit kernel build) platforms.

FYI, a version of this patch was already submitted, and is just waiting for Russell to apply it:

https://www.armlinux.org.uk/developer/patches/viewpatch.php?id=8987/1

Robin.

Quoted 18 lines
---
  arch/arm/kernel/vdso.c | 1 +
  1 file changed, 1 insertion(+)
arch/arm/kernel/vdso.c +1 -0
index 6bfdca4769a7..fddd08a6e063 100644
@@ -184,6 +184,7 @@ static void __init patch_vdso(void *ehdr)
  	if (!cntvct_ok) {
  		vdso_nullpatch_one(&einfo, "__vdso_gettimeofday");
  		vdso_nullpatch_one(&einfo, "__vdso_clock_gettime");
+		vdso_nullpatch_one(&einfo, "__vdso_clock_gettime64");
  	}
  }
 
author
#2 lore raw

Hi Robin,

Am 16.07.20 um 20:46 schrieb Robin Murphy:

Quoted 18 lines

Hi Alex,

Quoted 11 lines · Alex Bee

Along with commit commit 74d06efb9c2f ("ARM: 8932/1: Add clock_gettime64 entry point") clock_gettime64 was added for ARM platform to solve the y2k38 problem on 32-bit platforms. glibc from version 2.31 onwards started using this vdso-call on ARM platforms.
However it was (probably) forgotten to "nullpatch" this call, when no reliable timer source is available, for example when "arm,cpu-registers-not-fw-configured" is defined in devicetree for "arm,armv7-timer".
This results in erratic time jumps whenever "gettimeofday" gets called, since the (non-working) vdso-call will be used instead of a syscall.

Quoted 3 lines

This patch adds clock_gettime64 to get nullpatched as well. It has been verified to work and solve this issue on Rockchip RK322x, RK3288 and RPi4 (32-bit kernel build) platforms.

Quoted 5 lines

FYI, a version of this patch was already submitted, and is just waiting for Russell to apply it:

https://www.armlinux.org.uk/developer/patches/viewpatch.php?id=8987/1

Robin.

OK - couldn't find this before. You can drop my patch than.

Quoted 6 lines
Quoted 6 lines

---
  arch/arm/kernel/vdso.c | 1 +

  1 file changed, 1 insertion(+)
Quoted 12 lines

arch/arm/kernel/vdso.c static void __init patch_vdso(void *ehdr) · line 190

Quoted 12 lines
arch/arm/kernel/vdso.c +1 -0
index 6bfdca4769a7..fddd08a6e063 100644
@@ -184,6 +184,7 @@ static void __init patch_vdso(void *ehdr)
       if (!cntvct_ok) {
           vdso_nullpatch_one(&einfo, "__vdso_gettimeofday");
           vdso_nullpatch_one(&einfo, "__vdso_clock_gettime");
+        vdso_nullpatch_one(&einfo, "__vdso_clock_gettime64");
       }
   }
 

Regards,

Alex