Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp13130pxb; Tue, 15 Feb 2022 04:38:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJwtkZNgln6kUjESnaRhXgupleQ787odcR4Dl0gIMHtvhR5hABPOuSEUX0hRpKRKNU/T08nl X-Received: by 2002:a63:6a89:: with SMTP id f131mr3416834pgc.108.1644928737217; Tue, 15 Feb 2022 04:38:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644928737; cv=none; d=google.com; s=arc-20160816; b=PktN7DN/i+95R8XIq1SSR7vqkAH9hJBbEiGCnjIutXqrfs18J1VjZNoy+fxt+mkkTw xP/r8GXrIZmOQwRrmTEONMgcQCm/aQ2P1HogDN10k+o4YHSRQboPyvRkoumnIQ+vAm1T OI/VdMChse2vRFD1ZPc5iK0oL5J2zJwv6qntriHUTSo8CwVbmKxjXH1ZATTvu7bAWt1k mKWjBnkVIVaAvZi3Xp0myRfgGG+DwcBwozw/26G3Y330JGILDq4FoCToVUON692okgqJ UwGoLfNS4eIIYS312jym6mlT8iuIHgaBtcKyD8zRpVmA8OawQEH6uprRzDVrVL6HL+Xb tMoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=qoPYCDygpGvEIbFdbv3LLB3EascduTiUcqWT4Mp3dTU=; b=LTXSDMzBWS9HBocGEV4oJgJEUppYM2eodo3rKcJsziU8rWYrO6q7tDuQOX6jIlPvVg bIDV+m+EL5jPbfrTpQO++AWbeVkopzd1X3vAudIQsAEJrOhkSIgSF5x73VAIOz70t60P Uo+hhz/Hh5jW3T8LujY/ugk7nloGXwxnQ4kmqrsOifyKJc+IXclPHrdWfFgIJzbHgzSJ 1VECHMXWIWBvc516G6HdYuV4a5EiaDgUrxqvjlPfvcDuFy/ISHvLPSQhpgbPSH49lGtP z45KAQkHNQQz8L4XqVaOB5kVswd/xJGD0PALIaXbqFw3VvK770gRhpP8RTcpCus3QRmX iTGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="OsExu9/Y"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s81si2599643pgs.847.2022.02.15.04.38.42; Tue, 15 Feb 2022 04:38:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="OsExu9/Y"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237402AbiBOLzx (ORCPT + 99 others); Tue, 15 Feb 2022 06:55:53 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237467AbiBOLzv (ORCPT ); Tue, 15 Feb 2022 06:55:51 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26692A251D; Tue, 15 Feb 2022 03:55:41 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id CF30A1F38C; Tue, 15 Feb 2022 11:55:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1644926139; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=qoPYCDygpGvEIbFdbv3LLB3EascduTiUcqWT4Mp3dTU=; b=OsExu9/YCdm0eLrImqwwU4tkjScD00gApj4EEW+yz8/lgDEbnOmDmtpLqF29TEB5Wy2O6L c78AOEQ2mz1JahQ+OaydMT5MjKyWhkEwUrdSLI+GBVnYrifV+Vf43pJZnLlOzq7c+hcaQR ySow/MVXnSzKnaUGz9VzLvFFSu/UOWs= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id AE2F213C63; Tue, 15 Feb 2022 11:55:39 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id zyjxKbuUC2IZTQAAMHmgww (envelope-from ); Tue, 15 Feb 2022 11:55:39 +0000 Date: Tue, 15 Feb 2022 12:55:38 +0100 From: Michal =?iso-8859-1?Q?Koutn=FD?= To: Solar Designer Cc: Eric Biederman , Alexey Gladkov , Kees Cook , Shuah Khan , Christian Brauner , Ran Xiaokai , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Linux Containers Subject: Re: [RFC PATCH 1/6] set_user: Perform RLIMIT_NPROC capability check against new user credentials Message-ID: <20220215115538.GJ21589@blackbody.suse.cz> References: <20220207121800.5079-1-mkoutny@suse.com> <20220207121800.5079-2-mkoutny@suse.com> <20220210011405.GA17076@openwall.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220210011405.GA17076@openwall.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 10, 2022 at 02:14:05AM +0100, Solar Designer wrote: > However, I think you need to drop the negations of the return value from > security_capable(). > security_capable() returns 0 or -EPERM, while capable() returns a > bool, in kernel/capability.c: ns_capable_common(): Oops. Yeah, I only blindly applied replacement with a predicate for (new) cred and overlooked this inverse semantics. Thanks for pointing that out to me! Nevertheless, this will likely be incorporated via Eric's series anyway. Michal