Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp298095pxx; Thu, 29 Oct 2020 02:58:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIfKVpHHVYzZ9J2W1EGgv8hif+vgE45AvNilHxBQbwFLeKJ3FS9CGd0N0NQd4NIHiS3b9K X-Received: by 2002:a50:f190:: with SMTP id x16mr1875131edl.292.1603965521247; Thu, 29 Oct 2020 02:58:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603965521; cv=none; d=google.com; s=arc-20160816; b=ROqp2ht9coWbdZp5ieqdbtVoGTMpkCyJt6wTr4MralRgTWVCi/ZjIxUp/DwdwMqAtt gw3NJ3fAY/KuDKDuOF7hQR+zdZks9fCNBMmGU8UUNXJv9CzVV7q15AtCC2i/Xz2R1ylL 1+0y+WSfM4hE7jK0ls+1lDrO0yuTUeMrhUk2WkyHayQlAI0Mg3ZQ9SkFSzLQ4TOz+n80 NL+325V1RSDfKy+wuisfZTFZeqd1J1yBVz3WSwjyvowYC78PCXRCV4L5gb/teSerReqt 0Gs2Su3rqflWCbETx2e8tFE6YTup/6ew0QQzGVNHwaouZisOhfdh+napAV/fFlxfuOYu IGRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=XH5fEY967sQGo5TmBvXohkmKAaL8RC4qbRi4BtBMuM0=; b=k5wmN0Sdemje2fgR4Zji7bVpssysrYW4YvNxLlJq2CuYnyUxZ5lXeZxdyqvtfdSK2e qCPiuCxoP8/Bga4jnKQr1IdtMBGO3kwbdyH2Wt8RVNVlZtCY2sjjvBgzTHBdC+2pYPbs dweq174mIW7ohXPJ+hXfU/hNF/oHuMfJ8ZBVHwlcJHcnYLju2uUu+8KVTjI6yJG869G/ U8VZLPZDAWATSrl42vLe5FLs2AXxjS1L8XajrObqzRh3tz1WhZxV+R51a6wtOG200o9l KP0pxKFxW+5GinF5OOpiFoyRlmTMYbVzciw0IM6P7nWBFKPTLpFXNcCJCBe23BGtucX5 ZOkA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id os25si1412206ejb.454.2020.10.29.02.58.18; Thu, 29 Oct 2020 02:58:41 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388389AbgJ1Wdd (ORCPT + 99 others); Wed, 28 Oct 2020 18:33:33 -0400 Received: from mail-oi1-f193.google.com ([209.85.167.193]:41581 "EHLO mail-oi1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388260AbgJ1Wda (ORCPT ); Wed, 28 Oct 2020 18:33:30 -0400 Received: by mail-oi1-f193.google.com with SMTP id k65so1237262oih.8; Wed, 28 Oct 2020 15:33:28 -0700 (PDT) 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=XH5fEY967sQGo5TmBvXohkmKAaL8RC4qbRi4BtBMuM0=; b=LFLWGtAalQM8ZAFtIS2H9evoE4p22g+VRre2VsOgh4lpHLAVSh+Mz7FHQCor9m4Oq8 W2gIm927eKmkIpac/QhFto9gQ6A4s4vvPrPN+qI+AETyPDodE1aCQ9PHFkvIT71FTh7z q2D+Ra98NX1MasE4A7vFM/gXqhStMO2Xqe7S8cHDNO17FImuG/6mPaAlseGwPAAuC9iL QpC/5Hty77XP/Dpl9rzU1rmGc9Xr3WORS+zQik4Wd7KwIT9rxzQl7SyYXasBZ7UDYK9F 6/+MQ5MNEKNtU4YfFxE1f/5SapzQOb2oWaESEkORzvBz9p7DM7rMpNJGqnNFF4tnyVxr Mesg== X-Gm-Message-State: AOAM530Rr7N60bY/ErJbGnkjMOxCWkrGIUbufo7jra9yHeA6Gwc4pj6p 6bW7ugeUv21cvAH/ywk+GTIgWnHettay0igHZL1TjW2mVXV/fg== X-Received: by 2002:aca:f40c:: with SMTP id s12mr4164246oih.153.1603873143175; Wed, 28 Oct 2020 01:19:03 -0700 (PDT) MIME-Version: 1.0 References: <9ede6ef35c847e58d61e476c6a39540520066613.1600951211.git.yifeifz2@illinois.edu> <202010271653.B6D7D6B@keescook> In-Reply-To: <202010271653.B6D7D6B@keescook> From: Geert Uytterhoeven Date: Wed, 28 Oct 2020 09:18:51 +0100 Message-ID: Subject: Re: [PATCH v2 seccomp 1/6] seccomp: Move config option SECCOMP to arch/Kconfig To: Kees Cook Cc: YiFei Zhu , containers@lists.linux-foundation.org, YiFei Zhu , bpf , Linux Kernel Mailing List , Aleksa Sarai , Andrea Arcangeli , Andy Lutomirski , Dimitrios Skarlatos , Giuseppe Scrivano , Hubertus Franke , Jack Chen , Jann Horn , Josep Torrellas , 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 Hi Kees, On Wed, Oct 28, 2020 at 1:06 AM Kees Cook wrote: > On Tue, Oct 27, 2020 at 10:52:39AM +0100, Geert Uytterhoeven wrote: > > On Thu, Sep 24, 2020 at 2:48 PM YiFei Zhu wrote: > > > From: YiFei Zhu > > > > > > In order to make adding configurable features into seccomp > > > easier, it's better to have the options at one single location, > > > considering easpecially that the bulk of seccomp code is > > > arch-independent. An quick look also show that many SECCOMP > > > descriptions are outdated; they talk about /proc rather than > > > prctl. > > > > > > As a result of moving the config option and keeping it default > > > on, architectures arm, arm64, csky, riscv, sh, and xtensa > > > did not have SECCOMP on by default prior to this and SECCOMP will > > > be default in this change. > > > > > > Architectures microblaze, mips, powerpc, s390, sh, and sparc > > > have an outdated depend on PROC_FS and this dependency is removed > > > in this change. > > > > > > Suggested-by: Jann Horn > > > Link: https://lore.kernel.org/lkml/CAG48ez1YWz9cnp08UZgeieYRhHdqh-ch7aNwc4JRBnGyrmgfMg@mail.gmail.com/ > > > Signed-off-by: YiFei Zhu > > > > Thanks for your patch. which is now commit 282a181b1a0d66de ("seccomp: > > Move config option SECCOMP to arch/Kconfig") in v5.10-rc1. > > > > > --- a/arch/Kconfig > > > +++ b/arch/Kconfig > > > @@ -458,6 +462,23 @@ config HAVE_ARCH_SECCOMP_FILTER > > > results in the system call being skipped immediately. > > > - seccomp syscall wired up > > > > > > +config SECCOMP > > > + def_bool y > > > + depends on HAVE_ARCH_SECCOMP > > > + prompt "Enable seccomp to safely compute untrusted bytecode" > > > + help > > > + This kernel feature is useful for number crunching applications > > > + that may need to compute untrusted bytecode during their > > > + execution. By using pipes or other transports made available to > > > + the process as file descriptors supporting the read/write > > > + syscalls, it's possible to isolate those applications in > > > + their own address space using seccomp. Once seccomp is > > > + enabled via prctl(PR_SET_SECCOMP), it cannot be disabled > > > + and the task is only allowed to execute a few safe syscalls > > > + defined by each seccomp mode. > > > + > > > + If unsure, say Y. Only embedded should say N here. > > > + > > > > Please tell me why SECCOMP is special, and deserves to default to be > > enabled. Is it really that critical, given only 13.5 (half of sparc > > ;-) out of 24 > > architectures implement support for it? > > That's an excellent point; I missed this in my review as I saw several > Kconfig already marked "def_bool y" but failed to note it wasn't _all_ > of them. Okay, checking before this patch, these had them effectively > enabled: > > via Kconfig: > > parisc > s390 > um > x86 Mostly "server" and "desktop" platforms. > via defconfig, roughly speaking: > > arm > arm64 > sh Note that these defconfigs are example configs, not meant for production. E.g. arm/multi_v7_defconfig and arm64/defconfig enable about everything for compile coverage. > How about making the default depend on HAVE_ARCH_SECCOMP_FILTER? > > These have SECCOMP_FILTER support: > > arch/arm/Kconfig: select HAVE_ARCH_SECCOMP_FILTER if AEABI && !OABI_COMPAT > arch/arm64/Kconfig: select HAVE_ARCH_SECCOMP_FILTER > arch/csky/Kconfig: select HAVE_ARCH_SECCOMP_FILTER > arch/mips/Kconfig: select HAVE_ARCH_SECCOMP_FILTER > arch/parisc/Kconfig: select HAVE_ARCH_SECCOMP_FILTER > arch/powerpc/Kconfig: select HAVE_ARCH_SECCOMP_FILTER > arch/riscv/Kconfig: select HAVE_ARCH_SECCOMP_FILTER > arch/s390/Kconfig: select HAVE_ARCH_SECCOMP_FILTER > arch/sh/Kconfig: select HAVE_ARCH_SECCOMP_FILTER > arch/um/Kconfig: select HAVE_ARCH_SECCOMP_FILTER > arch/x86/Kconfig: select HAVE_ARCH_SECCOMP_FILTER > arch/xtensa/Kconfig: select HAVE_ARCH_SECCOMP_FILTER > > So the "new" promotions would be: > > csky > mips > powerpc > riscv > xtensa > > Which would leave only these two: > > arch/microblaze/Kconfig: select HAVE_ARCH_SECCOMP > arch/sparc/Kconfig: select HAVE_ARCH_SECCOMP if SPARC64 > > At this point, given the ubiquity of seccomp usage (e.g. systemd), I > guess it's not unreasonable to make it def_bool y? Having support does not necessarily imply you want it enabled. If systemd needs it (does it? I have Debian nfsroots with systemd, without SECCOMP), you can enable it in the defconfig. "Default y" is for things you cannot do without, unless you know better. Bloat-o-meter says enabling SECCOMP consumes only ca. 8 KiB (on arm32), so perhaps "default y if !EXPERT"? Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds