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.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 7E836C4727D for ; Thu, 24 Sep 2020 12:44:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4E7B621D24 for ; Thu, 24 Sep 2020 12:44:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727753AbgIXMoF (ORCPT ); Thu, 24 Sep 2020 08:44:05 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([207.82.80.151]:50048 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727738AbgIXMoF (ORCPT ); Thu, 24 Sep 2020 08:44:05 -0400 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-42-w-QZRmrqOgiSZ0QwhDWzxw-1; Thu, 24 Sep 2020 13:37:43 +0100 X-MC-Unique: w-QZRmrqOgiSZ0QwhDWzxw-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Thu, 24 Sep 2020 13:37:42 +0100 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Thu, 24 Sep 2020 13:37:42 +0100 From: David Laight To: 'Jann Horn' , Kees Cook CC: YiFei Zhu , Christian Brauner , Tycho Andersen , "Andy Lutomirski" , Will Drewry , "Andrea Arcangeli" , Giuseppe Scrivano , Tobin Feldman-Fitzthum , Dimitrios Skarlatos , Valentin Rothberg , "Hubertus Franke" , Jack Chen , "Josep Torrellas" , Tianyin Xu , bpf , Linux Containers , Linux API , kernel list Subject: RE: [PATCH 3/6] seccomp: Implement constant action bitmaps Thread-Topic: [PATCH 3/6] seccomp: Implement constant action bitmaps Thread-Index: AQHWkm52E4NdUTUYRkuK8ZQr+ESnnKl3uRCg Date: Thu, 24 Sep 2020 12:37:42 +0000 Message-ID: References: <20200923232923.3142503-1-keescook@chromium.org> <20200923232923.3142503-4-keescook@chromium.org> <202009240018.A4D8274F@keescook> In-Reply-To: Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org RnJvbTogSmFubiBIb3JuDQo+IFNlbnQ6IDI0IFNlcHRlbWJlciAyMDIwIDEzOjI5DQouLi4NCj4g SSB0aGluayBvdXIgZ29hbCBoZXJlIHNob3VsZCBiZSB0aGF0IGlmIGEgc3lzY2FsbCBpcyBhbHdh eXMgYWxsb3dlZCwNCj4gc2VjY29tcCBzaG91bGQgZXhlY3V0ZSB0aGUgc21hbGxlc3QgYW1vdW50 IG9mIGluc3RydWN0aW9ucyB3ZSBjYW4gZ2V0DQo+IGF3YXkgd2l0aCwgYW5kIHRvdWNoIHRoZSBz bWFsbGVzdCBhbW91bnQgb2YgbWVtb3J5IHBvc3NpYmxlIChhbmQNCj4gcHJlZmVyYWJseSB0aGF0 IG1lbW9yeSBzaG91bGQgYmUgc2hhcmVkIGJldHdlZW4gdGhyZWFkcykuIFRoZSBiaXRtYXANCj4g ZmFzdHBhdGggc2hvdWxkIHByb2JhYmx5IGFsc28gYXZvaWQgcG9wdWxhdGVfc2VjY29tcF9kYXRh KCkuDQoNCklmIG1vc3Qgc3lzY2FsbHMgYXJlIGV4cGVjdGVkIHRvIGJlIGFsbG93ZWQgdGhlbiBh biBpbml0aWFsOg0KCWlmIChnbG9iYWxfbWFzayAmICgxdSA8PCAoc3lzY2FsbF9udW1iZXIgJiA2 MykpDQp0ZXN0IGNhbiBiZSB1c2VkIHRvIHNraXAgYW55IGZ1cnRoZXIgbG9va3Vwcy4NCg0KQWx0 aG91Z2ggSVNUUiBzb21lb25lIHN1Z2dlc3RpbmcgdGhhdCB0aGUgZ2xvYmFsX21hc2sgc2hvdWxk DQpiZSBwZXItY3B1IGJlY2F1c2UgZXZlbiBzaGFyZWQgcmVhZC1vbmx5IGNhY2hlIGxpbmVzIHdl cmUNCmV4cGVuc2l2ZSBvbiBzb21lIGFyY2hpdGVjdHVyZS4NCg0KCURhdmlkDQoNCi0NClJlZ2lz dGVyZWQgQWRkcmVzcyBMYWtlc2lkZSwgQnJhbWxleSBSb2FkLCBNb3VudCBGYXJtLCBNaWx0b24g S2V5bmVzLCBNSzEgMVBULCBVSw0KUmVnaXN0cmF0aW9uIE5vOiAxMzk3Mzg2IChXYWxlcykNCg== 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.8 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 3A3F0C2D0E2 for ; Thu, 24 Sep 2020 12:37:54 +0000 (UTC) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C17CB21D24 for ; Thu, 24 Sep 2020 12:37:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C17CB21D24 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=ACULAB.COM Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=containers-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 4949D86C07; Thu, 24 Sep 2020 12:37:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dpB5G1pPF2su; Thu, 24 Sep 2020 12:37:52 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id EF17786BFA; Thu, 24 Sep 2020 12:37:51 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id E04A2C0890; Thu, 24 Sep 2020 12:37:51 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 287C8C0859 for ; Thu, 24 Sep 2020 12:37:50 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 1680587494 for ; Thu, 24 Sep 2020 12:37:50 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id I2s7kuBe0aNZ for ; Thu, 24 Sep 2020 12:37:49 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [207.82.80.151]) by hemlock.osuosl.org (Postfix) with ESMTPS id 8D3328748D for ; Thu, 24 Sep 2020 12:37:48 +0000 (UTC) Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-42-w-QZRmrqOgiSZ0QwhDWzxw-1; Thu, 24 Sep 2020 13:37:43 +0100 X-MC-Unique: w-QZRmrqOgiSZ0QwhDWzxw-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Thu, 24 Sep 2020 13:37:42 +0100 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Thu, 24 Sep 2020 13:37:42 +0100 From: David Laight To: 'Jann Horn' , Kees Cook Subject: RE: [PATCH 3/6] seccomp: Implement constant action bitmaps Thread-Topic: [PATCH 3/6] seccomp: Implement constant action bitmaps Thread-Index: AQHWkm52E4NdUTUYRkuK8ZQr+ESnnKl3uRCg Date: Thu, 24 Sep 2020 12:37:42 +0000 Message-ID: References: <20200923232923.3142503-1-keescook@chromium.org> <20200923232923.3142503-4-keescook@chromium.org> <202009240018.A4D8274F@keescook> In-Reply-To: Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Cc: Andrea Arcangeli , Giuseppe Scrivano , Will Drewry , bpf , YiFei Zhu , Linux API , Linux Containers , Tobin Feldman-Fitzthum , Hubertus Franke , Andy Lutomirski , Valentin Rothberg , Dimitrios Skarlatos , Jack Chen , Josep Torrellas , Tianyin Xu , kernel list X-BeenThere: containers@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux Containers List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: containers-bounces@lists.linux-foundation.org Sender: "Containers" From: Jann Horn > Sent: 24 September 2020 13:29 ... > I think our goal here should be that if a syscall is always allowed, > seccomp should execute the smallest amount of instructions we can get > away with, and touch the smallest amount of memory possible (and > preferably that memory should be shared between threads). The bitmap > fastpath should probably also avoid populate_seccomp_data(). If most syscalls are expected to be allowed then an initial: if (global_mask & (1u << (syscall_number & 63)) test can be used to skip any further lookups. Although ISTR someone suggesting that the global_mask should be per-cpu because even shared read-only cache lines were expensive on some architecture. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales) _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/containers