Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1238060pxu; Mon, 23 Nov 2020 15:36:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJzdIT/FPZ6Dkm7yG6+XL+DQjQOUKLnY0p8ZtSspwmtByughHaSOZiLKOpv71ETMxzd5lpOL X-Received: by 2002:a50:d742:: with SMTP id i2mr1490340edj.154.1606174567132; Mon, 23 Nov 2020 15:36:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606174567; cv=none; d=google.com; s=arc-20160816; b=MNi1iN2rl9Qm55JGUzNHRR0jEBFSq5PckdlpdKjVOAYaakjpgaLHJ47MNHoVGpEBgl G5sRy/cohzT+RxaWdu6bgweyj70dSPKvWYuFv03umpCnLA3mKlxhjrY6lzSqxLMvvj86 pq7F7gXSawB+u8fV0R01ccR+tOiLGPbc62/ATftIFVZrLu/o5GBDmZRacYOuVPjciEUh /dB1GOhJ0tdDuuA+CcExEV9ycyO9qftAxJ/OAqjZT6ivRDyUyQF8+Lru7nYLHu7R4KY/ Ymw9o2vI3to3IgwzJ6aQW1OCY+0u1hdhPbLEEawKxQNlVHJG0Jd7ejcvbyR4WiBPFhjT Ms5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xM/sLUcOvMpgKUz5mmtO3dFL2tmG+b97RuOJoz+pLO8=; b=XMxCFpGz0nF62bKHkvC675QSobNivNfTQHkXD0R25HlM0Kz4LXX+tBYOoEC4mq57mQ zPjIUKQTNeOWIVfpPM2fHJVgvcsEkw0xQSG/QS7gN7n40x7BhUpCltxbViowwHwv7UQY LMmMit0bGTv9nh3es66exj+0UGe089n8MnAVdTdwbuS1x4BvR2N5mmyLHzB7LU+oVKSb FfrTmeqql7HRcIyhXL8eo/CpYNWe8uk+1hy0NoGW01Y42a9hW9Ypk1EJIs8HMbKCTXZx WMP9yoIZPtAKkBYu1u6Ifzo2mJFbNHY2spyqM7eUu4ey4Ebz6lcFzfEVibQw7LP505Bb rqdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2ELBi0t3; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y14si6999864eje.729.2020.11.23.15.35.44; Mon, 23 Nov 2020 15:36:07 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=2ELBi0t3; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731243AbgKWMdf (ORCPT + 99 others); Mon, 23 Nov 2020 07:33:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:44866 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731222AbgKWMd3 (ORCPT ); Mon, 23 Nov 2020 07:33:29 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7312820721; Mon, 23 Nov 2020 12:33:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606134808; bh=/dnVIYf5jXgi+VF73XxdBJqtce3ZZNGNPIM9i4+fHns=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2ELBi0t3GbsQ6doVSTMU1zT5euLFt0uHFUxbjR1TEO0/qNM/S/EXQ0VtYhxYgRXJ8 e1lmsfautDgymMAw2l3/Qa8J1c5tZwdAikOVtzPXFxAk2P6HaN6vf/gRgG0NZzpYfa fSrngmqApBhS7UjWsTqMI7ZKvGQ29jXel+k5Fgb4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jann Horn , Kees Cook , Tyler Hicks , Will Drewry , =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= Subject: [PATCH 4.19 89/91] seccomp: Set PF_SUPERPRIV when checking capability Date: Mon, 23 Nov 2020 13:22:49 +0100 Message-Id: <20201123121813.647989372@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121809.285416732@linuxfoundation.org> References: <20201123121809.285416732@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mickaël Salaün commit fb14528e443646dd3fd02df4437fcf5265b66baa upstream. Replace the use of security_capable(current_cred(), ...) with ns_capable_noaudit() which set PF_SUPERPRIV. Since commit 98f368e9e263 ("kernel: Add noaudit variant of ns_capable()"), a new ns_capable_noaudit() helper is available. Let's use it! Cc: Jann Horn Cc: Kees Cook Cc: Tyler Hicks Cc: Will Drewry Cc: stable@vger.kernel.org Fixes: e2cfabdfd075 ("seccomp: add system call filtering using BPF") Signed-off-by: Mickaël Salaün Reviewed-by: Jann Horn Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/20201030123849.770769-3-mic@digikod.net Signed-off-by: Greg Kroah-Hartman --- kernel/seccomp.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/kernel/seccomp.c +++ b/kernel/seccomp.c @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include @@ -383,8 +383,7 @@ static struct seccomp_filter *seccomp_pr * behavior of privileged children. */ if (!task_no_new_privs(current) && - security_capable(current_cred(), current_user_ns(), - CAP_SYS_ADMIN, CAP_OPT_NOAUDIT) != 0) + !ns_capable_noaudit(current_user_ns(), CAP_SYS_ADMIN)) return ERR_PTR(-EACCES); /* Allocate a new seccomp_filter */