From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24186 invoked by alias); 15 May 2014 08:07:41 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 24173 invoked by uid 89); 15 May 2014 08:07:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ve0-f173.google.com Received: from mail-ve0-f173.google.com (HELO mail-ve0-f173.google.com) (209.85.128.173) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 15 May 2014 08:07:39 +0000 Received: by mail-ve0-f173.google.com with SMTP id pa12so830941veb.32 for ; Thu, 15 May 2014 01:07:37 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.220.161.8 with SMTP id p8mr7375100vcx.4.1400141257510; Thu, 15 May 2014 01:07:37 -0700 (PDT) Received: by 10.58.243.98 with HTTP; Thu, 15 May 2014 01:07:37 -0700 (PDT) In-Reply-To: References: <1EC5D30D-A03E-49BB-9BFF-86562E5CA5B5@gmail.com> <5371DD8B.3010302@samsung.com> Date: Thu, 15 May 2014 08:07:00 -0000 Message-ID: Subject: Re: libsanitizer merge from upstream r208536 From: Andrew Pinski To: Konstantin Serebryany Cc: "H.J. Lu" , Yury Gribov , Rainer Orth , GCC Patches , Jakub Jelinek , Dodji Seketeli , Dmitry Vyukov , Marek Polacek , Yuri Gribov , Alexey Samsonov Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2014-05/txt/msg01159.txt.bz2 On Thu, May 15, 2014 at 1:05 AM, Konstantin Serebryany wrote: > H.J., > Thanks for the patches. Please (re)send them to llvm-commits, > otherwise I can not accept them. I think this is bogus reasoning. You should be able to take and post them yourself. Those patches. Thanks, Andrew Pinski > > --kcc > > On Wed, May 14, 2014 at 2:31 AM, H.J. Lu wrote: >> On Tue, May 13, 2014 at 2:02 AM, Konstantin Serebryany >> wrote: >>> New patch attached. >>> It is based on r208674 which enables LeakSanitizer >>> (https://code.google.com/p/address-sanitizer/wiki/LeakSanitizer) by >>> default in asan mode. >> >> There are a couple issues for x32: >> >> 1. This change >> >> @@ -56,13 +55,6 @@ typedef signed long long sptr; // NOLINT >> typedef unsigned long uptr; // NOLINT >> typedef signed long sptr; // NOLINT >> #endif // defined(_WIN64) >> -#if defined(__x86_64__) >> -// Since x32 uses ILP32 data model in 64-bit hardware mode, we must use >> -// 64-bit pointer to unwind stack frame. >> -typedef unsigned long long uhwptr; // NOLINT >> -#else >> -typedef uptr uhwptr; // NOLINT >> -#endif >> typedef unsigned char u8; >> typedef unsigned short u16; // NOLINT >> typedef unsigned int u32; >> >> @@ -120,46 +34,43 @@ uptr StackTrace::GetCurrentPc() { >> void StackTrace::FastUnwindStack(uptr pc, uptr bp, >> uptr stack_top, uptr stack_bottom, >> uptr max_depth) { >> - if (max_depth == 0) { >> - size = 0; >> - return; >> - } >> + CHECK_GE(max_depth, 2); >> trace[0] = pc; >> size = 1; >> - uhwptr *frame = (uhwptr *)bp; >> - uhwptr *prev_frame = frame - 1; >> + uptr *frame = (uptr *)bp; >> + uptr *prev_frame = frame - 1; >> if (stack_top < 4096) return; // Sanity check for stack top. >> // Avoid infinite loop when frame == frame[0] by using frame > prev_frame. >> while (frame > prev_frame && >> - frame < (uhwptr *)stack_top - 2 && >> - frame > (uhwptr *)stack_bottom && >> + frame < (uptr *)stack_top - 2 && >> + frame > (uptr *)stack_bottom && >> IsAligned((uptr)frame, sizeof(*frame)) && >> size < max_depth) { >> - uhwptr pc1 = frame[1]; >> + uptr pc1 = frame[1]; >> if (pc1 != pc) { >> - trace[size++] = (uptr) pc1; >> + trace[size++] = pc1; >> } >> prev_frame = frame; >> - frame = (uhwptr *)frame[0]; >> + frame = (uptr*)frame[0]; >> } >> } >> >> reverted: >> >> 2012-11-16 H.J. Lu >> >> PR other/55333 >> * include/sanitizer/common_interface_defs.h (uhwptr): New type >> for hardware pointer. >> * sanitizer_common/sanitizer_stacktrace.cc >> (StackTrace::FastUnwindStack): >> Replace uptr with uhwptr for stack unwind. >> >> 2. struct linux_dirent is incorrect for x32. We need something like >> >> struct linux_dirent { >> #if defined(__x86_64__) && !defined(_LP64) >> unsigned long long d_ino; >> unsigned long long d_off; >> #else >> unsigned long d_ino; >> unsigned long d_off; >> #endif >> unsigned short d_reclen; >> char d_name[256]; >> }; >> >> 3. Pointers passed to internal_syscall should be casted to (uptr). >> Otherwise, they won't be properly extended to 64-bit. We need >> to use (uptr) in internal_sigprocmask, like >> >> uptr internal_sigprocmask(int how, __sanitizer_sigset_t *set, >> __sanitizer_sigset_t *oldset) { >> #if SANITIZER_FREEBSD >> return internal_syscall(SYSCALL(sigprocmask), how, set, oldset); >> #else >> __sanitizer_kernel_sigset_t *k_set = (__sanitizer_kernel_sigset_t *)set; >> __sanitizer_kernel_sigset_t *k_oldset = (__sanitizer_kernel_sigset_t *)oldset; >> return internal_syscall(SYSCALL(rt_sigprocmask), (uptr)how, >> (uptr)&k_set->sig[0], >> (uptr)&k_oldset->sig[0], sizeof(__sanitizer_kernel_sigset_t)); >> #endif >> } >> >> 4. ThreadDescriptorSize returns wrong value for x32. Size of struct >> pthread should be 1728. >> >> I am enclosing patches for those issues. >> >> >> -- >> H.J.