From patchwork Wed Jan 13 22:42:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fangrui Song X-Patchwork-Id: 41714 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2F8B13854834; Wed, 13 Jan 2021 22:42:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2F8B13854834 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1610577757; bh=OfeXJAUBS6eDiVxZGt8cz7JBVOq94xXMfaZrHC5GP5g=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=HuONyOuUIQhU0TVA2EVhG/WvklAJeAfrHmDyZ7V90siOaCbkyIist4giuBldg7jiQ qYgyWwRIm1tEn3Yn38f+GPTTf44NLzNkYv77esJhVw4HDAwz0g40y185ORAJgfL/RM 8sBejKdHKmUSBPjeOIZu1C2WU+73M0tyP/etN/To= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qt1-x849.google.com (mail-qt1-x849.google.com [IPv6:2607:f8b0:4864:20::849]) by sourceware.org (Postfix) with ESMTPS id 424963857012 for ; Wed, 13 Jan 2021 22:42:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 424963857012 Received: by mail-qt1-x849.google.com with SMTP id m21so2693954qtp.6 for ; Wed, 13 Jan 2021 14:42:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=OfeXJAUBS6eDiVxZGt8cz7JBVOq94xXMfaZrHC5GP5g=; b=kFqLSlD3iK1ZlbKsUjS56QTGvDFC4T335rkEjCqy5RFs2cL810ZwlFI0XCsPZv3pLq xNJGTHa771lklbTE05UMnPQRX7JsW8Sjx15Jj0ruMlTjW0ykarJdGwNO/NZw9bQkWoU3 TtBXRFWyfPEIRe8ifKM2skLwIu2GMYxxt49wsS/VduWP/KMXjeMEGoP1wno31Qvf4flS ol3sJv005UEN/xSMKE88bylqtLmimQ4/FZmQP37YITlPbfamXGnz67snpSMww2LkBMM4 0USETvetkrd6ZHRlJpZ//vSg+BtTfTfUNDo7FZnfs4ug/IuFSv9pWLul3XCT/V3zBTZU affw== X-Gm-Message-State: AOAM5323dQTkQT0QEP5nEvk5YWrC2i6FxgGc1Ud6/U8Y32E3ULVqnjgI Mq2ih1WD10ypG3W6TYo5p1Jc/JC1n7Saoscda5TXO/daHcRlkBWH0OBPWr0Yr755u7D0JkUe+t/ BdqxsPlkK/EkgeizOmm58QX8P0PHao2ZprA75ZyKPAEcl7I6NhSh3Asm3Mx7C+RmrSrBH X-Google-Smtp-Source: ABdhPJxCP5CRD9BoXyPR1TiKeAr9t3mHNA7Nsvr1uopt8VVTeHXSyG1YyGal6Q8f2Ueg699AL3Fw5QIF62Gu X-Received: from maskray1.svl.corp.google.com ([2620:15c:2ce:0:a6ae:11ff:fe11:4abb]) (user=maskray job=sendgmr) by 2002:a05:6214:80d:: with SMTP id df13mr4783958qvb.10.1610577751980; Wed, 13 Jan 2021 14:42:31 -0800 (PST) Date: Wed, 13 Jan 2021 14:42:28 -0800 Message-Id: <20210113224228.3069335-1-maskray@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.30.0.284.gd98b1dd5eaa7-goog Subject: [PATCH v2] Unconditionally define __stack_chk_guard [BZ #26817] To: libc-alpha@sourceware.org X-Spam-Status: No, score=-18.1 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, URIBL_BLACK, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Fangrui Song via Libc-alpha From: Fangrui Song Reply-To: Fangrui Song Cc: Fangrui Song Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" The global variable __stack_chk_guard is currently unavailable on architectures which define THREAD_SET_STACK_GUARD, so {gcc,clang} -fstack-protector -mstack-protector-guard=global will fail to link due to the undefined symbol. Define __stack_chk_guard to make -mstack-protector-guard=global compiled user programs work. `#define THREAD_SET_STACK_GUARD` code is moved outside of `#ifndef __ASSEMBLER__` so that the C preprocessor can set the version of __stack_chk_guard in elf/Versions correctly. --- csu/libc-start.c | 8 ++----- elf/Versions | 11 +++++++++ elf/rtld.c | 8 ++----- sysdeps/i386/nptl/tls.h | 15 ++++++------ sysdeps/ia64/nptl/tls.h | 14 +++++------ sysdeps/mach/hurd/i386/ld.abilist | 1 + sysdeps/mach/hurd/i386/tls.h | 14 +++++------ sysdeps/powerpc/nptl/tls.h | 20 ++++++++-------- sysdeps/s390/nptl/tls.h | 24 +++++++++---------- sysdeps/sparc/nptl/tls.h | 13 +++++----- sysdeps/unix/sysv/linux/i386/ld.abilist | 1 + sysdeps/unix/sysv/linux/ia64/ld.abilist | 1 + .../sysv/linux/powerpc/powerpc32/ld.abilist | 1 + .../linux/powerpc/powerpc64/be/ld.abilist | 1 + .../linux/powerpc/powerpc64/le/ld.abilist | 1 + .../unix/sysv/linux/s390/s390-32/ld.abilist | 1 + .../unix/sysv/linux/s390/s390-64/ld.abilist | 1 + .../unix/sysv/linux/sparc/sparc32/ld.abilist | 1 + .../unix/sysv/linux/sparc/sparc64/ld.abilist | 1 + sysdeps/unix/sysv/linux/x86_64/64/ld.abilist | 1 + sysdeps/unix/sysv/linux/x86_64/x32/ld.abilist | 1 + sysdeps/x86_64/nptl/tls.h | 15 ++++++------ 22 files changed, 83 insertions(+), 71 deletions(-) diff --git a/csu/libc-start.c b/csu/libc-start.c index db859c3bed..e46d402664 100644 --- a/csu/libc-start.c +++ b/csu/libc-start.c @@ -33,11 +33,8 @@ extern void __libc_init_first (int argc, char **argv, char **envp); #include #ifndef SHARED # include -# ifndef THREAD_SET_STACK_GUARD -/* Only exported for architectures that don't store the stack guard canary - in thread local area. */ +/* Also export to architectures which prefer -mstack-protector-guard=tls. */ uintptr_t __stack_chk_guard attribute_relro; -# endif # ifndef THREAD_SET_POINTER_GUARD /* Only exported for architectures that don't store the pointer guard value in thread local area. */ @@ -206,9 +203,8 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL), uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (_dl_random); # ifdef THREAD_SET_STACK_GUARD THREAD_SET_STACK_GUARD (stack_chk_guard); -# else +# endif __stack_chk_guard = stack_chk_guard; -# endif # ifdef DL_SYSDEP_OSCHECK { diff --git a/elf/Versions b/elf/Versions index be88c48e6d..b5a6151aa4 100644 --- a/elf/Versions +++ b/elf/Versions @@ -1,3 +1,6 @@ +%if __has_include("tls.h") +%include "tls.h" +%endif libc { GLIBC_2.0 { %ifdef EXPORT_UNWIND_FIND_FDE @@ -50,7 +53,15 @@ ld { } GLIBC_2.4 { # stack canary +%ifndef THREAD_SET_STACK_GUARD __stack_chk_guard; +%endif + } + GLIBC_2.33 { + # stack canary +%ifdef THREAD_SET_STACK_GUARD + __stack_chk_guard; +%endif } GLIBC_PRIVATE { # Those are in the dynamic linker, but used by libc.so. diff --git a/elf/rtld.c b/elf/rtld.c index 8d9add90e3..cd70428c46 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -154,11 +154,8 @@ unsigned int _dl_skip_args attribute_relro attribute_hidden; #endif rtld_hidden_data_def (_dl_argv) -#ifndef THREAD_SET_STACK_GUARD -/* Only exported for architectures that don't store the stack guard canary - in thread local area. */ +/* Also export to architectures which prefer -mstack-protector-guard=tls. */ uintptr_t __stack_chk_guard attribute_relro; -#endif /* Only exported for architectures that don't store the pointer guard value in thread local area. */ @@ -865,9 +862,8 @@ security_init (void) uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (_dl_random); #ifdef THREAD_SET_STACK_GUARD THREAD_SET_STACK_GUARD (stack_chk_guard); -#else +#endif __stack_chk_guard = stack_chk_guard; -#endif /* Set up the pointer guard as well, if necessary. */ uintptr_t pointer_chk_guard diff --git a/sysdeps/i386/nptl/tls.h b/sysdeps/i386/nptl/tls.h index 86ee1ef302..c16c2fe665 100644 --- a/sysdeps/i386/nptl/tls.h +++ b/sysdeps/i386/nptl/tls.h @@ -68,6 +68,13 @@ _Static_assert (offsetof (tcbhead_t, __private_ss) == 0x30, the SSE memory functions. */ #define STACK_ALIGN 16 +/* Set the stack guard field in TCB head. Referenced by elf/Versions. */ +#define THREAD_SET_STACK_GUARD(value) \ + THREAD_SETMEM (THREAD_SELF, header.stack_guard, value) +#define THREAD_COPY_STACK_GUARD(descr) \ + ((descr)->header.stack_guard \ + = THREAD_GETMEM (THREAD_SELF, header.stack_guard)) + #ifndef __ASSEMBLER__ /* Get system call information. */ # include @@ -358,14 +365,6 @@ tls_fill_user_desc (union user_desc_init *desc, }}) -/* Set the stack guard field in TCB head. */ -#define THREAD_SET_STACK_GUARD(value) \ - THREAD_SETMEM (THREAD_SELF, header.stack_guard, value) -#define THREAD_COPY_STACK_GUARD(descr) \ - ((descr)->header.stack_guard \ - = THREAD_GETMEM (THREAD_SELF, header.stack_guard)) - - /* Set the pointer guard field in the TCB head. */ #define THREAD_SET_POINTER_GUARD(value) \ THREAD_SETMEM (THREAD_SELF, header.pointer_guard, value) diff --git a/sysdeps/ia64/nptl/tls.h b/sysdeps/ia64/nptl/tls.h index 66d9bf3189..11f9a421c0 100644 --- a/sysdeps/ia64/nptl/tls.h +++ b/sysdeps/ia64/nptl/tls.h @@ -46,6 +46,13 @@ register struct pthread *__thread_self __asm__("r13"); /* Alignment requirement for the stack. */ #define STACK_ALIGN 16 +/* Set the stack guard field in TCB head. Referenced by elf/Versions. */ +#define THREAD_SET_STACK_GUARD(value) \ + (((uintptr_t *) __thread_self)[-1] = (value)) +#define THREAD_COPY_STACK_GUARD(descr) \ + (((uintptr_t *) ((char *) (descr) + TLS_PRE_TCB_SIZE))[-1] \ + = ((uintptr_t *) __thread_self)[-1]) + #ifndef __ASSEMBLER__ /* Get system call information. */ # include @@ -138,13 +145,6 @@ register struct pthread *__thread_self __asm__("r13"); #define THREAD_SETMEM_NC(descr, member, idx, value) \ descr->member[idx] = (value) -/* Set the stack guard field in TCB head. */ -#define THREAD_SET_STACK_GUARD(value) \ - (((uintptr_t *) __thread_self)[-1] = (value)) -#define THREAD_COPY_STACK_GUARD(descr) \ - (((uintptr_t *) ((char *) (descr) + TLS_PRE_TCB_SIZE))[-1] \ - = ((uintptr_t *) __thread_self)[-1]) - /* Set the pointer guard field in TCB head. */ #define THREAD_GET_POINTER_GUARD() \ (((uintptr_t *) __thread_self)[-2]) diff --git a/sysdeps/mach/hurd/i386/ld.abilist b/sysdeps/mach/hurd/i386/ld.abilist index 751664bcda..b3f2fdc5d5 100644 --- a/sysdeps/mach/hurd/i386/ld.abilist +++ b/sysdeps/mach/hurd/i386/ld.abilist @@ -16,4 +16,5 @@ GLIBC_2.2.6 _r_debug D 0x14 GLIBC_2.2.6 abort F GLIBC_2.3 ___tls_get_addr F GLIBC_2.3 __tls_get_addr F +GLIBC_2.33 __stack_chk_guard D 0x4 GLIBC_2.33 __x86_get_cpu_features F diff --git a/sysdeps/mach/hurd/i386/tls.h b/sysdeps/mach/hurd/i386/tls.h index 057b2613f3..1413ee63b2 100644 --- a/sysdeps/mach/hurd/i386/tls.h +++ b/sysdeps/mach/hurd/i386/tls.h @@ -79,6 +79,13 @@ typedef struct "Segment Base".) On such machines, a cache line is 64 bytes. */ #define TCB_ALIGNMENT 64 +/* Set the stack guard field in TCB head. Referenced by elf/Versions. */ +#define THREAD_SET_STACK_GUARD(value) \ + THREAD_SETMEM (THREAD_SELF, stack_guard, value) +#define THREAD_COPY_STACK_GUARD(descr) \ + ((descr)->stack_guard \ + = THREAD_GETMEM (THREAD_SELF, stack_guard)) + #ifndef __ASSEMBLER__ /* Use i386-specific RPCs to arrange that %gs segment register prefix @@ -296,13 +303,6 @@ out: _dtv; }) -/* Set the stack guard field in TCB head. */ -#define THREAD_SET_STACK_GUARD(value) \ - THREAD_SETMEM (THREAD_SELF, stack_guard, value) -#define THREAD_COPY_STACK_GUARD(descr) \ - ((descr)->stack_guard \ - = THREAD_GETMEM (THREAD_SELF, stack_guard)) - /* Set the pointer guard field in the TCB head. */ #define THREAD_SET_POINTER_GUARD(value) \ THREAD_SETMEM (THREAD_SELF, pointer_guard, value) diff --git a/sysdeps/powerpc/nptl/tls.h b/sysdeps/powerpc/nptl/tls.h index 6c779b6609..db56e04f81 100644 --- a/sysdeps/powerpc/nptl/tls.h +++ b/sysdeps/powerpc/nptl/tls.h @@ -33,6 +33,16 @@ # include #endif /* __ASSEMBLER__ */ +/* Set the stack guard field in TCB head. Used by elf/Versions. */ +# define THREAD_SET_STACK_GUARD(value) \ + (((tcbhead_t *) ((char *) __thread_register \ + - TLS_TCB_OFFSET))[-1].stack_guard = (value)) +# define THREAD_COPY_STACK_GUARD(descr) \ + (((tcbhead_t *) ((char *) (descr) \ + + TLS_PRE_TCB_SIZE))[-1].stack_guard \ + = ((tcbhead_t *) ((char *) __thread_register \ + - TLS_TCB_OFFSET))[-1].stack_guard) + #ifndef __powerpc64__ /* Register r2 (tp) is reserved by the ABI as "thread pointer". */ # define PT_THREAD_POINTER PT_R2 @@ -191,16 +201,6 @@ typedef struct # define THREAD_SETMEM_NC(descr, member, idx, value) \ ((void)(descr), (THREAD_SELF)->member[idx] = (value)) -/* Set the stack guard field in TCB head. */ -# define THREAD_SET_STACK_GUARD(value) \ - (((tcbhead_t *) ((char *) __thread_register \ - - TLS_TCB_OFFSET))[-1].stack_guard = (value)) -# define THREAD_COPY_STACK_GUARD(descr) \ - (((tcbhead_t *) ((char *) (descr) \ - + TLS_PRE_TCB_SIZE))[-1].stack_guard \ - = ((tcbhead_t *) ((char *) __thread_register \ - - TLS_TCB_OFFSET))[-1].stack_guard) - /* Set the stack guard field in TCB head. */ # define THREAD_GET_POINTER_GUARD() \ (((tcbhead_t *) ((char *) __thread_register \ diff --git a/sysdeps/s390/nptl/tls.h b/sysdeps/s390/nptl/tls.h index efb52515e0..f01d835ea4 100644 --- a/sysdeps/s390/nptl/tls.h +++ b/sysdeps/s390/nptl/tls.h @@ -57,6 +57,18 @@ typedef struct the SSE memory functions. */ #define STACK_ALIGN 16 +/* Set the stack guard field in TCB head. Referenced by elf/Versions. */ +#define THREAD_SET_STACK_GUARD(value) \ + do \ + { \ + __asm__ __volatile__ ("" : : : "a0", "a1"); \ + THREAD_SETMEM (THREAD_SELF, header.stack_guard, value); \ + } \ + while (0) +#define THREAD_COPY_STACK_GUARD(descr) \ + ((descr)->header.stack_guard \ + = THREAD_GETMEM (THREAD_SELF, header.stack_guard)) + #ifndef __ASSEMBLER__ /* Get system call information. */ # include @@ -145,18 +157,6 @@ typedef struct #define THREAD_SETMEM_NC(descr, member, idx, value) \ descr->member[idx] = (value) -/* Set the stack guard field in TCB head. */ -#define THREAD_SET_STACK_GUARD(value) \ - do \ - { \ - __asm__ __volatile__ ("" : : : "a0", "a1"); \ - THREAD_SETMEM (THREAD_SELF, header.stack_guard, value); \ - } \ - while (0) -#define THREAD_COPY_STACK_GUARD(descr) \ - ((descr)->header.stack_guard \ - = THREAD_GETMEM (THREAD_SELF, header.stack_guard)) - /* s390 doesn't have HP_TIMING_*, so for the time being use stack_guard as pointer_guard. */ #define THREAD_GET_POINTER_GUARD() \ diff --git a/sysdeps/sparc/nptl/tls.h b/sysdeps/sparc/nptl/tls.h index dd1eb82a59..764fae5dd4 100644 --- a/sysdeps/sparc/nptl/tls.h +++ b/sysdeps/sparc/nptl/tls.h @@ -51,6 +51,12 @@ typedef struct # include #endif /* __ASSEMBLER__ */ +/* Set the stack guard field in TCB head. Referenced by elf/Versions. */ +#define THREAD_SET_STACK_GUARD(value) \ + THREAD_SETMEM (THREAD_SELF, header.stack_guard, value) +# define THREAD_COPY_STACK_GUARD(descr) \ + ((descr)->header.stack_guard \ + = THREAD_GETMEM (THREAD_SELF, header.stack_guard)) #ifndef __ASSEMBLER__ /* Get system call information. */ @@ -122,13 +128,6 @@ register struct pthread *__thread_self __asm__("%g7"); #define THREAD_SETMEM_NC(descr, member, idx, value) \ descr->member[idx] = (value) -/* Set the stack guard field in TCB head. */ -#define THREAD_SET_STACK_GUARD(value) \ - THREAD_SETMEM (THREAD_SELF, header.stack_guard, value) -# define THREAD_COPY_STACK_GUARD(descr) \ - ((descr)->header.stack_guard \ - = THREAD_GETMEM (THREAD_SELF, header.stack_guard)) - /* Get/set the stack guard field in TCB head. */ #define THREAD_GET_POINTER_GUARD() \ THREAD_GETMEM (THREAD_SELF, header.pointer_guard) diff --git a/sysdeps/unix/sysv/linux/i386/ld.abilist b/sysdeps/unix/sysv/linux/i386/ld.abilist index 04655651b0..58968d772e 100644 --- a/sysdeps/unix/sysv/linux/i386/ld.abilist +++ b/sysdeps/unix/sysv/linux/i386/ld.abilist @@ -3,4 +3,5 @@ GLIBC_2.1 __libc_stack_end D 0x4 GLIBC_2.1 _dl_mcount F GLIBC_2.3 ___tls_get_addr F GLIBC_2.3 __tls_get_addr F +GLIBC_2.33 __stack_chk_guard D 0x4 GLIBC_2.33 __x86_get_cpu_features F diff --git a/sysdeps/unix/sysv/linux/ia64/ld.abilist b/sysdeps/unix/sysv/linux/ia64/ld.abilist index 33f91199bf..782a31dda4 100644 --- a/sysdeps/unix/sysv/linux/ia64/ld.abilist +++ b/sysdeps/unix/sysv/linux/ia64/ld.abilist @@ -2,3 +2,4 @@ GLIBC_2.2 __libc_stack_end D 0x8 GLIBC_2.2 _dl_mcount F GLIBC_2.2 _r_debug D 0x28 GLIBC_2.3 __tls_get_addr F +GLIBC_2.33 __stack_chk_guard D 0x8 diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ld.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ld.abilist index 4bbfba7a61..5f0f61ffe8 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ld.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ld.abilist @@ -4,3 +4,4 @@ GLIBC_2.1 _dl_mcount F GLIBC_2.22 __tls_get_addr_opt F GLIBC_2.23 __parse_hwcap_and_convert_at_platform F GLIBC_2.3 __tls_get_addr F +GLIBC_2.33 __stack_chk_guard D 0x4 diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/ld.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/ld.abilist index 283fb4510b..2789aacf98 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/ld.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/ld.abilist @@ -4,3 +4,4 @@ GLIBC_2.3 __libc_stack_end D 0x8 GLIBC_2.3 __tls_get_addr F GLIBC_2.3 _dl_mcount F GLIBC_2.3 _r_debug D 0x28 +GLIBC_2.33 __stack_chk_guard D 0x8 diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/ld.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/ld.abilist index b1f313c7cd..819d9b8f77 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/ld.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/ld.abilist @@ -4,3 +4,4 @@ GLIBC_2.17 _dl_mcount F GLIBC_2.17 _r_debug D 0x28 GLIBC_2.22 __tls_get_addr_opt F GLIBC_2.23 __parse_hwcap_and_convert_at_platform F +GLIBC_2.33 __stack_chk_guard D 0x8 diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/ld.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/ld.abilist index b56f005beb..f0d850a208 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/ld.abilist +++ b/sysdeps/unix/sysv/linux/s390/s390-32/ld.abilist @@ -2,3 +2,4 @@ GLIBC_2.0 _r_debug D 0x14 GLIBC_2.1 __libc_stack_end D 0x4 GLIBC_2.1 _dl_mcount F GLIBC_2.3 __tls_get_offset F +GLIBC_2.33 __stack_chk_guard D 0x4 diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/ld.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/ld.abilist index 6f788a086d..29a2bafdf8 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/ld.abilist +++ b/sysdeps/unix/sysv/linux/s390/s390-64/ld.abilist @@ -2,3 +2,4 @@ GLIBC_2.2 __libc_stack_end D 0x8 GLIBC_2.2 _dl_mcount F GLIBC_2.2 _r_debug D 0x28 GLIBC_2.3 __tls_get_offset F +GLIBC_2.33 __stack_chk_guard D 0x8 diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/ld.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/ld.abilist index 0c6610e3c2..345118a148 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/ld.abilist +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/ld.abilist @@ -2,3 +2,4 @@ GLIBC_2.0 _r_debug D 0x14 GLIBC_2.1 __libc_stack_end D 0x4 GLIBC_2.1 _dl_mcount F GLIBC_2.3 __tls_get_addr F +GLIBC_2.33 __stack_chk_guard D 0x4 diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/ld.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/ld.abilist index 33f91199bf..782a31dda4 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/ld.abilist +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/ld.abilist @@ -2,3 +2,4 @@ GLIBC_2.2 __libc_stack_end D 0x8 GLIBC_2.2 _dl_mcount F GLIBC_2.2 _r_debug D 0x28 GLIBC_2.3 __tls_get_addr F +GLIBC_2.33 __stack_chk_guard D 0x8 diff --git a/sysdeps/unix/sysv/linux/x86_64/64/ld.abilist b/sysdeps/unix/sysv/linux/x86_64/64/ld.abilist index e632c6198e..6741524283 100644 --- a/sysdeps/unix/sysv/linux/x86_64/64/ld.abilist +++ b/sysdeps/unix/sysv/linux/x86_64/64/ld.abilist @@ -2,4 +2,5 @@ GLIBC_2.2.5 __libc_stack_end D 0x8 GLIBC_2.2.5 _dl_mcount F GLIBC_2.2.5 _r_debug D 0x28 GLIBC_2.3 __tls_get_addr F +GLIBC_2.33 __stack_chk_guard D 0x8 GLIBC_2.33 __x86_get_cpu_features F diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/ld.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/ld.abilist index 9d9d0befde..a995a30818 100644 --- a/sysdeps/unix/sysv/linux/x86_64/x32/ld.abilist +++ b/sysdeps/unix/sysv/linux/x86_64/x32/ld.abilist @@ -2,4 +2,5 @@ GLIBC_2.16 __libc_stack_end D 0x4 GLIBC_2.16 __tls_get_addr F GLIBC_2.16 _dl_mcount F GLIBC_2.16 _r_debug D 0x14 +GLIBC_2.33 __stack_chk_guard D 0x4 GLIBC_2.33 __x86_get_cpu_features F diff --git a/sysdeps/x86_64/nptl/tls.h b/sysdeps/x86_64/nptl/tls.h index 20f0958780..064927b210 100644 --- a/sysdeps/x86_64/nptl/tls.h +++ b/sysdeps/x86_64/nptl/tls.h @@ -94,6 +94,13 @@ _Static_assert (offsetof (tcbhead_t, __glibc_unused2) == 0x80, /* Alignment requirement for the stack. */ #define STACK_ALIGN 16 +/* Set the stack guard field in TCB head. Used by elf/Versions. */ +# define THREAD_SET_STACK_GUARD(value) \ + THREAD_SETMEM (THREAD_SELF, header.stack_guard, value) +# define THREAD_COPY_STACK_GUARD(descr) \ + ((descr)->header.stack_guard \ + = THREAD_GETMEM (THREAD_SELF, header.stack_guard)) + #ifndef __ASSEMBLER__ /* Get system call information. */ @@ -303,14 +310,6 @@ _Static_assert (offsetof (tcbhead_t, __glibc_unused2) == 0x80, }}) -/* Set the stack guard field in TCB head. */ -# define THREAD_SET_STACK_GUARD(value) \ - THREAD_SETMEM (THREAD_SELF, header.stack_guard, value) -# define THREAD_COPY_STACK_GUARD(descr) \ - ((descr)->header.stack_guard \ - = THREAD_GETMEM (THREAD_SELF, header.stack_guard)) - - /* Set the pointer guard field in the TCB head. */ # define THREAD_SET_POINTER_GUARD(value) \ THREAD_SETMEM (THREAD_SELF, header.pointer_guard, value)