From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Serge E. Hallyn" Subject: Re: [PATCH] Forbid invocation of kexec_load() outside initial PID namespace Date: Mon, 6 Aug 2012 19:20:40 +0000 Message-ID: <20120806192040.GA27023@mail.hallyn.com> References: <1343991184-3619-1-git-send-email-berrange@redhat.com> <20120803125210.GD12870@redhat.com> <1344122135.1422.2.camel@Nokia-N900-51-1> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1344122135.1422.2.camel@Nokia-N900-51-1> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Serge Hallyn Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Oleg Nesterov , "Eric W. Biederman" , Tejun Heo , Michael Kerrisk List-Id: containers.vger.kernel.org Quoting Serge Hallyn (serge-A9i7LUbDfNHQT0dZR+AlfA@public.gmane.org): > Eric, > > during the container reboot discussion, the agreement was reached that rebooting for real fron non-init pid ns is not safe. Restarting userspace (in pidns caller owns) is. I argue the same reasoning supports this. > > I haven't had a chance to review the patch, but the idea gets my ack. I'll look at the patch asap. > > I'm also fine with splitting cap_sys_boot into a user and system caps. The former would only be needed targeted to the userns of the init pid, while the latter would be required to init_user_ns. Then containers could safely be given cap_sys_restart or whatever, but not cap_sys_boot which authorizes kexec and machine reset/poweroff. Splitting the cap up into CAP_RESTART (restart /sbin/init) and CAP_BOOT (reboot hardware or kexec kernel) has the advantage that the capabilities each remain simpler to parse, no 'in this context it means that'. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756795Ab2HFTTa (ORCPT ); Mon, 6 Aug 2012 15:19:30 -0400 Received: from 50-56-35-84.static.cloud-ips.com ([50.56.35.84]:54772 "EHLO mail.hallyn.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754594Ab2HFTT3 (ORCPT ); Mon, 6 Aug 2012 15:19:29 -0400 Date: Mon, 6 Aug 2012 19:20:40 +0000 From: "Serge E. Hallyn" To: Serge Hallyn Cc: "Eric W. Biederman" , "Daniel P. Berrange" , linux-kernel@vger.kernel.org, containers@lists.linux-foundation.org, Serge Hallyn , Daniel Lezcano , Michael Kerrisk , Tejun Heo , Oleg Nesterov Subject: Re: [PATCH] Forbid invocation of kexec_load() outside initial PID namespace Message-ID: <20120806192040.GA27023@mail.hallyn.com> References: <1343991184-3619-1-git-send-email-berrange@redhat.com> <20120803125210.GD12870@redhat.com> <1344122135.1422.2.camel@Nokia-N900-51-1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1344122135.1422.2.camel@Nokia-N900-51-1> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Serge Hallyn (serge@hallyn.com): > Eric, > > during the container reboot discussion, the agreement was reached that rebooting for real fron non-init pid ns is not safe. Restarting userspace (in pidns caller owns) is. I argue the same reasoning supports this. > > I haven't had a chance to review the patch, but the idea gets my ack. I'll look at the patch asap. > > I'm also fine with splitting cap_sys_boot into a user and system caps. The former would only be needed targeted to the userns of the init pid, while the latter would be required to init_user_ns. Then containers could safely be given cap_sys_restart or whatever, but not cap_sys_boot which authorizes kexec and machine reset/poweroff. Splitting the cap up into CAP_RESTART (restart /sbin/init) and CAP_BOOT (reboot hardware or kexec kernel) has the advantage that the capabilities each remain simpler to parse, no 'in this context it means that'.