From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756829AbdELO62 (ORCPT ); Fri, 12 May 2017 10:58:28 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:33476 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753149AbdELO61 (ORCPT ); Fri, 12 May 2017 10:58:27 -0400 Date: Fri, 12 May 2017 17:58:24 +0300 From: Cyrill Gorcunov To: Kirill Tkhai Cc: mhocko@suse.com, avagin@openvz.org, skinsbursky@virtuozzo.com, oleg@redhat.com, linux-kernel@vger.kernel.org, ebiederm@xmission.com, akpm@linux-foundation.org, ptikhomirov@virtuozzo.com, serge@hallyn.com Subject: Re: [PATCH] prctl: Allow local CAP_SYS_ADMIN changing exe_file Message-ID: <20170512145824.GB1881@uranus.lan> References: <149459906128.21666.4535332985674353536.stgit@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <149459906128.21666.4535332985674353536.stgit@localhost.localdomain> User-Agent: Mutt/1.8.0 (2017-02-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 12, 2017 at 05:33:36PM +0300, Kirill Tkhai wrote: > During checkpointing and restore of userspace tasks > we bumped into the situation, that it's not possible > to restore the tasks, which user namespace does not > have uid 0 or gid 0 mapped. > > People create user namespace mappings like they want, > and there is no a limitation on obligatory uid and gid > "must be mapped". So, if there is no uid 0 or gid 0 > in the mapping, it's impossible to restore mm->exe_file > of the processes belonging to this user namespace. > > Also, there is no a workaround. It's impossible > to create a temporary uid/gid mapping, because > only one write to /proc/[pid]/uid_map and gid_map > is allowed during a namespace lifetime. > If there is an entry, then no more mapings can't be > written. If there isn't an entry, we can't write > there too, otherwise user task won't be able > to do that in the future. > > The patch changes the check, and looks for CAP_SYS_ADMIN > instead of zero uid and gid. This allows to restore > a task independently of its user namespace mappings. > > Signed-off-by: Kirill Tkhai > CC: Andrew Morton > CC: Serge Hallyn > CC: "Eric W. Biederman" > CC: Oleg Nesterov > CC: Michal Hocko > CC: Andrei Vagin > CC: Cyrill Gorcunov > CC: Stanislav Kinsburskiy > CC: Pavel Tikhomirov > --- > kernel/sys.c | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) Reviewed-by: Cyrill Gorcunov