Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp496530rdg; Tue, 10 Oct 2023 17:32:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFoWxt97KVxC7WFPt+b4oA+qdTG0l46bg2UyaKBBqoKAtIgZJ9E8Su6wlSGfIL6ozMsHcyd X-Received: by 2002:a05:6a00:1a0d:b0:68f:bbc3:df44 with SMTP id g13-20020a056a001a0d00b0068fbbc3df44mr22960842pfv.0.1696984322845; Tue, 10 Oct 2023 17:32:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696984322; cv=none; d=google.com; s=arc-20160816; b=TlcPCQgwcWvAoCRmRjnVFMr5PfGTrr3KSL9qNyJCp9SyLDgjl8Rhif7BXFxQTlw/3y 6tLA9vgMsvEqMf8Le95Roz4loiPMYUewCaocJUAwH5qds0wHxQO9RXcvZUwUcV/9WBz3 yRMSpil1I6uX45bvuElZvkKHkGG+Zka91k28AFWWy8SmTEiqB5SHPvWVH/dvNEYSN5lx 0MtNRWmVZPSJ6xO3SnKaVwgtKhgcRwaaBG1izh883dev3i5M2UqamIEV7fO8vIBqSWGB hlrKE+odSUFqphE/95FMDsV8eGqjUftY5DawxzoCwwWwpmNqreLU0K8YQGQUiHnUmxNL oSEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=AkMbt4JFmtSlUfUc5YRj1RfdWAlOvg8CzC6z2aU7wME=; fh=OP+7TAWqZCSpoz/llh4+/bsJ1XsL3oLSKO8+dmCeG84=; b=BgV3iQiB7bVD4aXqYaf/yw/CI1L95CLvS1JmJDM/oRjIxP3Ovl1WmVQS5sBI2L0fFR +mCpALnLqeNb1hBJ9DwyPvhHSnCsRZ3WSmV8TBCYEzNrc15qtUDMyQ6w6o5WCL3Etaq2 NQXC57WBRAcLstlsZ3zJ6VJXBoO8roD2TVPGhGPolOuhf6Ln7p092kQXojNH0VFfKBx/ Ftrp1wjuoxI2VrCYIK6RClaLvwC8NNLWTHLDuFACMCWk/CmiaWFVcuf9eFUQDrn0CAhu D10pIkx46Y7b6cvwHCI786JA6HbLi6uWB8/BxKtTSCBKXz/+FhR4oJA2S4+4Zl4qXiqm RegQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="H/WmXYc5"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id p4-20020a635b04000000b0056546b5fef4si12461050pgb.232.2023.10.10.17.32.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 17:32:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="H/WmXYc5"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 6893180C9DEB; Tue, 10 Oct 2023 17:32:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344807AbjJKAbw (ORCPT + 99 others); Tue, 10 Oct 2023 20:31:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344766AbjJKAbm (ORCPT ); Tue, 10 Oct 2023 20:31:42 -0400 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DA80199 for ; Tue, 10 Oct 2023 17:24:51 -0700 (PDT) Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-5859b1c92a0so4699976a12.2 for ; Tue, 10 Oct 2023 17:24:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696983890; x=1697588690; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=AkMbt4JFmtSlUfUc5YRj1RfdWAlOvg8CzC6z2aU7wME=; b=H/WmXYc5wLeD6GCUU5yH5W0liVCMjCEkZ519SinlMcVsVwMF3XJdd+P+166jtLXXod BRXJ+wo29duSV+FqDpb5WqrkgSUnUfLNsNEeHzUFNnGU+kxcNxBZwsd39GgggJoSNaTH KnyXNf89RhBLOB1oCPQzs0xXRnfrnwpKdnfN0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696983890; x=1697588690; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=AkMbt4JFmtSlUfUc5YRj1RfdWAlOvg8CzC6z2aU7wME=; b=xCgrCwG75hekD5M4EP8FtzkA7pFjgRJ1AMlQEk0i4ArwInw3WR2fiylcECQjBvoiMm MT4Hf663Ys/9nrLlQVuFAQf55kISYK59KFogGsKBDcfNVJTry9IIfcp1VYIT/PbLaWzh jlEkXmyCY9PjCANQUXtEnrnIPXB4SN7Ej1TOCu1Cc3Es+xl1bTHz8+KCXv11IdhyhUiD 0kOQGvXdQ39+WHeMbP/Ym4wAlIs/gK/dUFKrwKfWsCt1VZGatSEokY/oq51y1W/0GCIg RhBLJBt2ilmDOIUnb7vvHJjfkV5cE1C8ucSw0/qvQ+OcAVDF4LzGTz/cOLix7CwwC96D Icow== X-Gm-Message-State: AOJu0YwWpsWcncCtrmFzp7bZxoaNwtBnHtA2udr0L9wNJr/Mrt/N/fjV qCVEti/F/M4UkXvSvRIr1YWntQ== X-Received: by 2002:a17:902:ce8e:b0:1c8:8d9a:48a with SMTP id f14-20020a170902ce8e00b001c88d9a048amr17314965plg.66.1696983890661; Tue, 10 Oct 2023 17:24:50 -0700 (PDT) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id w19-20020a1709029a9300b001c739768214sm12442005plp.92.2023.10.10.17.24.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 17:24:50 -0700 (PDT) Date: Tue, 10 Oct 2023 17:24:47 -0700 From: Kees Cook To: Hengqi Chen Cc: linux-kernel@vger.kernel.org, bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, luto@amacapital.net, wad@chromium.org, alexyonghe@tencent.com Subject: Re: [PATCH 2/4] seccomp, bpf: Introduce SECCOMP_LOAD_FILTER operation Message-ID: <202310101722.B6D6E6CEC@keescook> References: <20231009124046.74710-1-hengqi.chen@gmail.com> <20231009124046.74710-3-hengqi.chen@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231009124046.74710-3-hengqi.chen@gmail.com> X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 10 Oct 2023 17:32:00 -0700 (PDT) X-Spam-Level: ** On Mon, Oct 09, 2023 at 12:40:44PM +0000, Hengqi Chen wrote: > This patch adds a new operation named SECCOMP_LOAD_FILTER. > It accepts the same arguments as SECCOMP_SET_MODE_FILTER > but only performs the loading process. If succeed, return a > new fd associated with the JITed BPF program (the filter). > The filter can then be pinned to bpffs using the returned > fd and reused for different processes. To distinguish the > filter from other BPF progs, BPF_PROG_TYPE_SECCOMP is added. > > Signed-off-by: Hengqi Chen This part looks okay, I think. I need to spend some more time looking at the BPF side. I want to make sure it is only possible to build a BPF_PROG_TYPE_SECCOMP prog by going through seccomp. I want to make sure we can never side-load some kind of unexpected program into seccomp, etc. Since BPF_PROG_TYPE_SECCOMP is part of UAPI, is this controllable through the bpf() syscall? One thought I had, though, is I wonder if flags are needed to be included with the fd? I'll ponder this a bit more... -- Kees Cook