From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Florian Weimer Newsgroups: gmane.comp.lib.glibc.alpha Subject: Re: [PATCH 0/2] nptl: Update struct pthread_unwind_buf Date: Fri, 9 Feb 2018 15:33:52 +0100 Message-ID: References: <20180201205757.51911-1-hjl.tools@gmail.com> <4abf9786-1879-f16c-5a01-3261cd718d63@redhat.com> <87inb7pug7.fsf@mid.deneb.enyo.de> <2a02aac9-6aa3-4dc6-b122-039ae85365e8@redhat.com> <87d11emoap.fsf@mid.deneb.enyo.de> <878tc2mkgr.fsf@mid.deneb.enyo.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1518186723 22989 195.159.176.226 (9 Feb 2018 14:32:03 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 9 Feb 2018 14:32:03 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 Cc: Carlos O'Donell , GNU C Library To: "H.J. Lu" Original-X-From: libc-alpha-return-90183-glibc-alpha=m.gmane.org@sourceware.org Fri Feb 09 15:31:58 2018 Return-path: Envelope-to: glibc-alpha@blaine.gmane.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:cc:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=vYCbMAt+Y6y0bXy+ HwdAS12sW82Zi7vkzUw7+EBrFIWn3zlK25ZrAjfSlc67VzlGQOhFnxplSsCWa9nL +Dc/1Z4e/5UrRJZ9OY+OfUPLQTTUy3hm/E8QxYmWATHBorX9XE0/cn+r6l3B1B11 tAjWnqYw2uD1o50aPpLLYhRqV2o= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:cc:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=AZYx8L7U8av6MiOFlIzPqR jpF8M=; b=DRkKGHCyIaK6/wbH66JL9dVZZf/Mrh+KjS/kwvWpGzdxwMVhusTUrD ShnAH72yyqGJPBHe8YDIcDvLENJNYbhtslIklBmzj52aJXqMj7KGy6+IH5aQ02fw 2vUhPXbGAeh6azpPmMO1ZXPBzlS6fLke2Y6QAsKfbaXa9XFBU+2pQ= Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Original-Sender: libc-alpha-owner@sourceware.org Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.1 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,LIKELY_SPAM_BODY,RCVD_IN_DNSWL_LOW,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy= X-HELO: mx1.redhat.com In-Reply-To: Xref: news.gmane.org gmane.comp.lib.glibc.alpha:82531 Archived-At: Received: from server1.sourceware.org ([209.132.180.131] helo=sourceware.org) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ek9iW-0005TA-RM for glibc-alpha@blaine.gmane.org; Fri, 09 Feb 2018 15:31:57 +0100 Received: (qmail 121929 invoked by alias); 9 Feb 2018 14:33:58 -0000 Received: (qmail 121913 invoked by uid 89); 9 Feb 2018 14:33:58 -0000 On 02/09/2018 03:13 PM, H.J. Lu wrote: > I built glibc master with gcc-8.0.1 -mcet -fcf-protection. Some object > files do get CET marker as expected. But static executable isn't: I said static libraries. If I compile this code (based on the example from the manual page) on Fedora rawhide: #include #include static int done = 0; static int cleanup_pop_arg = 0; static int cnt = 0; static void cleanup_handler(void *arg) { printf("Called clean-up handler\n"); cnt = 0; } void * thread_start(void *arg) { time_t start, curr; printf("New thread started\n"); pthread_cleanup_push(cleanup_handler, NULL); curr = start = time(NULL); while (!done) { pthread_testcancel(); /* A cancellation point */ if (curr < time(NULL)) { curr = time(NULL); printf("cnt = %d\n", cnt); /* A cancellation point */ cnt++; } } pthread_cleanup_pop(cleanup_pop_arg); return NULL; } the small jump buffer is used: 0000000000000030 : 30: f3 0f 1e fa endbr64 34: 53 push %rbx 35: bf 00 00 00 00 mov $0x0,%edi 36: R_X86_64_32 .rodata.str1.1+0x18 3a: 48 83 ec 70 sub $0x70,%rsp 3e: e8 00 00 00 00 callq 43 3f: R_X86_64_PC32 puts-0x4 43: 31 f6 xor %esi,%esi 45: 48 89 e7 mov %rsp,%rdi 48: e8 00 00 00 00 callq 4d 49: R_X86_64_PC32 __sigsetjmp-0x4 4d: f3 0f 1e fa endbr64 51: 85 c0 test %eax,%eax 53: 75 51 jne a6 55: 48 89 e7 mov %rsp,%rdi 58: e8 00 00 00 00 callq 5d 59: R_X86_64_PC32 __pthread_register_cancel-0x4 And it looks to me that readelf says the object file is compatible with CET: Displaying notes found in: .note.gnu.property Owner Data size Description GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 Properties: x86 feature: IBT, SHSTK Thanks, Florian