kexec: use widen_to_ulong since kexec_load has compat on x32/n32
authorEugene Syromyatnikov <evgsyr@gmail.com>
Thu, 20 Oct 2016 08:34:47 +0000 (11:34 +0300)
committerEugene Syromyatnikov <evgsyr@gmail.com>
Fri, 28 Oct 2016 23:54:01 +0000 (02:54 +0300)
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

diff --git a/kexec.c b/kexec.c
index d27bfe1c24a310e9978fe9505dc3d68a05e30df5..bf84db93495267ef21cd5cbf10c9947020f78af0 100644 (file)
--- 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) {