On Tue, Jan 09, 2024 at 01:14:38PM +0100, Christophe Leroy wrote: > Add a writable attribute in debugfs to trigger a > W^X pages check at any time. > > To trigger the test, just echo any numeric value into > /sys/kernel/debug/check_wx_pages > > The result is provided into dmesg. > > Signed-off-by: Christophe Leroy <christophe.leroy@xxxxxxxxxx> > --- > mm/ptdump.c | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) ... > +static int check_wx_debugfs_set(void *data, u64 val) > +{ > + ptdump_check_wx(); > + > + return 0; > +} > + > +DEFINE_SIMPLE_ATTRIBUTE(check_wx_fops, NULL, check_wx_debugfs_set, "%llu\n"); > + > +static int ptdump_debugfs_init(void) > +{ > + debugfs_create_file("check_wx_pages", 0200, NULL, NULL, &check_wx_fops); > + > + return 0; > +} Wouldn't it be better to have (only?) a readable attribute which triggers this, and provides the result via this attribute? That would allow for automated tests without having to parse dmesg.