Re: [PATCH 2/2] x86: Allow disabling of sys_iopl, sys_ioperm

Andrew Morton
2011-07-14T22:32:07Z

On Thu, 14 Jul 2011 13:34:53 -0700
Mike Waychison <mikew@google.com> wrote:

> --- a/arch/x86/kernel/ioport.c
> +++ b/arch/x86/kernel/ioport.c
> @@ -17,6 +17,7 @@
> #include <linux/bitmap.h>
> #include <asm/syscalls.h>
>
> +#ifdef CONFIG_X86_SYS_IOPL
> /*
> * this changes the io permissions bitmap in the current task.
> */
> @@ -111,3 +112,14 @@ long sys_iopl(unsigned int level, struct pt_regs *regs)
>
> return 0;
> }
> +
> +#else /* CONFIG_X86_SYS_IOPL */
> +
> +asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on) {
> + return -ENOSYS;
> +}
> +
> +long sys_iopl(unsigned int level, struct pt_regs *regs) {
> + return -ENOSYS;
> +}
> +#endif /* CONFIG_X86_SYS_IOPL */

sys_iopl() is missing asmlinkage.

It would be far more conventional to use cond_syscall(). Perhaps by
adding a CONFIG_X86 area into kernel/sys_ni.c

fyi, I'm offering special deals on checkpatch.pl site licenses this month.