[GIT PULL] bigendian ucount fix for v5.14-rc

From: Eric W. Biederman
Date: Thu Aug 12 2021 - 12:57:13 EST




Please pull the for-v5.14 branch from the git tree:

git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace.git for-v5.14

HEAD: f153c2246783ba210493054d99c66353f56423c9 ucounts: add missing data type changes

This is on top of the previous ucount fix on top of v5.14-rc3. This is
one change that fixes the ucount sysctls on big endian architectures.
This cycle the counts were expanded to be longs instead of ints, and it
was overlooked to update the sysctl code, so only the low 32bit were
being processed. On litte endian just processing the low 32bits is
fine, but on 64bit big endian processing just the low 32bits results in
the high order bits instead of the low order bits being processed and
nothing works proper.

This change took a little bit to mature as we have the SYSCTL_ZERO, and
SYSCTL_INT_MAX macros that are only usable for sysctls operating on
ints, but unfortunately are not obviously broken. Which resulted in the
versions of this change working on big endian and not on little endian,
because the int SYSCTL_ZERO when extended 64bit wound up being
0x100000000. So we only allowed values greater than 0x100000000 and
less than 0faff. Which unfortunately broken everything that tried
to set the sysctls. (First reported with the windows subsystem for
linux).

I have tested this on x86_64 64bit after first reproducing the problems
with the earlier version of this change, and then verifying the problems
do not exist when we use appropriate long min and max values for extra1
and extra2.

Eric

Signed-off-by: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx>