]> git.baikalelectronics.ru Git - kernel.git/commit
clone3: fix cgroup argument sanity check
authorEugene Syromiatnikov <esyr@redhat.com>
Sun, 12 Apr 2020 20:25:33 +0000 (22:25 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 15 Apr 2020 07:56:12 +0000 (09:56 +0200)
commit6fcce1dabe40e795c0b620c94d326bf7ce6618b4
tree1006900d63cfcd7598798ee09a1445bfb3a30ddf
parent77debe99223fc4420251efd54aa90e8024ea8245
clone3: fix cgroup argument sanity check

Checking that cgroup field value of struct clone_args is less than 0
is useless, as it is defined as unsigned 64-bit integer.  Moreover,
it doesn't catch the situations where its higher bits are lost during
the assignment to the cgroup field of the cgroup field of the internal
struct kernel_clone_args (where it is declared as signed 32-bit
integer), so it is still possible to pass garbage there.  A check
against INT_MAX solves both these issues.

Fixes: cbfc2f980954370f ("clone3: allow spawning processes into cgroups")
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
Link: https://lore.kernel.org/r/20200412202533.GA29554@asgard.redhat.com
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
kernel/fork.c