[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87r3rotgwv.fsf@rustcorp.com.au>
Date: Mon, 13 Apr 2015 20:48:56 +0930
From: Rusty Russell <rusty@...abs.org>
To: Quentin Casasnovas <quentin.casasnovas@...cle.com>,
lkml <linux-kernel@...r.kernel.org>
Cc: Oleg Nesterov <oleg@...hat.com>, Borislav Petkov <bp@...en8.de>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Quentin Casasnovas <quentin.casasnovas@...cle.com>
Subject: Re: [PATCH 7/7] modpost: handle relocations mismatch in __ex_table.
Quentin Casasnovas <quentin.casasnovas@...cle.com> writes:
> __ex_table is a simple table section where each entry is a pair of
> addresses - the first address is an address which can fault in kernel
> space, and the second address points to where the kernel should jump to
> when handling that fault. This is how copy_from_user() does not crash the
> kernel if userspace gives a borked pointer for example.
Warnings on 32-bit:
scripts/mod/modpost.c:1562:7: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘Elf32_Addr’ [-Wformat=]
to_pretty_name, tosec, tosym_name, to_pretty_name_p);
^
scripts/mod/modpost.c:1574:4: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘Elf32_Addr’ [-Wformat=]
fromsec, r->r_offset, tosec, tosec, tosec);
^
scripts/mod/modpost.c: In function ‘extable_mismatch_handler’:
scripts/mod/modpost.c:1596:9: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘Elf32_Addr’ [-Wformat=]
fromsec, r->r_offset, tosec, modname);
^
scripts/mod/modpost.c:1604:10: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘Elf32_Addr’ [-Wformat=]
fromsec, r->r_offset, tosec);
^
scripts/mod/modpost.c:1611:10: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘Elf32_Addr’ [-Wformat=]
fromsec, r->r_offset, tosec);
^
Fixed like so:
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 7b56ae567fba..b495547e321f 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1557,7 +1557,7 @@ static void report_extable_warnings(const char* modname, struct elf_info* elf,
warn("%s(%s+0x%lx): Section mismatch in reference"
" from the %s %s%s to the %s %s:%s%s\n",
- modname, fromsec, r->r_offset, from_pretty_name,
+ modname, fromsec, (long)r->r_offset, from_pretty_name,
fromsym_name, from_pretty_name_p,
to_pretty_name, tosec, tosym_name, to_pretty_name_p);
@@ -1571,7 +1571,7 @@ static void report_extable_warnings(const char* modname, struct elf_info* elf,
"list of authorized sections to jump to on fault.\n"
"This can be achieved by adding \"%s\" to \n"
"OTHER_TEXT_SECTIONS in scripts/mod/modpost.c.\n",
- fromsec, r->r_offset, tosec, tosec, tosec);
+ fromsec, (long)r->r_offset, tosec, tosec, tosec);
}
static void extable_mismatch_handler(const char* modname, struct elf_info *elf,
@@ -1593,7 +1593,7 @@ static void extable_mismatch_handler(const char* modname, struct elf_info *elf,
"Something is seriously wrong and should be fixed.\n"
"You might get more information about where this is\n"
"coming from by using scripts/check_extable.sh %s\n",
- fromsec, r->r_offset, tosec, modname);
+ fromsec, (long)r->r_offset, tosec, modname);
else if (!is_executable_section(elf, get_secindex(elf, sym))) {
if (is_extable_fault_address(r))
fatal("The relocation at %s+0x%lx references\n"
@@ -1601,14 +1601,14 @@ static void extable_mismatch_handler(const char* modname, struct elf_info *elf,
"it is not possible for the kernel to fault\n"
"at that address. Something is seriously wrong\n"
"and should be fixed.\n",
- fromsec, r->r_offset, tosec);
+ fromsec, (long)r->r_offset, tosec);
else
fatal("The relocation at %s+0x%lx references\n"
"section \"%s\" which is not executable, IOW\n"
"the kernel will fault if it ever tries to\n"
"jump to it. Something is seriously wrong\n"
"and should be fixed.\n",
- fromsec, r->r_offset, tosec);
+ fromsec, (long)r->r_offset, tosec);
}
}
Thanks,
Rusty.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists