From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Brauner Subject: Re: [PATCH] clone3: fix cgroup argument sanity check Date: Wed, 15 Apr 2020 14:38:15 +0200 Message-ID: <20200415123815.qrc7m2ddboh645uo@wittgenstein> References: <20200412202533.GA29554@asgard.redhat.com> Mime-Version: 1.0 Return-path: Content-Disposition: inline In-Reply-To: <20200412202533.GA29554-ZbobWygYI+YXGNroddHbYwC/G2K4zDHf@public.gmane.org> Sender: cgroups-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Eugene Syromiatnikov Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Christian Brauner , Andrew Morton , Ingo Molnar , Tejun Heo , Oleg Nesterov , Johannes Weiner , Li Zefan , Peter Zijlstra , cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, "Dmitry V. Levin" On Sun, Apr 12, 2020 at 10:25:33PM +0200, Eugene Syromiatnikov wrote: > 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: ef2c41cf38a7559b ("clone3: allow spawning processes into cgroups") > Signed-off-by: Eugene Syromiatnikov > Acked-by: Christian Brauner Applied, thanks! Christian