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=-11.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL 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 0184DC4363A for ; Fri, 30 Oct 2020 03:08:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6FE8D20731 for ; Fri, 30 Oct 2020 03:08:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="q9NaR3BR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726155AbgJ3DIM (ORCPT ); Thu, 29 Oct 2020 23:08:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726042AbgJ3DIM (ORCPT ); Thu, 29 Oct 2020 23:08:12 -0400 Received: from mail-lf1-x144.google.com (mail-lf1-x144.google.com [IPv6:2a00:1450:4864:20::144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10107C0613CF for ; Thu, 29 Oct 2020 20:08:12 -0700 (PDT) Received: by mail-lf1-x144.google.com with SMTP id y184so4052099lfa.12 for ; Thu, 29 Oct 2020 20:08:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=zehjsoI4/E9mlHSzS3GihRUsNzlSRlM3AQ/tc2JFGWU=; b=q9NaR3BRuvTzXjW1tFWJC7ghaDMvWYJV4F/R/sfglQ1Do9mBfL2N70a3GMysG9ufy0 u543bRU8Q+xerhl0QLubqtnupkWBP51hSdP6NGnIl1X+ZkNPyDykSBY9poLAPBpDjUaq 0s/iVSYcxsg8yKonlY/PJPY/jry+VmI1lRRiHS3TdiNh6LhgQu6AH1HsJODK3KCF2zbN XVJIkv9q1FDLnxGo0lUOJKAN5HFGYiHMifoR0MiKuttOYdJ8iNLqqbr7jNQUtCT2HPv6 PpvSh6aIPeBUKzLXaKv3qj2zy2CI2ktJbdFRW/aJd/vL4/1EkohKJVopAvgKPxXjiB09 YJRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=zehjsoI4/E9mlHSzS3GihRUsNzlSRlM3AQ/tc2JFGWU=; b=NhMiNxHgwCLCNQ9zdOy+Y5Lbcl33t94MnKi3ojEgyTwCVmGJZtUYs6g/YYXx5Wnwlw wxd72AJOTwYnbjrVS+/XjYiT7HxuDDKFRWwRNzmLEmw19HL+OFbeV6mHwmRL5N0nx16D 4JaE01ZZrh2sA+P5ZoEfNXyuHWddHgtc+ce5F2CPm0DbK5dN+ZL5A9dh/wEai4JFSps/ ansKpRzhZK7GGh1yom0NsZjGVDFAPpK1/iQpPzGijcQrbHfbRKgeJgDg7ij4JDKMZ/by CgVV1R6eFihkG/ERFGF1XlQ/V8aJ1esC7tC4Mc/BHol34dxbckt9XiYaJhZgOZHIW6nm HqZQ== X-Gm-Message-State: AOAM532oNdv9PD6Shyx4enprr3lTXEckBMgZM5VmUPVIfAFcvf1lwy/5 xBnG93YtBZDAjm5mybdQ8EmZ5f2/nqTdH4N+8ZSEyQ== X-Google-Smtp-Source: ABdhPJwFhikEezi6cK75+Nh1jGpDUQvWygSxV/rVzK4JtvxTrHv+oYrN72yFW4FSMWmsrMzt7Jt48+wkeRxq1/Q08TY= X-Received: by 2002:a19:e308:: with SMTP id a8mr30300lfh.573.1604027290187; Thu, 29 Oct 2020 20:08:10 -0700 (PDT) MIME-Version: 1.0 References: <20201027200358.557003-1-mic@digikod.net> <20201027200358.557003-9-mic@digikod.net> In-Reply-To: From: Jann Horn Date: Fri, 30 Oct 2020 04:07:44 +0100 Message-ID: Subject: Re: [PATCH v22 08/12] landlock: Add syscall implementations To: =?UTF-8?B?TWlja2HDq2wgU2FsYcO8bg==?= , 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?B?TWlja2HDq2wgU2FsYcO8bg==?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-arch@vger.kernel.org On Thu, Oct 29, 2020 at 12:30 PM Micka=C3=ABl Sala=C3=BCn = wrote: > On 29/10/2020 02:06, Jann Horn wrote: > > On Tue, Oct 27, 2020 at 9:04 PM Micka=C3=ABl Sala=C3=BCn 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 =3D 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_AD= MIN)? > > 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?