summaryrefslogtreecommitdiffstats
path: root/module/zfs/zfs_replay.c
diff options
context:
space:
mode:
authorRichard Yao <[email protected]>2013-02-14 23:37:43 -0500
committerBrian Behlendorf <[email protected]>2013-03-04 08:49:32 -0800
commitb01615d5ac86913da1e092d0378bfb8f0e72af30 (patch)
tree905cd8431cce678140c8e3d1bbf35800cffe4e66 /module/zfs/zfs_replay.c
parentc38367c73f592ca9729ba0d5e70b5e3bc67e0745 (diff)
Constify structures containing function pointers
The PaX team modified the kernel's modpost to report writeable function pointers as section mismatches because they are potential exploit targets. We could ignore the warnings, but their presence can obscure actual issues. Proper const correctness can also catch programming mistakes. Building the kernel modules against a PaX/GrSecurity patched Linux 3.4.2 kernel reports 133 section mismatches prior to this patch. This patch eliminates 130 of them. The quantity of writeable function pointers eliminated by constifying each structure is as follows: vdev_opts_t 52 zil_replay_func_t 24 zio_compress_info_t 24 zio_checksum_info_t 9 space_map_ops_t 7 arc_byteswap_func_t 5 The remaining 3 writeable function pointers cannot be addressed by this patch. 2 of them are in zpl_fs_type. The kernel's sget function requires that this be non-const. The final writeable function pointer is created by SPL_SHRINKER_DECLARE. The kernel's set_shrinker() and remove_shrinker() functions also require that this be non-const. Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #1300
Diffstat (limited to 'module/zfs/zfs_replay.c')
-rw-r--r--module/zfs/zfs_replay.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/module/zfs/zfs_replay.c b/module/zfs/zfs_replay.c
index aa6366e11..813250c37 100644
--- a/module/zfs/zfs_replay.c
+++ b/module/zfs/zfs_replay.c
@@ -910,26 +910,26 @@ zfs_replay_acl(zfs_sb_t *zsb, lr_acl_t *lr, boolean_t byteswap)
/*
* Callback vectors for replaying records
*/
-zil_replay_func_t *zfs_replay_vector[TX_MAX_TYPE] = {
- (zil_replay_func_t *)zfs_replay_error, /* no such type */
- (zil_replay_func_t *)zfs_replay_create, /* TX_CREATE */
- (zil_replay_func_t *)zfs_replay_create, /* TX_MKDIR */
- (zil_replay_func_t *)zfs_replay_create, /* TX_MKXATTR */
- (zil_replay_func_t *)zfs_replay_create, /* TX_SYMLINK */
- (zil_replay_func_t *)zfs_replay_remove, /* TX_REMOVE */
- (zil_replay_func_t *)zfs_replay_remove, /* TX_RMDIR */
- (zil_replay_func_t *)zfs_replay_link, /* TX_LINK */
- (zil_replay_func_t *)zfs_replay_rename, /* TX_RENAME */
- (zil_replay_func_t *)zfs_replay_write, /* TX_WRITE */
- (zil_replay_func_t *)zfs_replay_truncate, /* TX_TRUNCATE */
- (zil_replay_func_t *)zfs_replay_setattr, /* TX_SETATTR */
- (zil_replay_func_t *)zfs_replay_acl_v0, /* TX_ACL_V0 */
- (zil_replay_func_t *)zfs_replay_acl, /* TX_ACL */
- (zil_replay_func_t *)zfs_replay_create_acl, /* TX_CREATE_ACL */
- (zil_replay_func_t *)zfs_replay_create, /* TX_CREATE_ATTR */
- (zil_replay_func_t *)zfs_replay_create_acl, /* TX_CREATE_ACL_ATTR */
- (zil_replay_func_t *)zfs_replay_create_acl, /* TX_MKDIR_ACL */
- (zil_replay_func_t *)zfs_replay_create, /* TX_MKDIR_ATTR */
- (zil_replay_func_t *)zfs_replay_create_acl, /* TX_MKDIR_ACL_ATTR */
- (zil_replay_func_t *)zfs_replay_write2, /* TX_WRITE2 */
+zil_replay_func_t zfs_replay_vector[TX_MAX_TYPE] = {
+ (zil_replay_func_t)zfs_replay_error, /* no such type */
+ (zil_replay_func_t)zfs_replay_create, /* TX_CREATE */
+ (zil_replay_func_t)zfs_replay_create, /* TX_MKDIR */
+ (zil_replay_func_t)zfs_replay_create, /* TX_MKXATTR */
+ (zil_replay_func_t)zfs_replay_create, /* TX_SYMLINK */
+ (zil_replay_func_t)zfs_replay_remove, /* TX_REMOVE */
+ (zil_replay_func_t)zfs_replay_remove, /* TX_RMDIR */
+ (zil_replay_func_t)zfs_replay_link, /* TX_LINK */
+ (zil_replay_func_t)zfs_replay_rename, /* TX_RENAME */
+ (zil_replay_func_t)zfs_replay_write, /* TX_WRITE */
+ (zil_replay_func_t)zfs_replay_truncate, /* TX_TRUNCATE */
+ (zil_replay_func_t)zfs_replay_setattr, /* TX_SETATTR */
+ (zil_replay_func_t)zfs_replay_acl_v0, /* TX_ACL_V0 */
+ (zil_replay_func_t)zfs_replay_acl, /* TX_ACL */
+ (zil_replay_func_t)zfs_replay_create_acl, /* TX_CREATE_ACL */
+ (zil_replay_func_t)zfs_replay_create, /* TX_CREATE_ATTR */
+ (zil_replay_func_t)zfs_replay_create_acl, /* TX_CREATE_ACL_ATTR */
+ (zil_replay_func_t)zfs_replay_create_acl, /* TX_MKDIR_ACL */
+ (zil_replay_func_t)zfs_replay_create, /* TX_MKDIR_ATTR */
+ (zil_replay_func_t)zfs_replay_create_acl, /* TX_MKDIR_ACL_ATTR */
+ (zil_replay_func_t)zfs_replay_write2, /* TX_WRITE2 */
};