--- linux-3.0/fs/aufs/dynop.c 2011-08-24 12:17:44.788277908 +0200 +++ linux-3.0/fs/aufs/dynop.c 2011-08-24 12:11:22.375748361 +0200 @@ -149,9 +149,11 @@ #define DySet(func, dst, src, h_op, h_sb) do { \ DyDbgInc(cnt); \ if (h_op->func) { \ - if (src.func) \ - dst.func = src.func; \ - else \ + if (src.func) { \ + pax_open_kernel(); \ + *(void **)&dst.func = src.func; \ + pax_close_kernel(); \ + } else \ AuDbg("%s %s\n", au_sbtype(h_sb), #func); \ } \ } while (0) @@ -159,7 +161,9 @@ #define DySetForce(func, dst, src) do { \ AuDebugOn(!src.func); \ DyDbgInc(cnt); \ - dst.func = src.func; \ + pax_open_kernel(); \ + *(void **)&dst.func = src.func; \ + pax_close_kernel(); \ } while (0) #define DySetAop(func) \ @@ -266,15 +270,17 @@ */ static void dy_adx(struct au_dyaop *dyaop, int do_dx) { + pax_open_kernel(); if (!do_dx) { - dyaop->da_op.direct_IO = NULL; - dyaop->da_op.get_xip_mem = NULL; + *(void **)&dyaop->da_op.direct_IO = NULL; + *(void **)&dyaop->da_op.get_xip_mem = NULL; } else { - dyaop->da_op.direct_IO = aufs_aop.direct_IO; - dyaop->da_op.get_xip_mem = aufs_aop.get_xip_mem; + *(void **)&dyaop->da_op.direct_IO = aufs_aop.direct_IO; + *(void **)&dyaop->da_op.get_xip_mem = aufs_aop.get_xip_mem; if (!dyaop->da_get_xip_mem) - dyaop->da_op.get_xip_mem = NULL; + *(void **)&dyaop->da_op.get_xip_mem = NULL; } + pax_close_kernel(); } static struct au_dyaop *dy_aget(struct au_branch *br, --- linux-3.0/include/linux/fsnotify_backend.h~ 2011-07-22 04:17:23.000000000 +0200 +++ linux-3.0/include/linux/fsnotify_backend.h 2011-08-24 13:39:25.587741912 +0200 @@ -105,6 +105,7 @@ struct fsnotify_ops { void (*freeing_mark)(struct fsnotify_mark *mark, struct fsnotify_group *group); void (*free_event_priv)(struct fsnotify_event_private_data *priv); }; +typedef struct fsnotify_ops __no_const fsnotify_ops_no_const; /* * A group is a "thing" that wants to receive notification about filesystem --- linux-3.0/fs/aufs/branch.h.org 2011-08-24 13:39:47.194932184 +0200 +++ linux-3.0/fs/aufs/branch.h 2011-08-24 13:39:53.691756219 +0200 @@ -83,7 +83,7 @@ struct au_branch { #ifdef CONFIG_AUFS_HFSNOTIFY struct fsnotify_group *br_hfsn_group; - struct fsnotify_ops br_hfsn_ops; + fsnotify_ops_no_const br_hfsn_ops; #endif #ifdef CONFIG_SYSFS --- linux-3.0/fs/aufs/f_op_sp.c~ 2011-08-24 14:41:55.000000000 +0200 +++ linux-3.0/fs/aufs/f_op_sp.c 2011-08-24 14:54:22.072544774 +0200 @@ -108,7 +108,7 @@ static int aufs_open_sp(struct inode *inode, struct file *file); static struct au_sp_fop { int done; - struct file_operations fop; /* not 'const' */ + file_operations_no_const fop; /* not 'const' */ spinlock_t spin; } au_sp_fop[AuSp_Last] = { [AuSp_FIFO] = { @@ -161,7 +161,9 @@ static void au_init_fop_sp(struct file * h_file = au_hf_top(file); spin_lock(&p->spin); if (!p->done) { - p->fop = *h_file->f_op; + pax_open_kernel(); + memcpy((void *)&p->fop, h_file->f_op, sizeof(p->fop)); p->fop.owner = THIS_MODULE; + pax_close_kernel(); if (p->fop.aio_read) p->fop.aio_read = aufs_aio_read_sp;