diff options
author | Hendrik Brueckner <brueckner@linux.vnet.ibm.com> | 2017-11-20 13:46:13 +0300 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2017-12-13 12:51:36 +0300 |
commit | 7bceec4e58ee23be653c0dd366479d6cb64ae686 (patch) | |
tree | cd285499f296c534522f812c6d4af6febd7aa8a2 /arch/s390/kernel/vdso32 | |
parent | bc3703f21cec8a2ac6a64f6fb3686fbcb1ba1513 (diff) | |
download | linux-7bceec4e58ee23be653c0dd366479d6cb64ae686.tar.xz |
s390/vdso: revise CFI annotations of vDSO functions
Revise and add CFI CFA and register rule annotations to the vDSO
functions for proper stack unwinding and debugging.
Because glibc might call the vDSO in special ways, the vDSO code
does not rely on a stack frame created by the caller. The TOD clock
value can be therefore not stored in the pre-allocated stack area
and additional stack space is required.
To correctly annotate these situations with CFI, the .cfi_val_offset
directive is required to create relative offsets on the value of the
stack register %r15. Because the .cfi_val_offset directive is
available with recent GNU assembler versions only, additional checks
are necessary.
Note that if the vDSO is assembled with an older assembler version,
stack unwinding and debugging from within the vDSO code might not
be possible.
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/kernel/vdso32')
-rw-r--r-- | arch/s390/kernel/vdso32/clock_getres.S | 4 | ||||
-rw-r--r-- | arch/s390/kernel/vdso32/clock_gettime.S | 16 | ||||
-rw-r--r-- | arch/s390/kernel/vdso32/getcpu.S | 4 | ||||
-rw-r--r-- | arch/s390/kernel/vdso32/gettimeofday.S | 8 |
4 files changed, 24 insertions, 8 deletions
diff --git a/arch/s390/kernel/vdso32/clock_getres.S b/arch/s390/kernel/vdso32/clock_getres.S index 6aeddf8e4bc7..eaf9cf1417f6 100644 --- a/arch/s390/kernel/vdso32/clock_getres.S +++ b/arch/s390/kernel/vdso32/clock_getres.S @@ -16,7 +16,7 @@ .globl __kernel_clock_getres .type __kernel_clock_getres,@function __kernel_clock_getres: - .cfi_startproc + CFI_STARTPROC basr %r1,0 la %r1,4f-.(%r1) chi %r2,__CLOCK_REALTIME @@ -38,7 +38,7 @@ __kernel_clock_getres: 3: lhi %r1,__NR_clock_getres /* fallback to svc */ svc 0 br %r14 + CFI_ENDPROC 4: .long __CLOCK_REALTIME_RES 5: .long __CLOCK_COARSE_RES - .cfi_endproc .size __kernel_clock_getres,.-__kernel_clock_getres diff --git a/arch/s390/kernel/vdso32/clock_gettime.S b/arch/s390/kernel/vdso32/clock_gettime.S index d0ac32c413e2..a9418bf975db 100644 --- a/arch/s390/kernel/vdso32/clock_gettime.S +++ b/arch/s390/kernel/vdso32/clock_gettime.S @@ -16,8 +16,10 @@ .globl __kernel_clock_gettime .type __kernel_clock_gettime,@function __kernel_clock_gettime: - .cfi_startproc + CFI_STARTPROC ahi %r15,-16 + CFI_DEF_CFA_OFFSET 176 + CFI_VAL_OFFSET 15, -160 basr %r5,0 0: al %r5,21f-0b(%r5) /* get &_vdso_data */ chi %r2,__CLOCK_REALTIME_COARSE @@ -70,9 +72,13 @@ __kernel_clock_gettime: st %r1,4(%r3) /* store tp->tv_nsec */ lhi %r2,0 ahi %r15,16 + CFI_DEF_CFA_OFFSET 160 + CFI_RESTORE 15 br %r14 /* CLOCK_MONOTONIC_COARSE */ + CFI_DEF_CFA_OFFSET 176 + CFI_VAL_OFFSET 15, -160 9: l %r4,__VDSO_UPD_COUNT+4(%r5) /* load update counter */ tml %r4,0x0001 /* pending update ? loop */ jnz 9b @@ -152,15 +158,21 @@ __kernel_clock_gettime: st %r1,4(%r3) /* store tp->tv_nsec */ lhi %r2,0 ahi %r15,16 + CFI_DEF_CFA_OFFSET 160 + CFI_RESTORE 15 br %r14 /* Fallback to system call */ + CFI_DEF_CFA_OFFSET 176 + CFI_VAL_OFFSET 15, -160 19: lhi %r1,__NR_clock_gettime svc 0 ahi %r15,16 + CFI_DEF_CFA_OFFSET 160 + CFI_RESTORE 15 br %r14 + CFI_ENDPROC 20: .long 1000000000 21: .long _vdso_data - 0b - .cfi_endproc .size __kernel_clock_gettime,.-__kernel_clock_gettime diff --git a/arch/s390/kernel/vdso32/getcpu.S b/arch/s390/kernel/vdso32/getcpu.S index 539d92a2c61b..25515f3fbcea 100644 --- a/arch/s390/kernel/vdso32/getcpu.S +++ b/arch/s390/kernel/vdso32/getcpu.S @@ -15,7 +15,7 @@ .globl __kernel_getcpu .type __kernel_getcpu,@function __kernel_getcpu: - .cfi_startproc + CFI_STARTPROC la %r4,0 sacf 256 l %r5,__VDSO_CPU_NR(%r4) @@ -29,5 +29,5 @@ __kernel_getcpu: st %r4,0(%r3) 3: lhi %r2,0 br %r14 - .cfi_endproc + CFI_ENDPROC .size __kernel_getcpu,.-__kernel_getcpu diff --git a/arch/s390/kernel/vdso32/gettimeofday.S b/arch/s390/kernel/vdso32/gettimeofday.S index 435f819c3e65..3c0db0fa6ad9 100644 --- a/arch/s390/kernel/vdso32/gettimeofday.S +++ b/arch/s390/kernel/vdso32/gettimeofday.S @@ -16,8 +16,10 @@ .globl __kernel_gettimeofday .type __kernel_gettimeofday,@function __kernel_gettimeofday: - .cfi_startproc + CFI_STARTPROC ahi %r15,-16 + CFI_ADJUST_CFA_OFFSET 16 + CFI_VAL_OFFSET 15, -160 basr %r5,0 0: al %r5,13f-0b(%r5) /* get &_vdso_data */ 1: ltr %r3,%r3 /* check if tz is NULL */ @@ -90,9 +92,11 @@ __kernel_gettimeofday: st %r0,4(%r2) /* store tv->tv_usec */ 10: slr %r2,%r2 ahi %r15,16 + CFI_ADJUST_CFA_OFFSET -16 + CFI_RESTORE 15 br %r14 + CFI_ENDPROC 11: .long 1000000000 12: .long 274877907 13: .long _vdso_data - 0b - .cfi_endproc .size __kernel_gettimeofday,.-__kernel_gettimeofday |