[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140319160707.GA19820@kroah.com>
Date: Wed, 19 Mar 2014 09:07:07 -0700
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Rusty Russell <rusty@...tcorp.com.au>
Cc: Joe Perches <joe@...ches.com>, Theodore Ts'o <tytso@....edu>,
Linux Kernel Developers List <linux-kernel@...r.kernel.org>,
"Michael S. Tsirkin" <mst@...hat.com>,
virtio-dev@...ts.oasis-open.org,
virtualization@...ts.linux-foundation.org, fes@...gle.com,
Bjorn Helgaas <bhelgaas@...gle.com>
Subject: Re: [PATCH] virtio-blk: make the queue depth configurable
On Wed, Mar 19, 2014 at 05:07:50PM +1030, Rusty Russell wrote:
> Joe Perches <joe@...ches.com> writes:
> > On Sun, 2014-03-16 at 22:00 -0700, Joe Perches wrote:
> >> On Mon, 2014-03-17 at 14:25 +1030, Rusty Russell wrote:
> >>
> >> > Erk, our tests are insufficient. Testbuilding an allmodconfig with this
> >> > now:
> >>
> >> Good idea.
> >>
> >> > diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
> >> []
> >> > @@ -188,6 +188,9 @@ struct kparam_array
> >> > /* Default value instead of permissions? */ \
> >> > static int __param_perm_check_##name __attribute__((unused)) = \
> >> > BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \
> >> > + /* User perms >= group perms >= other perms. */ \
> >> > + + BUILD_BUG_ON_ZERO(((perm) >> 6) < (((perm) >> 3) & 7)) \
> >> > + + BUILD_BUG_ON_ZERO((((perm) >> 3) & 7) < ((perm) & 7)) \
> >> > + BUILD_BUG_ON_ZERO(sizeof(""prefix) > MAX_PARAM_PREFIX_LEN); \
> >> > static const char __param_str_##name[] = prefix #name; \
> >> > static struct kernel_param __moduleparam_const __param_##name \
> >>
> >> It might make sense to separate this octal permissions
> >> test into a new macro for other checks in macros like
> >> CLASS_ATTR, DEVICE_ATTR, SENSOR_ATTR and SENSOR_ATTR_2.
>
> OK, I took your bikeshed and re-painted it below.
>
> > #define VERIFY_OCTAL_PERMISSIONS(perms) \
> > ({ \
> > if (__builtin_constant_p(perms)) { \
> > BUILD_BUG_ON((perms) < 0); \
> > BUILD_BUG_ON((perms) > 0777); \
> > /* User perms >= group perms >= other perms */ \
> > BUILD_BUG_ON(((perms) >> 6) < (((perms) >> 3) & 7)); \
> > BUILD_BUG_ON((((perms) >> 3) & 7) < ((perms) & 7)); \
> > } \
> > ; \
> > })
>
> Subject: VERIFY_OCTAL_PERMISSIONS: stricter checking for sysfs perms.
>
> Summary of http://lkml.org/lkml/2014/3/14/363 :
>
> Ted: module_param(queue_depth, int, 444)
> Joe: 0444!
> Rusty: User perms >= group perms >= other perms?
> Joe: CLASS_ATTR, DEVICE_ATTR, SENSOR_ATTR and SENSOR_ATTR_2?
>
> Side effect of stricter permissions means removing the unnecessary
> S_IFREG from drivers/pci/slot.c.
>
> Suggested-by: Joe Perches <joe@...ches.com>
> Cc: Bjorn Helgaas <bhelgaas@...gle.com>
> Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> Signed-off-by: Rusty Russell <rusty@...tcorp.com.au>
Acked-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
--
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