Commit d79df630f622806c4d0e116fbaf6ebf6baf53461

Authored by David Rientjes
Committed by Linus Torvalds
1 parent b8a0b6ccf2

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: David Rientjes <rientjes@google.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 5 additions and 1 deletions Side-by-side Diff

... ... @@ -729,7 +729,11 @@
729 729 } else {
730 730 *policy = pol == &default_policy ? MPOL_DEFAULT :
731 731 pol->mode;
732   - *policy |= pol->flags;
  732 + /*
  733 + * Internal mempolicy flags must be masked off before exposing
  734 + * the policy to userspace.
  735 + */
  736 + *policy |= (pol->flags & MPOL_MODE_FLAGS);
733 737 }
734 738  
735 739 if (vma) {