diff --git a/drivers/char/mem.c b/drivers/char/mem.c index a851f16..9bca141 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c @@ -227,10 +227,17 @@ static ssize_t write_mem(struct file *file, const char __user *buf, int allowed; sz = size_inside_page(p, count); + if (IS_ENABLED(CONFIG_DEBUG_AID_FOR_SYZBOT) && + fatal_signal_pending(current)) + printk("write_mem: sz=%zd count=%zd\n", sz, count); allowed = page_is_allowed(p >> PAGE_SHIFT); - if (!allowed) + if (!allowed) { + if (IS_ENABLED(CONFIG_DEBUG_AID_FOR_SYZBOT) && + fatal_signal_pending(current)) + printk("write_mem: written=%zd *ppos=%lld\n", written, *ppos); return -EPERM; + } /* Skip actual writing when a page is marked as restricted. */ if (allowed == 1) { @@ -263,6 +270,9 @@ static ssize_t write_mem(struct file *file, const char __user *buf, } *ppos += written; + if (IS_ENABLED(CONFIG_DEBUG_AID_FOR_SYZBOT) && + fatal_signal_pending(current)) + printk("write_mem: written=%zd *ppos=%lld\n", written, *ppos); return written; }