On Thu, Jan 6, 2011 at 3:47 AM, Eric W. Biederman <[email protected]> wrote: > Amerigo Wang <[email protected]> writes: > >> Eric pointed out that kexec_load() actually allows you to >> run any code you want in ring0, this is more like CAP_SYS_MODULE. > > Let me get this straight you want to make the permission checks > less stringent by allowing either CAP_SYS_MODULE or CAP_SYS_BOOT?
Nope, read my patch again. It actually requires BOTH of them. > CAP_SYS_BOOT is the correct capability. Sure you can run any > code but only after rebooting. I don't see how this differs > from any other reboot scenario. The difference is that after a reboot the bootloader and the system control what code is run. kexec_load() immediately runs the new kernel which is not controlled by the bootloader or by the system. Imagine a situation where the bootloader and the /boot directory are RO (enforced by hardware). kexec_load() would let you run any kernel code you want on the box whereas reboot would not. >> Reported-by: Eric Paris <[email protected]> >> Signed-off-by: WANG Cong <[email protected]> >> >> --- >> diff --git a/kernel/kexec.c b/kernel/kexec.c >> index b55045b..c30d613 100644 >> --- a/kernel/kexec.c >> +++ b/kernel/kexec.c >> @@ -945,7 +945,7 @@ SYSCALL_DEFINE4(kexec_load, unsigned long, entry, >> unsigned long, nr_segments, >> int result; >> >> /* We only trust the superuser with rebooting the system. */ >> - if (!capable(CAP_SYS_BOOT)) >> + if (!capable(CAP_SYS_BOOT) || !capable(CAP_SYS_MODULE)) >> return -EPERM; >> >> /* _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
