[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.61.0610301030550.8678@yvahk01.tjqt.qr>
Date: Mon, 30 Oct 2006 10:33:18 +0100 (MET)
From: Jan Engelhardt <jengelh@...ux01.gwdg.de>
To: Alexey Dobriyan <adobriyan@...il.com>
cc: Andrew Morton <akpm@...l.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Compile-time check re world-writeable module params
>One of mistakes module_param() user can make is to supply default value
>of module parameter as the last argument. module_param() accepts
>permissions instead. If default value is, say, 3 (-------wx), parameter
>becomes world-writeable.
>
>First version of this check (only "& 2" part) directly caught 4 out of 7
>places during my last grep.
It could probably do "& 0013" or "& ~664", because -x seems quite
useless in module parameters. That would also catch perm<0 and
perm>0777.
> #define __module_param_call(prefix, name, set, get, arg, perm) \
>+ /* Default value instead of permissions? */ \
>+ static int __param_perm_check_##name __attribute__((unused)) = \
>+ BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)); \
> static char __param_str_##name[] = prefix #name; \
> static struct kernel_param const __param_##name \
> __attribute_used__ \
-`J'
--
-
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