Re: [PATCH] tmpfs: reset the memory policy on remount with mpol=default
From: Andrew Morton
Date: Fri Nov 27 2026 - 19:10:54 EST
On Fri, 27 Nov 2026 15:00:15 -0800 Yifan Feng <evanfengff@xxxxxxxxx> wrote:
> mpol_parse_str() returns a NULL policy for "default", and
> shmem_reconfigure() takes a NULL ctx->mpol to mean that no mpol option
> was given. So a remount with mpol=default succeeds but keeps the old
> policy:
>
> # mount -t tmpfs -o mpol=bind:1 none /mnt
> # mount -o remount,mpol=default /mnt
> # grep /mnt /proc/mounts
> none /mnt tmpfs rw,relatime,mpol=bind:1 0 0
>
> Record that an mpol option was parsed, and replace the policy whenever
> one was.
Oh.
So aiui, remounting with mpol=default "succeeds", but new file
policies still get the old mempolicy instead of using the "process
allocation policy"?
hp2:/usr/src/mm> egrep -r "mempolicy|mpol" tools/testing/selftests/mm
tools/testing/selftests/mm/mkdirty.c:#include <linux/mempolicy.h>
hp2:/usr/src/mm>
Oh.
> Fixes: 5f00110f7273 ("tmpfs: fix use-after-free of mempolicy object")
+cc:stable. Thanks.