<div dir="ltr">Sent out <a href="https://reviews.llvm.org/D38324">https://reviews.llvm.org/D38324</a> to temporary disable the test on armhf.</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 27, 2017 at 10:56 AM, Kostya Kortchinsky <span dir="ltr"><<a href="mailto:kostyak@google.com" target="_blank">kostyak@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I didn't notice that before, looking into it thanks!</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 27, 2017 at 10:54 AM, Diana Picus <span dir="ltr"><<a href="mailto:diana.picus@linaro.org" target="_blank">diana.picus@linaro.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Kostya,<br>
<br>
The valloc test doesn't seem to work nicely on ARM:<br>
<a href="http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15-full-sh/builds/2398" rel="noreferrer" target="_blank">http://lab.llvm.org:8011/build<wbr>ers/clang-cmake-thumbv7-a15-<wbr>full-sh/builds/2398</a><br>
<a href="http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-full/builds/10933" rel="noreferrer" target="_blank">http://lab.llvm.org:8011/build<wbr>ers/clang-cmake-armv7-a15-<wbr>full/builds/10933</a><br>
<br>
Any idea what the problem might be?<br>
<br>
Thanks,<br>
Diana<br>
<br>
PS: Sorry I didn't notice earlier, I was on vacation.<br>
<br>
On 14 September 2017 at 13:34, Kostya Kortchinsky via llvm-commits<br>
<div class="m_8922255968096280821HOEnZb"><div class="m_8922255968096280821h5"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br>
> Author: cryptoad<br>
> Date: Thu Sep 14 13:34:32 2017<br>
> New Revision: 313294<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=313294&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=313294&view=rev</a><br>
> Log:<br>
> [scudo] Fix bad request handling when allocator has not been initialized<br>
><br>
> Summary:<br>
> In a few functions (`scudoMemalign` and the like), we would call<br>
> `ScudoAllocator::FailureHandle<wbr>r::OnBadRequest` if the parameters didn't check<br>
> out. The issue is that if the allocator had not been initialized (eg: if this<br>
> is the first heap related function called), we would use variables like<br>
> `allocator_may_return_null` and `exitcode` that still had their default value<br>
> (as opposed to the one set by the user or the initialization path).<br>
><br>
> To solve this, we introduce `handleBadRequest` that will call `initThreadMaybe`,<br>
> allowing the options to be correctly initialized.<br>
><br>
> Unfortunately, the tests were passing because `exitcode` was still 0, so the<br>
> results looked like success. Change those tests to do what they were supposed<br>
> to.<br>
><br>
> Reviewers: alekseyshl<br>
><br>
> Reviewed By: alekseyshl<br>
><br>
> Subscribers: llvm-commits<br>
><br>
> Differential Revision: <a href="https://reviews.llvm.org/D37853" rel="noreferrer" target="_blank">https://reviews.llvm.org/D3785<wbr>3</a><br>
><br>
> Modified:<br>
>     compiler-rt/trunk/lib/scudo/s<wbr>cudo_allocator.cpp<br>
>     compiler-rt/trunk/test/scudo/<wbr>memalign.cpp<br>
>     compiler-rt/trunk/test/scudo/<wbr>valloc.cpp<br>
><br>
> Modified: compiler-rt/trunk/lib/scudo/sc<wbr>udo_allocator.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/scudo/scudo_allocator.cpp?rev=313294&r1=313293&r2=313294&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/compiler-rt/trunk/lib/sc<wbr>udo/scudo_allocator.cpp?rev=31<wbr>3294&r1=313293&r2=313294&view=<wbr>diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- compiler-rt/trunk/lib/scudo/sc<wbr>udo_allocator.cpp (original)<br>
> +++ compiler-rt/trunk/lib/scudo/sc<wbr>udo_allocator.cpp Thu Sep 14 13:34:32 2017<br>
> @@ -620,6 +620,11 @@ struct ScudoAllocator {<br>
>      BackendAllocator.getStats(stat<wbr>s);<br>
>      return stats[StatType];<br>
>    }<br>
> +<br>
> +  void *handleBadRequest() {<br>
> +    initThreadMaybe();<br>
> +    return FailureHandler::OnBadRequest()<wbr>;<br>
> +  }<br>
>  };<br>
><br>
>  static ScudoAllocator Instance(LINKER_INITIALIZED);<br>
> @@ -677,7 +682,7 @@ void *scudoPvalloc(uptr Size) {<br>
>    uptr PageSize = GetPageSizeCached();<br>
>    if (UNLIKELY(CheckForPvallocOverf<wbr>low(Size, PageSize))) {<br>
>      errno = errno_ENOMEM;<br>
> -    return ScudoAllocator::FailureHandler<wbr>::OnBadRequest();<br>
> +    return Instance.handleBadRequest();<br>
>    }<br>
>    // pvalloc(0) should allocate one page.<br>
>    Size = Size ? RoundUpTo(Size, PageSize) : PageSize;<br>
> @@ -687,14 +692,14 @@ void *scudoPvalloc(uptr Size) {<br>
>  void *scudoMemalign(uptr Alignment, uptr Size) {<br>
>    if (UNLIKELY(!IsPowerOfTwo(Alignm<wbr>ent))) {<br>
>      errno = errno_EINVAL;<br>
> -    return ScudoAllocator::FailureHandler<wbr>::OnBadRequest();<br>
> +    return Instance.handleBadRequest();<br>
>    }<br>
>    return SetErrnoOnNull(Instance.alloca<wbr>te(Size, Alignment, FromMemalign));<br>
>  }<br>
><br>
>  int scudoPosixMemalign(void **MemPtr, uptr Alignment, uptr Size) {<br>
>    if (UNLIKELY(!CheckPosixMemalignA<wbr>lignment(Alignment))) {<br>
> -    ScudoAllocator::FailureHandler<wbr>::OnBadRequest();<br>
> +    Instance.handleBadRequest();<br>
>      return errno_EINVAL;<br>
>    }<br>
>    void *Ptr = Instance.allocate(Size, Alignment, FromMemalign);<br>
> @@ -707,7 +712,7 @@ int scudoPosixMemalign(void **MemPtr, up<br>
>  void *scudoAlignedAlloc(uptr Alignment, uptr Size) {<br>
>    if (UNLIKELY(!CheckAlignedAllocAl<wbr>ignmentAndSize(Alignment, Size))) {<br>
>      errno = errno_EINVAL;<br>
> -    return ScudoAllocator::FailureHandler<wbr>::OnBadRequest();<br>
> +    return Instance.handleBadRequest();<br>
>    }<br>
>    return SetErrnoOnNull(Instance.alloca<wbr>te(Size, Alignment, FromMalloc));<br>
>  }<br>
><br>
> Modified: compiler-rt/trunk/test/scudo/m<wbr>emalign.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/scudo/memalign.cpp?rev=313294&r1=313293&r2=313294&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/compiler-rt/trunk/test/<wbr>scudo/memalign.cpp?rev=313294&<wbr>r1=313293&r2=313294&view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- compiler-rt/trunk/test/scudo/m<wbr>emalign.cpp (original)<br>
> +++ compiler-rt/trunk/test/scudo/m<wbr>emalign.cpp Thu Sep 14 13:34:32 2017<br>
> @@ -1,6 +1,7 @@<br>
>  // RUN: %clang_scudo %s -o %t<br>
> -// RUN: %run %t valid   2>&1<br>
> -// RUN: %run %t invalid 2>&1<br>
> +// RUN:                                               %run %t valid   2>&1<br>
> +// RUN:                                           not %run %t invalid 2>&1<br>
> +// RUN: SCUDO_OPTIONS=allocator_may_re<wbr>turn_null=1     %run %t invalid 2>&1<br>
><br>
>  // Tests that the various aligned allocation functions work as intended. Also<br>
>  // tests for the condition where the alignment is not a power of 2.<br>
><br>
> Modified: compiler-rt/trunk/test/scudo/v<wbr>alloc.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/scudo/valloc.cpp?rev=313294&r1=313293&r2=313294&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/compiler-rt/trunk/test/<wbr>scudo/valloc.cpp?rev=313294&<wbr>r1=313293&r2=313294&view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- compiler-rt/trunk/test/scudo/v<wbr>alloc.cpp (original)<br>
> +++ compiler-rt/trunk/test/scudo/v<wbr>alloc.cpp Thu Sep 14 13:34:32 2017<br>
> @@ -1,6 +1,7 @@<br>
>  // RUN: %clang_scudo %s -o %t<br>
> -// RUN: %run %t valid   2>&1<br>
> -// RUN: %run %t invalid 2>&1<br>
> +// RUN:                                               %run %t valid   2>&1<br>
> +// RUN:                                           not %run %t invalid 2>&1<br>
> +// RUN: SCUDO_OPTIONS=allocator_may_re<wbr>turn_null=1     %run %t invalid 2>&1<br>
><br>
>  // Tests that valloc and pvalloc work as intended.<br>
><br>
><br>
><br>
> ______________________________<wbr>_________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>