zfsonlinux/spl — pull request #272 by ryao (2013-08-07 07:04:52+00:00)
Title: PaX/GrSecurity Linux 3.8.y compat: Use __no_const on struct ctl_table

The PaX team started constifying `struct ctl_table` as of their Linux
3.8.0 patchset. This lead to zfsonlinux/spl#225 and Gentoo bug #463012.

While investigating our options, I learned that there is a preprocessor
directive called CONSTIFY_PLUGIN that we can use to detect the presence
of the PaX changes and adjust the code accordingly.

The PaX Team had suggested adopting ctl_table_no_const, but supporting
older kernels required declaring that whenever the CONSTIFY_PLUGIN was
set. Future compiler changes could potentially cause that to break in
the presence of -Werror, so instead we define our own spl_ctl_table
typdef and use that. This is compatible with all PaX kernels currently
supported by PaX upstream.

Unfortunately, this breaks support for some older PaX kernels that where
the GCC PaX plugin causes a build failure when it sees no_const cast on
a non-constified structure. We would need an autotools check to catch
that. That could be done upon sufficient demand. However, I suspect that
most people running ancient PaX kernels would prefer to be forced to
update to a more recent version of the PaX patchset. Therefore, the loss
of backward compatibility with no longer supported PaX patch sets should
be acceptable.

Closes zfsonlinux/spl#225

Signed-off-by: Richard Yao