From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: libc-alpha@sourceware.org
Subject: [PATCH v2 12/21] nptl: alpha: Fix Race conditions in pthread cancellation (BZ#12683)
Date: Mon, 26 Feb 2018 18:03:27 -0300 [thread overview]
Message-ID: <1519679016-12241-13-git-send-email-adhemerval.zanella@linaro.org> (raw)
In-Reply-To: <1519679016-12241-1-git-send-email-adhemerval.zanella@linaro.org>
This patch adds the alpha modifications required for the BZ#12683.
It basically adds the required ucontext_get_pc function
The default syscall_cancel.c should be fine for alpha and GCC 6.1
generates the following cod for syscall_cancel.os:
---
0000000000000000 <__GI___syscall_cancel_arch>:
0: 00 00 bb 27 ldah gp,0(t12)
4: 00 00 bd 23 lda gp,0(gp)
8: f0 ff de 23 lda sp,-16(sp)
c: 00 04 f1 47 mov a1,v0
10: 00 00 5e b7 stq ra,0(sp)
0000000000000014 <__syscall_cancel_arch_start>:
14: 00 00 30 a0 ldl t0,0(a0)
18: 01 00 e1 43 sextl t0,t0
1c: 01 90 20 44 and t0,0x4,t0
20: 0f 00 20 f4 bne t0,60 <__syscall_cancel_arch_end+0x20>
24: 10 04 f2 47 mov a2,a0
28: 11 04 f3 47 mov a3,a1
2c: 12 04 f4 47 mov a4,a2
30: 10 00 9e a6 ldq a4,16(sp)
34: 13 04 f5 47 mov a5,a3
38: 18 00 be a6 ldq a5,24(sp)
3c: 83 00 00 00 callsys
0000000000000040 <__syscall_cancel_arch_end>:
40: 21 05 e0 43 negq v0,t0
44: 00 00 5e a7 ldq ra,0(sp)
48: c0 04 61 46 cmovne a3,t0,v0
4c: 10 00 de 23 lda sp,16(sp)
50: 01 80 fa 6b ret
54: 00 00 fe 2f unop
58: 1f 04 ff 47 nop
5c: 00 00 fe 2f unop
60: 00 00 7d a7 ldq t12,0(gp)
64: 00 40 5b 6b jsr ra,(t12),68 <__syscall_cancel_arch_end+0x28>
68: 1f 04 ff 47 nop
6c: 00 00 fe 2f unop
---
Checked on alpha-linux-gnu, no regression found.
[BZ #12683]
* sysdeps/unix/sysv/linux/alpha/sigcontextinfo.h (ucontext_get_pc):
New function.
---
ChangeLog | 4 ++++
sysdeps/unix/sysv/linux/alpha/sigcontextinfo.h | 13 +++++++++++++
2 files changed, 17 insertions(+)
diff --git a/sysdeps/unix/sysv/linux/alpha/sigcontextinfo.h b/sysdeps/unix/sysv/linux/alpha/sigcontextinfo.h
index 23f66d0..f762fff 100644
--- a/sysdeps/unix/sysv/linux/alpha/sigcontextinfo.h
+++ b/sysdeps/unix/sysv/linux/alpha/sigcontextinfo.h
@@ -15,6 +15,11 @@
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
+#ifndef _SIGCONTEXTINFO_H
+#define _SIGCONTEXTINFO_H
+
+#include <stdint.h>
+
#define SIGCONTEXT int _code, struct sigcontext *
#define SIGCONTEXT_EXTRA_ARGS _code,
#define GET_PC(ctx) ((void *) (ctx)->sc_pc)
@@ -22,3 +27,11 @@
#define GET_STACK(ctx) ((void *) (ctx)->sc_regs[30])
#define CALL_SIGHANDLER(handler, signo, ctx) \
(handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))
+
+static inline uintptr_t
+ucontext_get_pc (const ucontext_t *uc)
+{
+ return uc->uc_mcontext.sc_pc;
+}
+
+#endif /* _SIGCONTEXTINFO_H */
--
2.7.4
next prev parent reply other threads:[~2018-02-26 21:04 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-26 21:03 [PATCH v2 00/21] nptl: Fix Race conditions in pthread cancellation (BZ#12683) Adhemerval Zanella
2018-02-26 21:03 ` [PATCH v2 01/21] powerpc: Create stackframe information on syscall Adhemerval Zanella
2018-02-26 21:41 ` Andreas Schwab
2018-02-27 12:05 ` Adhemerval Zanella
2018-05-07 2:49 ` Zack Weinberg
2018-05-07 13:57 ` Adhemerval Zanella
2018-02-26 21:03 ` [PATCH v2 02/21] nptl: Fix testcases for new pthread cancellation mechanism Adhemerval Zanella
2018-02-26 21:43 ` Andreas Schwab
2018-02-27 12:05 ` Adhemerval Zanella
2018-05-07 2:49 ` Zack Weinberg
2018-05-07 17:13 ` Adhemerval Zanella
2018-05-08 13:35 ` Zack Weinberg
2018-05-08 17:26 ` Adhemerval Zanella
2018-02-26 21:03 ` [PATCH v2 03/21] nptl: Fix Race conditions in pthread cancellation (BZ#12683) Adhemerval Zanella
2018-04-27 12:20 ` Zack Weinberg
2018-04-27 12:25 ` Adhemerval Zanella
2018-05-07 2:48 ` Zack Weinberg
2018-05-07 2:49 ` Zack Weinberg
2018-05-08 17:11 ` Adhemerval Zanella
2018-02-26 21:03 ` [PATCH v2 04/21] nptl: x86_64: " Adhemerval Zanella
2018-05-07 2:49 ` Zack Weinberg
2018-05-08 17:55 ` Adhemerval Zanella
2018-02-26 21:03 ` [PATCH v2 05/21] nptl: x32: " Adhemerval Zanella
2018-02-26 21:03 ` [PATCH v2 06/21] nptl: i386: " Adhemerval Zanella
2018-05-07 2:49 ` Zack Weinberg
2018-05-08 17:56 ` Adhemerval Zanella
2018-02-26 21:03 ` [PATCH v2 07/21] nptl: powerpc: " Adhemerval Zanella
2018-05-07 19:25 ` Tulio Magno Quites Machado Filho
2018-05-08 18:07 ` Adhemerval Zanella
2018-02-26 21:03 ` [PATCH v2 08/21] nptl: aarch64: " Adhemerval Zanella
2018-02-26 21:03 ` [PATCH v2 09/21] nptl: arm: " Adhemerval Zanella
2018-02-26 21:03 ` [PATCH v2 10/21] nptl: s390: " Adhemerval Zanella
2018-02-26 21:03 ` [PATCH v2 11/21] nptl: ia64: " Adhemerval Zanella
2018-02-26 21:03 ` Adhemerval Zanella [this message]
2018-02-26 21:03 ` [PATCH v2 13/21] nptl: m68k: " Adhemerval Zanella
2018-02-26 21:03 ` [PATCH v2 14/21] nptl: microblaze: " Adhemerval Zanella
2018-02-26 21:03 ` [PATCH v2 15/21] nptl: tile: " Adhemerval Zanella
2018-02-26 21:03 ` [PATCH v2 16/21] nptl: sparc: " Adhemerval Zanella
2018-02-26 21:03 ` [PATCH v2 17/21] nptl: nios2: " Adhemerval Zanella
2018-02-26 21:03 ` [PATCH v2 18/21] nptl: sh: " Adhemerval Zanella
2018-02-26 21:03 ` [PATCH v2 19/21] nptl: mips: " Adhemerval Zanella
2018-02-26 21:03 ` [PATCH v2 20/21] nptl: hppa: " Adhemerval Zanella
2018-02-26 21:03 ` [PATCH v2 21/21] nptl: riscv: " Adhemerval Zanella
2018-02-27 1:16 ` DJ Delorie
2018-02-27 13:03 ` Adhemerval Zanella
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/libc/involved.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1519679016-12241-13-git-send-email-adhemerval.zanella@linaro.org \
--to=adhemerval.zanella@linaro.org \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).