[PATCH 20/26] kexec: Use widen_to_ulong since kexec_load has compat on x32/n32

Eugene Syromyatnikov evgsyr at gmail.com
Mon Oct 24 03:02:25 UTC 2016


Curiously, kexec_load uses compat on x32/n32, so its parameters should
be 4 bytes in size on these ABIs.

* kexec.c (SYS_FUNC(kexec_load)): Use widen_to_ulong for casting
parameters to proper size on x32/n32.
---
 kexec.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/kexec.c b/kexec.c
index d27bfe1..bf84db9 100644
--- a/kexec.c
+++ b/kexec.c
@@ -81,15 +81,16 @@ print_kexec_segments(struct tcb *tcp, const unsigned long addr,
 SYS_FUNC(kexec_load)
 {
 	/* entry, nr_segments */
-	printaddr(tcp->u_arg[0]);
-	tprintf(", %lu, ", tcp->u_arg[1]);
+	printaddr(widen_to_ulong(tcp->u_arg[0]));
+	tprintf(", %lu, ", widen_to_ulong(tcp->u_arg[1]));
 
 	/* segments */
-	print_kexec_segments(tcp, tcp->u_arg[2], tcp->u_arg[1]);
+	print_kexec_segments(tcp, widen_to_ulong(tcp->u_arg[2]),
+			     widen_to_ulong(tcp->u_arg[1]));
 	tprints(", ");
 
 	/* flags */
-	unsigned long n = tcp->u_arg[3];
+	unsigned long n = widen_to_ulong(tcp->u_arg[3]);
 	printxval_long(kexec_arch_values, n & KEXEC_ARCH_MASK, "KEXEC_ARCH_???");
 	n &= ~(unsigned long) KEXEC_ARCH_MASK;
 	if (n) {
-- 
1.7.10.4





More information about the Strace-devel mailing list