[OE-core] [PATCH 2/2] strace: Fix aarch64 build with musl

Bruce Ashfield bruce.ashfield at gmail.com
Thu May 9 14:07:14 UTC 2019


On Thu, May 9, 2019 at 10:00 AM Paul Barker <paul at betafive.co.uk> wrote:

> On Thu, 9 May 2019, at 14:48, Bruce Ashfield wrote:
> >
> >
> > On Thu, May 9, 2019 at 9:43 AM Richard Purdie
> > <richard.purdie at linuxfoundation.org> wrote:
> > > On Thu, 2019-05-09 at 08:08 -0400, Paul Barker wrote:
> > >  > On Thu, 9 May 2019, at 11:13, Paul Barker wrote:
> > >  > > On Wed, 8 May 2019, at 14:02, Adrian Bunk wrote:
> > >  > > > On Wed, May 08, 2019 at 11:58:36AM +0000, paul at betafive.co.uk
> > >  > > > wrote:
> > >  > > > > ...
> > >  > > > > +--- strace-4.26.orig/strace.c
> > >  > > > > ++++ strace-4.26/strace.c
> > >  > > > > +@@ -26,7 +26,7 @@
> > >  > > > > + #include <locale.h>
> > >  > > > > + #include <sys/utsname.h>
> > >  > > > > + #ifdef HAVE_PRCTL
> > >  > > > > +-# include <sys/prctl.h>
> > >  > > > > ++# include <linux/prctl.h>
> > >  > > > > + #endif
> > >  > > > > + #include <asm/unistd.h>
> > >  > > > > diff --git a/meta/recipes-devtools/strace/strace_4.26.bb
> > >  > > > > b/meta/recipes-devtools/strace/strace_4.26.bb
> > >  > > > > index 24f92c99e5..b71122babf 100644
> > >  > > > > --- a/meta/recipes-devtools/strace/strace_4.26.bb
> > >  > > > > +++ b/meta/recipes-devtools/strace/strace_4.26.bb
> > >  > > > > @@ -15,6 +15,7 @@ SRC_URI = "
> > >  > > > > https://strace.io/files/${PV}/strace-${PV}.tar.xz <
> https://strace.io/files/$%7BPV%7D/strace-$%7BPV%7D.tar.xz> \
> > >  > > > > file://0001-caps-abbrev.awk-fix-gawk-s-path.patch \
> > >  > > > > file://0001-tests-sigaction-Check-for-mips-and-
> > >  > > > > alpha-before-usin.patch \
> > >  > > > > file://0001-mips-o32-fix-build.patch \
> > >  > > > > + file://musl-fixes-armv8.patch \
> > >  > > > > "
> > >  > > > > ...
> > >  > > >
> > >  > > > #include <sys/prctl.h> is the documented way for getting the
> > >  > > > prototype
> > >  > > > of prctl(), which cannot be in linux/prctl.h for obvious
> reasons.
> > >  > > >
> > >  > > > This patch creates the following problem:
> > >  > > >
> > >  > > > ../strace-4.26/strace.c: In function 'startup_child':
> > >  > > > ../strace-4.26/strace.c:1355:3: warning: implicit declaration
> of
> > >  > > > function 'prctl' [-Wimplicit-function-declaration]
> > >  > > > prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY);
> > >  > > > ^~~~~
> > >  > > >
> > >  > >
> > >  > > Ah that's definitely not a solution then. I'll have to look into
> > >  > > this
> > >  > > further and see if I can come up with a v2 patch that doesn't
> > >  > > cause
> > >  > > this warning.
> > >  > >
> > >  >
> > >  > So alpine fixes this by patching the linux headers:
> > >  >
> https://git.alpinelinux.org/aports/tree/main/linux-headers/fix-aarch64-asm-ptrace.patch
> > >  >
> > >  > I think that should be acceptable here if we just do it when
> building
> > >  > with musl libc.
> > >  >
> > >  > Any thoughts on that before I work up a v2 patch?
> > >
> > >  This really needs to get fixed upstream. I don't mind a patch but only
> > >  if its gone upstream, we don't want to be carrying patches to libc-
> > >  headers.
> >
> > I can live with that as well, we have carried them just for musl in the
> > past, but yes, we should at least know that someone is trying to
> > upstream it. I can't get the alpine linux git to come in right now, so
> > I can't check the referenced change to see how it looks.
> >
> > I'm going to do new libc-headers when I get the -dev kernel up and
> > running with the 5.2-rc kernels, so I can watch to see that it
> > continues to apply. I can also do some extra build testing here, if you
> > want the headers change to come through my next pull request.
> >
>
> There's a lot of redefinition between musl and the kernel headers that
> hasn't been reconciled yet (see
> https://www.spinics.net/lists/y2038/msg03836.html for some discussion) so
> I think there's much more to be done upstream than just fixing this one
> instance.
>

Agreed. There's a long, bikeshedding, philosophical debate about musl and
headers that is always ongoing (not this discussion, that is not my
comment). But if this one instance is a small change, I think it is worth
carrying, the amount of musl patches to libc-headers has fluctuated over
time, so this is no different. We can only deal with the problems we are
seeing in our builds (I state the obvious).



>
> I'm now dropping the `#include <linux/prctl.h>` line in
> arch/arm64/include/uapi/asm/ptrace.h (
> https://github.com/torvalds/linux/blob/v5.1/arch/arm64/include/uapi/asm/ptrace.h#L68)
> in linux-libc-headers and that's giving working builds for me but I'm not
> sure how universally it can be applied. I'm happy to carry that as a
> bbappend in our distro layer for now but that will leave strace broke on
> aarch64 when using musl for others.
>
>
I'm still ok with patching it out of the headers, build tests would shake
any issues out, but I can't see there being too many.

Bruce



> Thanks,
>
> --
> Paul Barker
> Managing Director & Principal Engineer
> Beta Five Ltd
>


-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end
- "Use the force Harry" - Gandalf, Star Trek II
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20190509/489282e6/attachment-0001.html>


More information about the Openembedded-core mailing list