aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAndrea Arcangeli <aarcange@redhat.com>2021-01-09 18:46:59 -0500
committerAndrea Arcangeli <aarcange@redhat.com>2023-11-11 22:03:38 -0500
commit5a61c9041a4485eb9607ff32e383a65346661b87 (patch)
treec739b5219edc394e782b5552fb9518a6b4923845
parent78e8089e340ec80006b98c291d98dc8ac48f8bf6 (diff)
downloadaa-5a61c9041a4485eb9607ff32e383a65346661b87.tar.gz
mm: soft_dirty: fail CLEAR_REFS_SOFT_DIRTY if not built into the kernel
Notify userland it's running on a kernel with soft dirty not compiled in. Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
-rw-r--r--fs/proc/task_mmu.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index d08bc4cd996a71..058122cc5e9f33 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -1218,6 +1218,11 @@ static ssize_t clear_refs_write(struct file *file, const char __user *buf,
type = (enum clear_refs_types)itype;
if (type < CLEAR_REFS_ALL || type >= CLEAR_REFS_LAST)
return -EINVAL;
+ if (!VM_SOFTDIRTY && type == CLEAR_REFS_SOFT_DIRTY) {
+ printk_once(KERN_WARNING
+ "soft_dirty: missing CONFIG_MEM_SOFT_DIRTY=y\n");
+ return -EINVAL;
+ }
task = get_proc_task(file_inode(file));
if (!task)