../src/x86/ffi64.c:552:5: runtime error: store to misaligned address

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

../src/x86/ffi64.c:552:5: runtime error: store to misaligned address

Jeffrey Walton-3
Hi Everyone,

I'm testing OpenSC 0.19.0 using a sanitizer build. The sanitizer is
UBsan, and it is enabled with -fsanitize=undefined in CFLAGS and
CXXFLAGS.

OpenSC depends upon p11-kit, and p11-kit depends upon libffi. During
testing of p11-kit, libffi is producing a finding when I 'make check':

../src/x86/ffi64.c:552:5: runtime error: store to misaligned address
0x7ff660b53012 for type 'long long unsigned int', which requires 8
byte alignment
0x7ff660b53012: note: pointer points here
 00 00  49 bb 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00
00 00 00 00  00 00 00 00 00 00
              ^
ERROR: test-managed - missing test plan

I believe the finding is produced by libffi-3.2.1. I can only say "I
believe" because I am having trouble tracking down
"../src/x86/ffi64.c". 'make check' is running from the p11-kit
directory, and ../src/x86/ffi64.c does not exist.

$ find /home/jwalton/tmp-sanitize -name '*ffi*'
/home/jwalton/tmp-sanitize/lib/libffi.so
/home/jwalton/tmp-sanitize/lib/pkgconfig/libffi.pc
/home/jwalton/tmp-sanitize/lib/libffi-3.2.1
/home/jwalton/tmp-sanitize/lib/libffi-3.2.1/include/ffitarget.h
/home/jwalton/tmp-sanitize/lib/libffi-3.2.1/include/ffi.h
/home/jwalton/tmp-sanitize/lib/libffi.so.6.0.4
/home/jwalton/tmp-sanitize/lib/libffi.la
/home/jwalton/tmp-sanitize/lib/libffi.so.6
/home/jwalton/tmp-sanitize/lib/libffi.a

These may be helpful:

$ lsb_release -a
No LSB modules are available.
Distributor ID:    Ubuntu
Description:    Ubuntu 18.04.3 LTS
Release:    18.04
Codename:    bionic

$ gcc --version
gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0

If you have trouble reproducing using just libffi test suite, then I
can offer directions for this setup. It is not too painful because I
have scripts to drive the process. The scripts are on GitHub.

Jeff
Reply | Threaded
Open this post in threaded view
|

Re: ../src/x86/ffi64.c:552:5: runtime error: store to misaligned address

Matthias Klose-6
On 18.09.19 16:01, Jeffrey Walton wrote:

> Hi Everyone,
>
> I'm testing OpenSC 0.19.0 using a sanitizer build. The sanitizer is
> UBsan, and it is enabled with -fsanitize=undefined in CFLAGS and
> CXXFLAGS.
>
> OpenSC depends upon p11-kit, and p11-kit depends upon libffi. During
> testing of p11-kit, libffi is producing a finding when I 'make check':
>
> ../src/x86/ffi64.c:552:5: runtime error: store to misaligned address
> 0x7ff660b53012 for type 'long long unsigned int', which requires 8
> byte alignment
> 0x7ff660b53012: note: pointer points here
>   00 00  49 bb 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00
> 00 00 00 00  00 00 00 00 00 00
>                ^
> ERROR: test-managed - missing test plan
>
> I believe the finding is produced by libffi-3.2.1. I can only say "I
> believe" because I am having trouble tracking down
> "../src/x86/ffi64.c". 'make check' is running from the p11-kit
> directory, and ../src/x86/ffi64.c does not exist.

you could verify that by getting the source shipped in the distribution

   apt source libffi

and point "make check" to the source.