Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d79df630 authored by David Rientjes's avatar David Rientjes Committed by Linus Torvalds
Browse files

mempolicy: mask off internal flags for userspace API



Flags considered internal to the mempolicy kernel code are stored as part
of the "flags" member of struct mempolicy.

Before exposing a policy type to userspace via get_mempolicy(), these
internal flags must be masked.  Flags exposed to userspace, however,
should still be returned to the user.

Signed-off-by: default avatarDavid Rientjes <rientjes@google.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent b8a0b6cc
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -729,7 +729,11 @@ static long do_get_mempolicy(int *policy, nodemask_t *nmask,
	} else {
		*policy = pol == &default_policy ? MPOL_DEFAULT :
						pol->mode;
		*policy |= pol->flags;
		/*
		 * Internal mempolicy flags must be masked off before exposing
		 * the policy to userspace.
		 */
		*policy |= (pol->flags & MPOL_MODE_FLAGS);
	}

	if (vma) {