Bug#785756: libffi: bug on arm64 when passing small struct on stack
Source: libffi
Version: 3.1-2
Tags: patch
The latest python-cffi (0.9.2-2) seems to have exposed a bug in libffi
on arm64:
https://buildd.debian.org/status/package.php?p=python-cffi&suite=sid
It seems to involve the case of small structs, that could be passed in
registers, being passed on the stack when there are insufficient
argument registers available.
The attached patch seems to fix the problem.
You'll want to check the logic carefully, and, if you were expecting
libffi's tests to detect that kind of thing, perhaps check that, too.
Thanks.
--- src/aarch64/ffi.c.orig 2015-05-19 19:07:14.460000000 +0000
+++ src/aarch64/ffi.c 2015-05-19 19:07:32.660000000 +0000
@@ -728,7 +728,7 @@
state.ngrn = N_X_ARG_REG;
memcpy (allocate_to_stack (&state, stack, ty->alignment,
- ty->size), ecif->avalue + i, ty->size);
+ ty->size), ecif->avalue[i], ty->size);
}
break;
Reply to: