Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e1b6b6ce authored by Nathan Lynch's avatar Nathan Lynch Committed by Catalin Marinas
Browse files

arm64: vdso: minor ABI fix for clock_getres



The vdso implementation of clock_getres currently returns 0 (success)
whenever a null timespec is provided by the caller, regardless of the
clock id supplied.

This behavior is incorrect.  It should fall back to syscall when an
unrecognized clock id is passed, even when the timespec argument is
null.  This ensures that clock_getres always returns an error for
invalid clock ids.

Signed-off-by: default avatarNathan Lynch <nathan_lynch@mentor.com>
Acked-by: default avatarWill Deacon <will.deacon@arm.com>
Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
parent f3e39273
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -174,8 +174,6 @@ ENDPROC(__kernel_clock_gettime)
/* int __kernel_clock_getres(clockid_t clock_id, struct timespec *res); */
/* int __kernel_clock_getres(clockid_t clock_id, struct timespec *res); */
ENTRY(__kernel_clock_getres)
ENTRY(__kernel_clock_getres)
	.cfi_startproc
	.cfi_startproc
	cbz	w1, 3f

	cmp	w0, #CLOCK_REALTIME
	cmp	w0, #CLOCK_REALTIME
	ccmp	w0, #CLOCK_MONOTONIC, #0x4, ne
	ccmp	w0, #CLOCK_MONOTONIC, #0x4, ne
	b.ne	1f
	b.ne	1f
@@ -188,6 +186,7 @@ ENTRY(__kernel_clock_getres)
	b.ne	4f
	b.ne	4f
	ldr	x2, 6f
	ldr	x2, 6f
2:
2:
	cbz	w1, 3f
	stp	xzr, x2, [x1]
	stp	xzr, x2, [x1]


3:	/* res == NULL. */
3:	/* res == NULL. */