Skip to content

Commit

Permalink
UPSTREAM: arm64: vdso: fix clock_getres for 4GiB-aligned res
Browse files Browse the repository at this point in the history
(cherry pick from commit c80ed08)

The vdso tries to check for a NULL res pointer in __kernel_clock_getres,
but only checks the lower 32 bits as is uses CBZ on the W register the
res pointer is held in.

Thus, if the res pointer happened to be aligned to a 4GiB boundary, we'd
spuriously skip storing the timespec to it, while returning a zero error code
to the caller.

Prevent this by checking the whole pointer, using CBZ on the X register
the res pointer is held in.

Fixes: 9031fef ("arm64: VDSO support")
Signed-off-by: Mark Rutland <[email protected]>
Reported-by: Andrew Pinski <[email protected]>
Reported-by: Mark Salyzyn <[email protected]>
Cc: Catalin Marinas <[email protected]>
Cc: Will Deacon <[email protected]>
Signed-off-by: Will Deacon <[email protected]>
Bug: 20045882
Bug: 63737556
Change-Id: Iab5449d8515f9d655e792e3d7ce43a8f016fa2a0
  • Loading branch information
Mark Rutland authored and pundiramit committed Jan 22, 2018
1 parent 6522a6d commit d1f58c3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/arm64/kernel/vdso/gettimeofday.S
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ ENTRY(__kernel_clock_getres)
b.ne 4f
ldr x2, 6f
2:
cbz w1, 3f
cbz x1, 3f
stp xzr, x2, [x1]

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

0 comments on commit d1f58c3

Please sign in to comment.