This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/70646] New: Corrupt truncated function
- From: "jpoimboe at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 13 Apr 2016 15:05:36 +0000
- Subject: [Bug c/70646] New: Corrupt truncated function
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70646
Bug ID: 70646
Summary: Corrupt truncated function
Product: gcc
Version: 5.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: jpoimboe at redhat dot com
Target Milestone: ---
Created attachment 38255
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38255&action=edit
qla_attr.i.gz
The linux kernel has a new tool named "objtool" which follows all possible code
paths for every .o file, looking for abnormalities. In one rare case it has
discovered a corrupt truncated function.
From the disassembly of drivers/scsi/qla2xxx/qla_attr.o:
0000000000002f53 <qla2x00_get_host_fabric_name>:
2f53: 55 push %rbp
2f54: 48 89 e5 mov %rsp,%rbp
0000000000002f57 <qla2x00_get_fc_host_stats>:
2f57: 55 push %rbp
2f58: b9 e8 00 00 00 mov $0xe8,%ecx
2f5d: 48 89 e5 mov %rsp,%rbp
...
Note that qla2x00_get_host_fabric_name() is inexplicably truncated after
setting up the frame pointer. It falls through to the next function, which is
very bad.
I can recreate it with gcc 5.3.1 or gcc 6.0 on the upstream Linux kernel at tag
v4.6-rc3.
The call chain which appears to trigger the problem is:
qla2x00_get_host_fabric_name()
wwn_to_u64()
get_unaligned_be64()
be64_to_cpup()
__be64_to_cpup()
It occurs with the combination of the following two recent Linux commits:
- bc27fb68aaad ("include/uapi/linux/byteorder, swab: force inlining of some
byteswap operations")
- ef3fb2422ffe ("scsi: fc: use get/put_unaligned64 for wwn access")
The gzipped .i file is attached. I'll also attach the kernel .config file.