Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp224267rdb; Fri, 6 Oct 2023 01:12:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG4aNPzgRrve1ObEL6Uwr7walnpKSY7C61Vj6sBD2aIa7DKGZwiJH9d6qEZckqHl8y6MIBc X-Received: by 2002:a25:4f82:0:b0:d8b:737f:823b with SMTP id d124-20020a254f82000000b00d8b737f823bmr6500137ybb.0.1696579975229; Fri, 06 Oct 2023 01:12:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696579975; cv=none; d=google.com; s=arc-20160816; b=VsXyjetpCE7+RLFHIYwgL9/kONdn/I0jO4SioI3kw9wjZlU63xx8YUlVFV2FmNAsEw +B978LKPxa+wtcB7skWnM+mDsgNqH+0jv1FJnzJfN20yKt40irXEKM0iXGN9vPN3gU+S Lc3UVRUsfG6l6H+4X7fS9hkJNnDCPmIOoBgzoz0VrkX6m7w5TRd3YLCpknjYl3bVp86Z th3u7SAAzOp8y9wN5hlA5+Y2h4BoA5vGr8IcNJJ1Jf4UbNbO+By0tS/gXBVilMBstrDF tHSy1LEtOA2VI7RzQ0UkfYSB1emLsS5v52AOPr8J0D1lqeW5iJG2FuKXYOlqBjiMXGil RyFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=3hyLdf50+C5Lil6duzGMlwDMWfIf9auOEScFOtrq4MU=; fh=nlB961t7fer+nyCHT85h8ovOHeOIoZYOnCRVI4D7GMU=; b=qJi5Se9zqAE/8dBjl5nXr0QyiJNLUmpx3Zvx1pcN2W8ApHMJgTIQKC+rvRGiqO71Zf Sv5xmwhsHvYyH/isL54o51WPMKS3/HCiyD3kCieqdrdI4oPrZMGopTNpwrNvtgkqgKnQ XpkVAWaETR3ZhxNW7F0ecqApjNoaRWZLVhRNzi/PloQc0loP6oAnYH4aBq39W6gobJdh LYZ4YK7sOn1pqze/gb9zwF9VVr5N9G1FDhqOgRIp9RsHxJW3FLrcusqZevHCoQhD7V9S D8max3EfpbVGFB0vIj8QgDMV/Z0Uth0sWs6hRV2hCZMThrS05iuTILk2CQbvckDco9r2 q3+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=CxP59uTM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id c71-20020a63354a000000b005898b54186esi1101669pga.96.2023.10.06.01.12.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 01:12:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=CxP59uTM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 03754818B833; Fri, 6 Oct 2023 01:12:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230445AbjJFIMn (ORCPT + 99 others); Fri, 6 Oct 2023 04:12:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230344AbjJFIMm (ORCPT ); Fri, 6 Oct 2023 04:12:42 -0400 Received: from mail-ot1-x32e.google.com (mail-ot1-x32e.google.com [IPv6:2607:f8b0:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93A30CA; Fri, 6 Oct 2023 01:12:41 -0700 (PDT) Received: by mail-ot1-x32e.google.com with SMTP id 46e09a7af769-6c4d625da40so1285594a34.1; Fri, 06 Oct 2023 01:12:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696579961; x=1697184761; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=3hyLdf50+C5Lil6duzGMlwDMWfIf9auOEScFOtrq4MU=; b=CxP59uTMOQzOHOhZBoR0wNDYy3ozLtGZg9EJ5TjLVDB0nGu16g2LB9vz34z82/CY4V CkjYgATyMNRljtcfGVQHvRgMmrQ8W8UN+pjWJi4hEhuff2xRRA2iOa5IXQoIriAxaew4 GNDU0NaD7v05ID5eL0dEMk4qypcd912fo1as9EVe4UhovM/HYgmwpKGahIbu5k2A1YK3 Y49ztYDCBH3Wi+orcndwJTHw3rFylxn7/qcxFBgoQVHSyFHN14ztpDDtEF+ecIHZFUNY nrcOipD/YIK5QNZ1YHoNgy/AIP1BIKs8WEOWgdQR+x59PKWZZjKR2+9tKnQBVlBYiDnd PyMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696579961; x=1697184761; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3hyLdf50+C5Lil6duzGMlwDMWfIf9auOEScFOtrq4MU=; b=r3XeDn5peDp+/7CcxClFY2ahjBg7tfN8YgbURYln1F6aCC/035TwPLbT5Y3dQkvwRU jMRrbhI+utrTi2e/ylETzSkU1yEl6f0hkDkyftIfM2Tv2DqsF0/7Ldn5XXx7US7CRVdm tYMRCBwal2HBps2icGgX77l0UFY7YHQ9sT2UWPcoFXeYKHz4txibPkHnNmHYIkvgCX8N bsWc9xN89wNyYp2sGIIWPm7AHDWBuVdgMTYknFwtvmq+7ETT4jda42TAO6h/Qw0xclVO k3fP05ckGu8GBXUrg1IBQVVzZxxRm8FN2bs2Owz4DPRPDg9yX7/yo3BvftX7HKGEnsSN lc4w== X-Gm-Message-State: AOJu0YyGLU8FF0J/xLtVTC46vw0Fqe+GRJYR2loHULOrjtGaQcJb2SSl /l8Y2mehaYwXLpIyabkbjnrULvgH7Z/7QjNA0zw= X-Received: by 2002:a05:6870:9712:b0:1db:71b9:419c with SMTP id n18-20020a056870971200b001db71b9419cmr8459956oaq.58.1696579960814; Fri, 06 Oct 2023 01:12:40 -0700 (PDT) MIME-Version: 1.0 References: <20231003083836.100706-1-hengqi.chen@gmail.com> <14c52402-ebc8-4425-9871-1663a87182ef@sdfg.com.ar> In-Reply-To: <14c52402-ebc8-4425-9871-1663a87182ef@sdfg.com.ar> From: Hengqi Chen Date: Fri, 6 Oct 2023 16:12:29 +0800 Message-ID: Subject: Re: [RFC PATCH 0/2] seccomp: Split set filter into two steps To: Rodrigo Campos Cc: linux-kernel@vger.kernel.org, bpf@vger.kernel.org, keescook@chromium.org, luto@amacapital.net, wad@chromium.org, alexyonghe@tencent.com, Alban Crequy Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.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 (agentk.vger.email [0.0.0.0]); Fri, 06 Oct 2023 01:12:53 -0700 (PDT) On Wed, Oct 4, 2023 at 10:03=E2=80=AFPM Rodrigo Campos wrote: > > On 10/3/23 10:38, Hengqi Chen wrote: > > This patchset introduces two new operations which essentially > > splits the SECCOMP_SET_MODE_FILTER process into two steps: > > SECCOMP_LOAD_FILTER and SECCOMP_ATTACH_FILTER. > > > > The SECCOMP_LOAD_FILTER loads the filter and returns a fd > > which can be pinned to bpffs. This extends the lifetime of the > > filter and thus can be reused by different processes. > > A quick question to see if handling something else too is > possible/reasonable to do here too. > > Let me explain our use case first. > > For us (Alban in cc) it would be great if we can extend the lifetime of > the fd returned, so the process managing a seccomp notification in > userspace can easly crash or be updated. Today, if the agent that got > the fd crashes, all the "notify-syscalls" return ENOSYS in the target > process. > > Our use case is we created a seccomp agent to use in Kubernetes > (github.com/kinvolk/seccompagent) and we need to handle either the agent > crashing or upgrading it. We were thinking tricks to have another > container that just stores fds and make sure that never crashes, but it > is not ideal (we checked tricks to use systemd to store our fds, but it > is not simpler either to use from containers). > > If the agent crashes today, all the syscalls return ENOSYS. It will be > great if we can make the process doing the syscall just wait until a new > process to handle the notifications is up and the syscalls done in the > meantime are just queued. A mode of saying "if the agent crashes, just > queue notifications, one agent to pick them up will come back soon" (we > can of course limit reasonably the notification queue). > > It seems the split here would not just work for that use case. I think > we would need to pin the attachment. > > Do you think handling that is something reasonable to do in this series t= oo? > I am not familiar with this notification mechanism, but it seems unrelated. This patchset is trying to reuse the seccomp filter itself. > I'll be afk until end next week. I'll catch up as soon as I'm back with > internet :) > > > > Best, > Rodrigo -- Hengqi