New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 659834 link

Starred by 3 users

Issue metadata

Status: Verified
Owner:
Last visit > 30 days ago
Closed: Sep 28
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug

Blocking:
issue 537368



Sign in to add a comment

busybox: recover image fails when building with clang

Project Member Reported by yunlian@chromium.org, Oct 26 2016

Issue description


Version: 55.0.2869.0/8837.0.0 (Official Build) dev-channel Falco
OS: Chrome

What steps will reproduce the problem?
(1) Try to recover the build 55.0.2869.0/8837.0.0  via USB>> and observe

Expected: Should be able to recover the build.
Actual: Instead unable to recover the build (Blank screen is seen on recovery and after few minutes it's going to existing build which was there in earlier)

This is a Regression issue as it is working fine in M53: 53.0.2785.123/8530.87.0 (Official Build) stable-channel Falco

Note: Recovery is fine with the same version M55: 55.0.2869.0/8837.0.0 (Official Build) dev-channel Gnawty, Paine, Spring, Peppy
 
 

Comment 1 by cmt...@chromium.org, Oct 27 2016

Owner: yunlian@chromium.org
Status: Verified (was: Untriaged)
Status: Assigned (was: Verified)
Cc: vapier@chromium.org llozano@chromium.org manojgupta@chromium.org
I have a source level workaround for this bug.

In the shell/ash.c

It defines a function
static int evaltree(union node *, int);

and it also adds an alias to this function with attribute __noreturn__.

static
int evaltreenr(union node *, int) __attribute__ ((alias("evaltree"),__noreturn__));


and it dies at this piece of code when I run
busybox ash shell/ash_test/ash-misc/wait4.tests 

unsigned is_or = n->type - NAND;
   status = evaltree(
                n->nbinary.ch1,
                (flags | ((is_or >> 1) - 1)) & EV_TESTED
                );
        if ((!status) == is_or || evalskip)
               break;
           n = n->nbinary.ch2;
evaln:
                evalfn = evaltree;
calleval:
                status = evalfn(n, flags);   <---dies here. wrong function pointer.
                goto setstatus;
        }

If I remove the attribute __noreturn__ from evaltreenr,
the unittest passes, recovery image works.

Comment 5 by vapier@chromium.org, Jul 20 2017

that attribute usage does seem evil, but does it mean it's a bug in clang ?

Comment 6 by lloz...@google.com, Jul 20 2017

yes, looks very evil. 
It may be difficult to say that this is clang bug. I dont think this is the intent of the alias attribute.
can you make evaltreenr an alsways inline routine with the nr attribute? 
I think that is the correct way to do what they want.

Comment 7 by vapier@chromium.org, Jul 20 2017

i'm not sure it violates the intent of the alias attribute.  imo, the point of alias is to set up another symbol/entry point but with different attributes (which *don't* propagate back to the original symbol).  most often it's used to get different bindings/visibility.

in that light, adding a noreturn attribute doesn't seem like it should break things.  so if clang is propagating the noreturn attribute back to the target of the alias (evaltree in this case), seems like a bug in clang.
upstream has a fix shown below.
Mike, could you please backport it to gentoo upstream so that I can pull
it over?

Thanks

commit 619d9b5e6848a72350126ea9c1e413fd133181e3
Author: Denys Vlasenko <vda.linux@googlemail.com>
Date:   Fri Jul 28 15:28:33 2017 +0200

    ash: less hackish implementation of evaltreenr()
    
    Defining a function alias with __attribute__ ((alias("evaltree"),__noreturn__))
    is not that usual, and clang had a bug which made it misunderstand
    this construct.
    

Project Member

Comment 9 by bugdroid1@chromium.org, Oct 6 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/portage-stable/+/a5a2b4a008a31ac63d7a50988aa9e01bac90f62c

commit a5a2b4a008a31ac63d7a50988aa9e01bac90f62c
Author: Yunlian Jiang <yunlian@google.com>
Date: Fri Oct 06 22:51:15 2017

busybox: upgrade to 1.27.2

This pulls upstream busybox 1.27.2 to fix a runtime bug if built
with LLVM.

BUG= chromium:659834 
TEST=emerge-terra busybox

Change-Id: I79299b5e0d893f2030211fa5eca97e93fe334f2c
Reviewed-on: https://chromium-review.googlesource.com/705395
Commit-Ready: Yunlian Jiang <yunlian@chromium.org>
Tested-by: Yunlian Jiang <yunlian@chromium.org>
Reviewed-by: Jason Clinton <jclinton@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>

[rename] https://crrev.com/a5a2b4a008a31ac63d7a50988aa9e01bac90f62c/sys-apps/busybox/busybox-1.27.2.ebuild
[modify] https://crrev.com/a5a2b4a008a31ac63d7a50988aa9e01bac90f62c/sys-apps/busybox/Manifest
[delete] https://crrev.com/793b48a7631ad6937d6c6b68e4b9ad96b5f8dbd6/sys-apps/busybox/files/busybox-1.19.0-bb.patch

Project Member

Comment 10 by bugdroid1@chromium.org, Oct 23 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/portage-stable/+/7bca43b3504c491ab95c6d1865a12d4a876ff1da

commit 7bca43b3504c491ab95c6d1865a12d4a876ff1da
Author: Yunlian Jiang <yunlian@google.com>
Date: Mon Oct 23 22:22:20 2017

busybox: backport an upstream patch.

This backports an upstream busybox patch to make it work with
LLVM.

BUG= chromium:659834 
TEST=build busybox with llvm, recovery image works.

Change-Id: I43256f2f604e15204c02899a32f7c732fad562e4
Reviewed-on: https://chromium-review.googlesource.com/710502
Commit-Ready: Yunlian Jiang <yunlian@chromium.org>
Tested-by: Yunlian Jiang <yunlian@chromium.org>
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Jason Clinton <jclinton@chromium.org>

[add] https://crrev.com/7bca43b3504c491ab95c6d1865a12d4a876ff1da/sys-apps/busybox/files/busybox-1.27.2-clang.patch
[rename] https://crrev.com/7bca43b3504c491ab95c6d1865a12d4a876ff1da/sys-apps/busybox/busybox-1.27.2-r1.ebuild

Project Member

Comment 11 by bugdroid1@chromium.org, Oct 25 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/c22592daf9b2649462f6e91021831975d0bfe37d

commit c22592daf9b2649462f6e91021831975d0bfe37d
Author: Yunlian Jiang <yunlian@google.com>
Date: Wed Oct 25 19:13:31 2017

busybox: use clang to build it.

This enables us to use clang to build busybox.

CQ-DEPEND=CL:710502
BUG= chromium:659834 
TEST=build a recovey image for falco and it works.

Change-Id: Ia682311772d715d87c4bd9b2cd2db46d8e8fb75c
Reviewed-on: https://chromium-review.googlesource.com/729498
Commit-Ready: Yunlian Jiang <yunlian@chromium.org>
Tested-by: Yunlian Jiang <yunlian@chromium.org>
Reviewed-by: Jason Clinton <jclinton@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>

[delete] https://crrev.com/a12f14463eb39129ef8fdc553f1c6a738fe71974/chromeos/config/env/sys-apps/busybox

Project Member

Comment 12 by bugdroid1@chromium.org, Nov 1 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/497153a1968d96752cead817eee81023e73645d8

commit 497153a1968d96752cead817eee81023e73645d8
Author: Yunlian Jiang <yunlian@chromium.org>
Date: Wed Nov 01 07:00:13 2017

Revert "busybox: use clang to build it."

This reverts commit c22592daf9b2649462f6e91021831975d0bfe37d.

Reason for revert: chromium:779029

This might break the USB installation for minnie. Revert it first to see whether it helps.

Original change's description:
> busybox: use clang to build it.
>
> This enables us to use clang to build busybox.
>
> CQ-DEPEND=CL:710502
> BUG= chromium:659834 
> TEST=build a recovey image for falco and it works.
>
> Change-Id: Ia682311772d715d87c4bd9b2cd2db46d8e8fb75c
> Reviewed-on: https://chromium-review.googlesource.com/729498
> Commit-Ready: Yunlian Jiang <yunlian@chromium.org>
> Tested-by: Yunlian Jiang <yunlian@chromium.org>
> Reviewed-by: Jason Clinton <jclinton@chromium.org>
> Reviewed-by: Mike Frysinger <vapier@chromium.org>

Bug:  chromium:659834 
Change-Id: Ied3126c9ac6b1a20e52e7606c159b47f3d52c120
Reviewed-on: https://chromium-review.googlesource.com/747821
Commit-Ready: Yunlian Jiang <yunlian@chromium.org>
Tested-by: Yunlian Jiang <yunlian@chromium.org>
Reviewed-by: Jason Clinton <jclinton@chromium.org>
Reviewed-by: Yunlian Jiang <yunlian@chromium.org>

[add] https://crrev.com/497153a1968d96752cead817eee81023e73645d8/chromeos/config/env/sys-apps/busybox

Components: Infra
Components: -Infra Infra>Client>ChromeOS
[It appears that a bunch of old cros issues bulk-added the "Infra" component recently, but they should probably be "Infra>Client>ChromeOS".]
Components: -Infra>Client>ChromeOS
Components: Tools>ChromeOS-Toolchain
Status: Verified (was: Assigned)

Sign in to add a comment