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=-14.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,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 775C6C433DF for ; Mon, 12 Oct 2020 06:51:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 19FFB206FB for ; Mon, 12 Oct 2020 06:51:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="O+439ox2" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726560AbgJLGu3 (ORCPT ); Mon, 12 Oct 2020 02:50:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726123AbgJLGuY (ORCPT ); Mon, 12 Oct 2020 02:50:24 -0400 Received: from mail-ej1-x641.google.com (mail-ej1-x641.google.com [IPv6:2a00:1450:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E6A8C0613CE for ; Sun, 11 Oct 2020 23:50:24 -0700 (PDT) Received: by mail-ej1-x641.google.com with SMTP id qp15so21648780ejb.3 for ; Sun, 11 Oct 2020 23:50:23 -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; bh=vioP1tNDAwc//TCk7A/UlbXm8YsyMW81aBUSwcUWM5M=; b=O+439ox2/Jk704Wg3CCUuHHBA7dCtS4tZf+rbJq812ZTK0+aViDD/HY0/QxPd0NQUF ngHa2P6lniSz1x39IKz9kkJx3LLfC44s2/JJskJsdLcsascUYtB8fvFbW2NUKmgYpA5Q qL9WLDhxkbA2zZxRNrznWAIqkL2ei6gdtH+l382VbGUXGyDlZfX1JuQlmj8y4p6Pv7Ya PCb7RLzFG3YZKtxf36SIr0kXRSp+EPs53UzJcQpDQjjPS1FfrR29JMJjOQ8qQg6Vn8KF 8bEv0NFsREh+8yHvWjRy47WCNFi88C5LcrjZPuN4J2StRjzSrBdFLJaQj2bNrzV9tws4 /EJA== 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; bh=vioP1tNDAwc//TCk7A/UlbXm8YsyMW81aBUSwcUWM5M=; b=Fh1QaXn+C+n8AvFawJ6OjIgkc7gqO3lZIrXxdedWBdHPUA9uTFUZmFi9386f6DuhsC 4RGC2Jtz5eghrVYUjT6No1cLUJE3BacGeIEg6ySm4eEwmdXOqeRfy/az49aMmipURbsg Y6HxVqpA3Xwd10c1OE2C7rAKEG3A9Q8Ho8Lwhh2RDcOXAzlYpBm2dd/kTQ7prDUuo6YZ xFHj/Ki4gw5gXuJQEAqjxcWvROjS3A9PVAJYtjDdd6KZUSkl3BE/bl7QehKPk+ZM+63H SwafW3baEHDRaYdRyuph3siFTkgAUaqB/6k/kSRUtRSJL0+U+YS51ZgNachmsK/IFrwi JEsQ== X-Gm-Message-State: AOAM530ByntwrVJRHJwMujE/UyhaJ5TphxM2N6xi91ypYrhH4I/iSTwW VSW2L2VtHT0cbK9OtuHDSm3TUdsN2SK8f/K7jF5euQ== X-Google-Smtp-Source: ABdhPJzYaWjiwBqQdkgZXF5RmmS6lKqELWb+eu4uskyaPAI9Y5OYW6sBjC5cuQA2JEIpD6mhLt5FrKCkzBDIlZmzlPM= X-Received: by 2002:a17:906:c0d1:: with SMTP id bn17mr15283227ejb.114.1602485422519; Sun, 11 Oct 2020 23:50:22 -0700 (PDT) MIME-Version: 1.0 References: <4706b0ff81f28b498c9012fd3517fe88319e7c42.1602431034.git.yifeifz2@illinois.edu> In-Reply-To: <4706b0ff81f28b498c9012fd3517fe88319e7c42.1602431034.git.yifeifz2@illinois.edu> From: Jann Horn Date: Mon, 12 Oct 2020 08:49:56 +0200 Message-ID: Subject: Re: [PATCH v5 seccomp 5/5] seccomp/cache: Report cache data through /proc/pid/seccomp_cache To: YiFei Zhu Cc: Linux Containers , YiFei Zhu , bpf , kernel list , Aleksa Sarai , Andrea Arcangeli , Andy Lutomirski , David Laight , Dimitrios Skarlatos , Giuseppe Scrivano , Hubertus Franke , Jack Chen , Josep Torrellas , Kees Cook , Tianyin Xu , Tobin Feldman-Fitzthum , Tycho Andersen , Valentin Rothberg , Will Drewry Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Oct 11, 2020 at 5:48 PM YiFei Zhu wrote: > Currently the kernel does not provide an infrastructure to translate > architecture numbers to a human-readable name. Translating syscall > numbers to syscall names is possible through FTRACE_SYSCALL > infrastructure but it does not provide support for compat syscalls. > > This will create a file for each PID as /proc/pid/seccomp_cache. > The file will be empty when no seccomp filters are loaded, or be > in the format of: > > where ALLOW means the cache is guaranteed to allow the syscall, > and filter means the cache will pass the syscall to the BPF filter. > > For the docker default profile on x86_64 it looks like: > x86_64 0 ALLOW > x86_64 1 ALLOW > x86_64 2 ALLOW > x86_64 3 ALLOW > [...] > x86_64 132 ALLOW > x86_64 133 ALLOW > x86_64 134 FILTER > x86_64 135 FILTER > x86_64 136 FILTER > x86_64 137 ALLOW > x86_64 138 ALLOW > x86_64 139 FILTER > x86_64 140 ALLOW > x86_64 141 ALLOW > [...] > > This file is guarded by CONFIG_SECCOMP_CACHE_DEBUG with a default > of N because I think certain users of seccomp might not want the > application to know which syscalls are definitely usable. For > the same reason, it is also guarded by CAP_SYS_ADMIN. > > Suggested-by: Jann Horn > Link: https://lore.kernel.org/lkml/CAG48ez3Ofqp4crXGksLmZY6=fGrF_tWyUCg7PBkAetvbbOPeOA@mail.gmail.com/ > Signed-off-by: YiFei Zhu Reviewed-by: Jann Horn