From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C777DC388F9 for ; Fri, 30 Oct 2020 12:41:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3F398221FA for ; Fri, 30 Oct 2020 12:41:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726557AbgJ3Mld (ORCPT ); Fri, 30 Oct 2020 08:41:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725999AbgJ3Mlc (ORCPT ); Fri, 30 Oct 2020 08:41:32 -0400 Received: from smtp-8faf.mail.infomaniak.ch (smtp-8faf.mail.infomaniak.ch [IPv6:2001:1600:3:17::8faf]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A56AAC0613CF for ; Fri, 30 Oct 2020 05:41:32 -0700 (PDT) Received: from smtp-2-0001.mail.infomaniak.ch (unknown [10.5.36.108]) by smtp-2-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4CN24C353wzlhbLm; Fri, 30 Oct 2020 13:41:31 +0100 (CET) Received: from ns3096276.ip-94-23-54.eu (unknown [94.23.54.103]) by smtp-2-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 4CN2494vmzzlh8TR; Fri, 30 Oct 2020 13:41:29 +0100 (CET) Subject: Re: [PATCH v22 08/12] landlock: Add syscall implementations To: Jann Horn , Kees Cook Cc: James Morris , "Serge E . Hallyn" , Al Viro , Andy Lutomirski , Anton Ivanov , Arnd Bergmann , Casey Schaufler , Jeff Dike , Jonathan Corbet , Michael Kerrisk , Richard Weinberger , Shuah Khan , Vincent Dagonneau , Kernel Hardening , Linux API , linux-arch , "open list:DOCUMENTATION" , linux-fsdevel , kernel list , "open list:KERNEL SELFTEST FRAMEWORK" , linux-security-module , the arch/x86 maintainers , =?UTF-8?Q?Micka=c3=abl_Sala=c3=bcn?= References: <20201027200358.557003-1-mic@digikod.net> <20201027200358.557003-9-mic@digikod.net> From: =?UTF-8?Q?Micka=c3=abl_Sala=c3=bcn?= Message-ID: <163f298b-b492-fee0-b475-102ae8170419@digikod.net> Date: Fri, 30 Oct 2020 13:41:29 +0100 User-Agent: MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 30/10/2020 04:07, Jann Horn wrote: > On Thu, Oct 29, 2020 at 12:30 PM Mickaël Salaün wrote: >> On 29/10/2020 02:06, Jann Horn wrote: >>> On Tue, Oct 27, 2020 at 9:04 PM Mickaël Salaün wrote: >>>> These 3 system calls are designed to be used by unprivileged processes >>>> to sandbox themselves: > [...] >>>> + /* >>>> + * Similar checks as for seccomp(2), except that an -EPERM may be >>>> + * returned. >>>> + */ >>>> + if (!task_no_new_privs(current)) { >>>> + err = security_capable(current_cred(), current_user_ns(), >>>> + CAP_SYS_ADMIN, CAP_OPT_NOAUDIT); >>> >>> I think this should be ns_capable_noaudit(current_user_ns(), CAP_SYS_ADMIN)? >> >> Right. The main difference is that ns_capable*() set PF_SUPERPRIV in >> current->flags. I guess seccomp should use ns_capable_noaudit() as well? > > Yeah. That seccomp code is from commit e2cfabdfd0756, with commit date > in April 2012, while ns_capable_noaudit() was introduced in commit > 98f368e9e263, with commit date in June 2016; the seccomp code predates > the availability of that API. > > Do you want to send a patch to Kees for that, or should I? > I found another case of this inconsistency in ptrace. I sent patches: https://lore.kernel.org/lkml/20201030123849.770769-1-mic@digikod.net/