Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1114588 - crash 7.0.7 is ftbfs on aarch64
Summary: crash 7.0.7 is ftbfs on aarch64
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: crash
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Dave Anderson
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: ARM64, F-ExcludeArch-aarch64
TreeView+ depends on / blocked
 
Reported: 2014-06-30 12:46 UTC by Peter Robinson
Modified: 2014-07-03 08:49 UTC (History)
3 users (show)

Fixed In Version: crash-7.0.7-2.fc21
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-07-03 08:49:14 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
patch to have aarch64-linux-nat.c #include <asm/ptrace.h> directly (415 bytes, patch)
2014-07-02 15:01 UTC, Dave Anderson
no flags Details | Diff

Description Peter Robinson 2014-06-30 12:46:03 UTC
crash-7.0.7-1.fc21

http://arm.koji.fedoraproject.org/koji/taskinfo?taskID=2465647

If the failed builds logs disappear the latest will be here:

http://arm.koji.fedoraproject.org/koji/packageinfo?packageID=1156


gcc -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches    -I. -I. -I./common -I./config -DLOCALEDIR="\"/usr/local/share/locale\"" -DCRASH_MERGE -DHAVE_CONFIG_H -I./../include/opcode -I./../opcodes/..  -I../bfd -I./../bfd -I./../include -I../libdecnumber -I./../libdecnumber  -I./gnulib/import -Ibuild-gnulib/import   -DTUI=1  -Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral -Wno-pointer-sign -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wmissing-prototypes -Wdeclaration-after-statement -Wempty-body  -c -o aarch64-linux-nat.o -MT aarch64-linux-nat.o -MMD -MP -MF .deps/aarch64-linux-nat.Tpo aarch64-linux-nat.c
aarch64-linux-nat.c: In function 'aarch64_linux_set_debug_regs':
aarch64-linux-nat.c:311:29: error: storage size of 'regs' isn't known
   struct user_hwdebug_state regs;
                             ^
aarch64-linux-nat.c: In function 'aarch64_linux_get_debug_reg_capacity':
aarch64-linux-nat.c:780:29: error: storage size of 'dreg_state' isn't known
   struct user_hwdebug_state dreg_state;
                             ^
Makefile:995: recipe for target 'aarch64-linux-nat.o' failed
make[4]: *** [aarch64-linux-nat.o] Error 1
Makefile:8597: recipe for target 'all-gdb' failed
make[3]: *** [all-gdb] Error 2
Makefile:834: recipe for target 'all' failed
make[2]: *** [all] Error 2
crash build failed
Makefile:224: recipe for target 'gdb_merge' failed
make[1]: *** [gdb_merge] Error 1
make: *** [all] Error 2
Makefile:219: recipe for target 'all' failed

Comment 1 Dave Anderson 2014-06-30 19:50:52 UTC
(In reply to Peter Robinson from comment #0)

> aarch64-linux-nat.c: In function 'aarch64_linux_set_debug_regs':
> aarch64-linux-nat.c:311:29: error: storage size of 'regs' isn't known
>    struct user_hwdebug_state regs;
>                              ^
> aarch64-linux-nat.c: In function 'aarch64_linux_get_debug_reg_capacity':
> aarch64-linux-nat.c:780:29: error: storage size of 'dreg_state' isn't known
>    struct user_hwdebug_state dreg_state;

I don't know why the declaration for the user_hwdebug_state structure
cannot be found in the Fedora build. 

The user_hwdebug_state structure is #define'd in /usr/include/asm/ptrace.h
which is #include'd by aarch64-linux-nat.c on line 34:

      1 /* Native-dependent code for GNU/Linux AArch64.
      2 
      3    Copyright (C) 2011-2013 Free Software Foundation, Inc.
      4    Contributed by ARM Ltd.
      5 
      6    This file is part of GDB.
      7 
      8    This program is free software; you can redistribute it and/or modify
      9    it under the terms of the GNU General Public License as published by
     10    the Free Software Foundation; either version 3 of the License, or
     11    (at your option) any later version.
     12 
     13    This program is distributed in the hope that it will be useful,
     14    but WITHOUT ANY WARRANTY; without even the implied warranty of
     15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16    GNU General Public License for more details.
     17 
     18    You should have received a copy of the GNU General Public License
     19    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
     20 
     21 #include "defs.h"
     22 
     23 #include "inferior.h"
     24 #include "gdbcore.h"
     25 #include "regcache.h"
     26 #include "linux-nat.h"
     27 #include "target-descriptions.h"
     28 #include "auxv.h"
     29 #include "gdbcmd.h"
     30 #include "aarch64-tdep.h"
     31 #include "aarch64-linux-tdep.h"
     32 #include "elf/common.h"
     33 
     34 #include <sys/ptrace.h>
     35 #include <sys/utsname.h>
     36 

ptrace.h is part of glibc-headers, as seen on this ARM64 machine:

  # rpm -qf /usr/include/sys/ptrace.h
  glibc-headers-2.17-55.10.sa1.3.aarch64
  #  

I note that in the failing Fedora build, a later version of 
glibc-headers is used compared to the RHEL7 version that is
used to build crash-7.0.7-1.sa1.3.aarch64.rpm:

RHEL7: DEBUG util.py:281:   glibc-headers             aarch64    2.17-55.11.sa1.3           build    632 k

FEDORA: DEBUG util.py:282:   glibc-headers            aarch64   2.19.90-23.fc21               build   635 k

I don't know where to find the aarch64 version of glibc-headers-2.19.90-23.fc21
to see if ptrace.h is still there, or if something's changed with that data 
structure.  Can you give me a pointer to the package repository?

Comment 2 Dave Anderson 2014-06-30 20:08:29 UTC
> The user_hwdebug_state structure is #define'd in /usr/include/asm/ptrace.h

I meant declared, not #define'd.  It has to match the kernel version,
which hasn't changed since October 2012:

struct user_hwdebug_state {
        __u32           dbg_info;
        __u32           pad;
        struct {
                __u64   addr;
                __u32   ctrl;
                __u32   pad;
        }               dbg_regs[16];
};

so it seems unlikely/hard-to-explain that it would have changed in
the user-space version.

Comment 3 Peter Robinson 2014-06-30 21:14:29 UTC
> ptrace.h is part of glibc-headers, as seen on this ARM64 machine:
> 
>   # rpm -qf /usr/include/sys/ptrace.h
>   glibc-headers-2.17-55.10.sa1.3.aarch64
>   #  
> 
> I note that in the failing Fedora build, a later version of 
> glibc-headers is used compared to the RHEL7 version that is
> used to build crash-7.0.7-1.sa1.3.aarch64.rpm:
> 
> RHEL7: DEBUG util.py:281:   glibc-headers             aarch64   
> 2.17-55.11.sa1.3           build    632 k
> 
> FEDORA: DEBUG util.py:282:   glibc-headers            aarch64  
> 2.19.90-23.fc21               build   635 k
> 
> I don't know where to find the aarch64 version of
> glibc-headers-2.19.90-23.fc21
> to see if ptrace.h is still there, or if something's changed with that data 
> structure.  Can you give me a pointer to the package repository?

It's the standard upstream Fedora rawhide glibc:

http://koji.fedoraproject.org/koji/buildinfo?buildID=539740

Probably the easiest way to get the source is "fedpkg clone glibc; cd glibc; fedpkg prep" and it'll pull it down and apply all the patches. It's basically upstream glibc snapshots, so it'll be pretty close to upstream head for the 2.20 release.

Comment 4 Dave Anderson 2014-07-01 14:28:45 UTC
>     33 
>     34 #include <sys/ptrace.h>
>     35 #include <sys/utsname.h>
>     36 
>
> ptrace.h is part of glibc-headers, as seen on this ARM64 machine:
> 
>   # rpm -qf /usr/include/sys/ptrace.h
>   glibc-headers-2.17-55.10.sa1.3.aarch64
>   #  

My mistake -- even though aarch64-linux-nat.c #include's <sys/ptrace.h>,
the structure is declared in <asm/ptrace.h>, which is not directly 
#include'd by the aarch64-linux-nat.c.  So it must be picked up indirectly
by some other #include file. 

Anyway, <asm/ptrace.h> is part of the kernel-headers package.  
In the RHEL7 brew environment where crash builds just fine,
it uses:

  kernel-headers  aarch64  3.15.0-0.rc7.35.sa2  build  875 k

In the failed Fedora build, it uses:

  kernel-headers  aarch64  3.15.0-1.fc21  build  946 k

I downloaded and built the kernel-3.15.0-1.fc21 package, and
as expected, the <asm/ptrace.h> is identical to that contained
in the RHEL7 3.15.0-0.rc7.35.sa2 package.

So at this point I'm trying to figure out how aarch64-linux-nat.c
gets <asm/ptrace.h> included.

Comment 5 Peter Robinson 2014-07-01 15:07:45 UTC
FYI still fails with 3.16.0-0.rc3

http://arm.koji.fedoraproject.org/koji/taskinfo?taskID=2468323

Comment 6 Dave Anderson 2014-07-01 17:46:25 UTC
The #include path from aarch64-linux-nat.c to <asm/ptrace.h> goes
like this:

aarch64-linux-nat.c:

  #include "linux-nat.h"

linux-nat.h:

  #include <signal.h>     

/usr/include/signal.h:   (from glibc-headers)

  #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
  #if defined __USE_XOPEN || defined __USE_XOPEN2K8
      #include <sys/ucontext.h>  

/usr/include/sys/ucontext.h:   (from glibc-headers)

  #include <sys/procfs.h>

/usr/include/sys/procfs.h:    (from glibc-headers)

  #include <asm/ptrace.h>   
 
I tried to build glibc-headers on my ARM64 machine, but it fails.  But
looking at the package contents, I can see the header files above
in the ./sysdeps/unix/sysv/linux/aarch64/sys/<header.h> path.  The
signal.h file has changed its prerequisites for #include'ing 
<sys/ucontext.h> slightly, but I presume they are OK.  But more to
the point, the new <sys/procfs.h> file is certainly the problem, 
because it no longer #include's <asm/ptrace.h>.

The RHEL7 version of <sys/procfs.h> has this section of #include's:

  #include <features.h>
  #include <sys/time.h>
  #include <sys/types.h>
  #include <sys/user.h>
  
  /* We need to see the definition of struct pt_regs but do not want the
     linux PTRACE_* defines since they conflict with the generic eglibc
     definitions in sys/ptrace.h Hence the undef's below.  */
  #include <asm/ptrace.h>
  
  #undef PTRACE_GET_THREAD_AREA
  #undef PTRACE_GETHBPREGS
  #undef PTRACE_SETHBPREGS
  
  #include <sys/user.h>
  
  __BEGIN_DECLS
  

The Fedora version removes the <asm/ptrace.h> #include as well as
the redundant <sys/user.h>:
  
  #include <features.h>
  #include <sys/time.h>
  #include <sys/types.h>
  #include <sys/user.h>
  
  __BEGIN_DECLS


So it looks like the best way around this is to simply drop in
an "#include <asm/ptrace.h>" into the aarch64-linux-nat.c file.

But I have no clue as to how to build/test this package for aarch64.
Is it some kind of one-liner koji command or some such?

Comment 7 Dave Anderson 2014-07-02 12:51:48 UTC
> But I have no clue as to how to build/test this package for aarch64.
> Is it some kind of one-liner koji command or some such?

How do you want to handle testing my proposed update(s)?

Comment 8 Peter Robinson 2014-07-02 14:17:40 UTC
(In reply to Dave Anderson from comment #7)
> > But I have no clue as to how to build/test this package for aarch64.
> > Is it some kind of one-liner koji command or some such?
> 
> How do you want to handle testing my proposed update(s)?

If you let me know where the patch/tarball is I can do a scratch build for people to test. If you mean for the actual functionality of the changes themselves Brendan can sort that side of things out.

Comment 9 Dave Anderson 2014-07-02 15:01:09 UTC
Created attachment 914213 [details]
patch to have aarch64-linux-nat.c #include <asm/ptrace.h> directly



No, it's pretty much just a test to ensure that the build can complete.

The ptrace-related functions that fail to compile could never even get
called.  The embedded gdb code in the crash utility does'nt utilize
the affected ptrace-related code, because it's invoked internally as
"gdb vmlinux" just to be able to get debuginfo data.  

The attached patch would become Patch2 in the crash.spec file.

Comment 10 Peter Robinson 2014-07-02 15:03:38 UTC
If you have a src.rpm you can run 

"arm-koji build --scratch rawhide crash-x.y.z-1.src.rpm"

And that will run a scratch build to test the build

Comment 11 Dave Anderson 2014-07-02 15:12:41 UTC
(In reply to Peter Robinson from comment #10)
> If you have a src.rpm you can run 
> 
> "arm-koji build --scratch rawhide crash-x.y.z-1.src.rpm"
> 
> And that will run a scratch build to test the build

OK thanks -- I've got a scratch build underway...

  http://arm.koji.fedoraproject.org/koji/taskinfo?taskID=2470488

Comment 12 Dave Anderson 2014-07-02 15:34:45 UTC
> OK thanks -- I've got a scratch build underway...
>
>  http://arm.koji.fedoraproject.org/koji/taskinfo?taskID=2470488

That worked for ARM64.  Now I'm running:
 
  koji build --scratch rawhide crash-7.0.7-2.fc21.src.rpm

to check whether the glibc-headers changes may affect the 
other architectures.

Comment 13 Dave Anderson 2014-07-02 18:46:07 UTC
There were no problems with the scratch build on the other architectures.
The fix is checked in and built in rawhide:
 
  Information for build crash-7.0.7-2.fc21
  http://koji.fedoraproject.org/koji/buildinfo?buildID=541670

  Changelog:
  * Wed Jul 02 2014 Dave Anderson <anderson> - 7.0.7-2
  - Fix FTBS for aarch64 (BZ #1114588)

Comment 14 Peter Robinson 2014-07-03 08:49:14 UTC
Built on aarch64 rawhide. Thanks


Note You need to log in before you can comment on or make changes to this bug.