Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp305840ybg; Wed, 10 Jun 2020 01:02:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkVyUhTkMf69b/fMyIidwV2lqFRCE9EyUWfbKdupSErmLYKbJNHOz+KbhTXmefs+NTLt6M X-Received: by 2002:a17:906:3843:: with SMTP id w3mr2307927ejc.177.1591776138618; Wed, 10 Jun 2020 01:02:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591776138; cv=none; d=google.com; s=arc-20160816; b=Pzbh3YrOcxpeTaG3DDqTayJ80XpfdIg96vgoOOgsSC2pWpOOCl9TaH/EU8ysti//eE mN4Gh6I4kogCHRq7evAANY5Qa0dGZJc4nyXy5xoEg6mvBXK254bpi86FQZVmjOtARThQ FlTQp5cNPyntHGZF1dvg92Vnh4vb3xpAz4FYDS0pG4pBsMTbnVM0JCuBgCZlVokNsFzQ MkqamSURWesTqNDgVSAGN3XgEg0TWLT7IhYPeG67pyMIRkONhcpl6sW4is2DvtImE/al W9tMmeEm0pgBoP0Z/9HKz6TqnZ0Zx1uCdLs1jTQBB3tLmtQo48jyYybLMqf7m/TUvRva qBcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=ML9kdv8KWfqd+/DjpnHagHD/lBBhwolauh+PduEJYKE=; b=m0wT29aht/rvdfp1iwXLQ0Hb1iIo4DhgoWQNmxNh+GO9PN7DA0nbx5vI8p/98XUOvq cPWVfggzc1Ot/wMhwlf96IVloKsZL6o5DdnemMhAKGCoaGCDcnSbG3eurKz3rwVFHP0/ pchd61Rg8+V7dxmua0olKPJ3iBzGtsnKi/pvfkw6lDqWnYGGDs5qeM6v3nTk3SCdDlKG oixDNVxmloF+2ZMvIx03wg0smYO/C9VcJ7Hr7W4/Z32gJQnFPlCSVGf/354jCz7LAKfy +yk0FknJZvCO9WJmOVPJioz6GjUscnf66RndXVQoPc8MIcQcaWoN1AjUVu9Hh3lF5zil nNcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="M7NL44k/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id di25si11932583edb.539.2020.06.10.01.01.55; Wed, 10 Jun 2020 01:02:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="M7NL44k/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726660AbgFJH7d (ORCPT + 99 others); Wed, 10 Jun 2020 03:59:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726081AbgFJH7c (ORCPT ); Wed, 10 Jun 2020 03:59:32 -0400 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCD06C03E96B; Wed, 10 Jun 2020 00:59:32 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id e18so630868pgn.7; Wed, 10 Jun 2020 00:59:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ML9kdv8KWfqd+/DjpnHagHD/lBBhwolauh+PduEJYKE=; b=M7NL44k/SIQ/oZqs1+OEQEsGweIwDPcq4JJ2FJOqeXIWrSzyOk/dYcJqEmw1TuNDXV yfz4kiFeHX5hs+8bJQNPj225LR3utD6BGJApBERwJxYcIJeGnqf68Duiik2+dvAdSHrh r+8990E9lvwOJrDoW5XBMTY3xV0Q7rWDHbqjoRvl8Tz12OjBlw+sjxZmWog9GY+rv878 YPRa8n9F/U7CcQ6ngGJG5tQ0TWkwdk/xQfsoYQX+B8mhpS7mx+Sr3t+ED1O869xa1b38 7u7eVoGIg34pj499KV99uxxtPrv8XPLvGqhYfu3LfdGmFakhCaJ8BAKXW/RsNM+VX4IH 2yTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ML9kdv8KWfqd+/DjpnHagHD/lBBhwolauh+PduEJYKE=; b=TNv+ksJuKPdmiNV4vtuHYpV1H7JcPXJSaMdgL5e56L8zKPl0ZeZDmhw72cFqcCLVeT 4KH9b0l6IPPlB2G5PI9HYOifzuLh1HrWtGLpxIhxUzepkHJ+iwF1YEF0rx9eC6VQFG57 jedCJFXDxcjDAecUAai6wJoe2+0J1hx93XH7K/9Kr45oESJ5hINQ66HhWw8wlmxA6Ox6 zCce/QfoAaDJSGVOhdwuaVRfvsLjFHSZLmj+Am6hanKpKUC2LUVYZVpJKCfcAQJdXOkf K5l4yur6A3e1/Wqoi8V033kei4i9ky0jrjU7opxms3xHggwLwzzOvBLtwtXPCy4K9DfM Qa8w== X-Gm-Message-State: AOAM530ncSUUHu9+lgj+ROBn49t6FUFU2ytB1Pg5MgpnAlscnFEjlgMr uyR7WGHlu2BwG4WLowEJ/2U= X-Received: by 2002:a65:66d5:: with SMTP id c21mr1579258pgw.155.1591775971718; Wed, 10 Jun 2020 00:59:31 -0700 (PDT) Received: from gmail.com ([2601:600:817f:a132:df3e:521d:99d5:710d]) by smtp.gmail.com with ESMTPSA id w24sm11877692pfn.11.2020.06.10.00.59.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jun 2020 00:59:30 -0700 (PDT) Date: Wed, 10 Jun 2020 00:59:28 -0700 From: Andrei Vagin To: Christian Brauner Cc: Adrian Reber , Eric Biederman , Pavel Emelyanov , Oleg Nesterov , Dmitry Safonov <0x7f454c46@gmail.com>, Nicolas Viennot , =?utf-8?B?TWljaGHFgiBDxYJhcGnFhHNraQ==?= , Kamil Yurtsever , Dirk Petersen , Christine Flood , Casey Schaufler , Mike Rapoport , Radostin Stoyanov , Cyrill Gorcunov , Serge Hallyn , Stephen Smalley , Sargun Dhillon , Arnd Bergmann , linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, selinux@vger.kernel.org, Eric Paris , Jann Horn , linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v2 1/3] capabilities: Introduce CAP_CHECKPOINT_RESTORE Message-ID: <20200610075928.GA172301@gmail.com> References: <20200603162328.854164-1-areber@redhat.com> <20200603162328.854164-2-areber@redhat.com> <20200609034221.GA150921@gmail.com> <20200609074422.burwzfgwgqqysrzh@wittgenstein> <20200609160627.GA163855@gmail.com> <20200609161427.4eoozs3kkgablmaa@wittgenstein> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20200609161427.4eoozs3kkgablmaa@wittgenstein> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 09, 2020 at 06:14:27PM +0200, Christian Brauner wrote: > On Tue, Jun 09, 2020 at 09:06:27AM -0700, Andrei Vagin wrote: > > On Tue, Jun 09, 2020 at 09:44:22AM +0200, Christian Brauner wrote: > > > On Mon, Jun 08, 2020 at 08:42:21PM -0700, Andrei Vagin wrote: ... > > > > PTRACE_O_SUSPEND_SECCOMP is needed for C/R and it is protected by > > > > CAP_SYS_ADMIN too. > > > > > > This is currently capable(CAP_SYS_ADMIN) (init_ns capable) why is it > > > safe to allow unprivileged users to suspend security policies? That > > > sounds like a bad idea. > > ... > > I don't suggest to remove or > > downgrade this capability check. The patch allows all c/r related > > operations if the current has CAP_CHECKPOINT_RESTORE. > > > > So in this case the check: > > if (!capable(CAP_SYS_ADMIN)) > > return -EPERM; > > > > will be converted in: > > if (!capable(CAP_SYS_ADMIN) && !capable(CAP_CHECKPOINT_RESTORE)) > > return -EPERM; > > Yeah, I got that but what's the goal here? Isn't it that you want to > make it safe to install the criu binary with the CAP_CHECKPOINT_RESTORE > fscap set so that unprivileged users can restore their own processes > without creating a new user namespace or am I missing something? The > use-cases in the cover-letter make it sound like that's what this is > leading up to: > > > > > * Checkpoint/Restore in an HPC environment in combination with a resource > > > > > manager distributing jobs where users are always running as non-root. > > > > > There is a desire to provide a way to checkpoint and restore long running > > > > > jobs. > > > > > * Container migration as non-root > > > > > * We have been in contact with JVM developers who are integrating > > > > > CRIU into a Java VM to decrease the startup time. These checkpoint/restore > > > > > applications are not meant to be running with CAP_SYS_ADMIN. > > But maybe I'm just misunderstanding crucial bits (likely (TM)). I think you understand this right. The goal is to make it possible to use C/R functionality for unprivileged processes. And for me, here are two separate tasks. The first one is how to allow unprivileged users to use C/R from the root user namespace. This is what we discuss here. And another one is how to allow to use C/R functionality from a non-root user namespaces. The second task is about downgrading capable to ns_capable for map_files and PTRACE_O_SUSPEND_SECCOMP. Thanks, Andrei