Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp214410iob; Mon, 2 May 2022 17:26:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFKAxBlurm1tPyRJiuZI7+xCf+oRt/LTcA6FO8zo7EisjZcadc6c4p402fv/CD2TUAC7LQ X-Received: by 2002:a63:3fcb:0:b0:3aa:36aa:33e8 with SMTP id m194-20020a633fcb000000b003aa36aa33e8mr11577511pga.492.1651537567767; Mon, 02 May 2022 17:26:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651537567; cv=none; d=google.com; s=arc-20160816; b=nsUWc3QVBNk8SHUfVXYmU/oaHXutI8Kd7RsQlg9tNSQ2xBLZL2QvMOYlahBr3d/lgO fnm1qElZaZC0DNkBY//yDhxf8xuI4W43siNqgT8L5UIlNUVFweykPydxGMxs0Q0Z/0nI LDdHxxxmjqmMcxmkqgbwVzGNVvhTh+TWsLbMdwCwyag05tw1WMGjyk9EYl08Oax0TCvx mczLXibhoxhyM0RDnTPMoOKnUtV1nhq0fXsz/TsRlSTy7Cu7Er2CLEolnaLxIfAJhAq/ 14caW5C2xPiqlVG00qHmfe2E/lfePGEBClpx6n8KeHbzXjVOiTfsXxHKvW2ug8q/p3m+ VXDw== 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:dkim-signature; bh=0eFk3CzuDkxDpPniRqtaFxJeQbfsTLgh4mE837V0A8Y=; b=CdhPgpOT2d54JoK/wPsTe//Zr0VsiKKJhcQnAOmKq3+p+ZbBxCZVXaalDbyV3mG25a C1vHhzWpCJnWvmpBefze5wapY75dRj/MmYKKGQwsOWU8y3svJFWuHe+2CeVNiQH6/ibW M9gTmVAt/7Yt93wx3pRxGVKqQ8lUg4d9TGNWleljRHGvbZaBZb2puB1WxLIp0U86jRw0 Unt/bc3bzt0FW6AmFEcu0qIuNMnoVoQwhaUR4GE6SlEubUtebtA0b98PPeGBFtd6RpV+ diIpA+eNSbNPU3jMWRXz1FuD38YAmP2raG3FnSbqIYf5XqWq37G+Td+l+7LuaM/WDKji vPpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kinvolk.io header.s=google header.b=WHez4RIe; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kinvolk.io Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id t184-20020a6381c1000000b00398a2b708c9si14683699pgd.211.2022.05.02.17.26.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 17:26:07 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kinvolk.io header.s=google header.b=WHez4RIe; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kinvolk.io Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E39432B26D; Mon, 2 May 2022 17:21:22 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351960AbiEBMwr (ORCPT + 99 others); Mon, 2 May 2022 08:52:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234201AbiEBMwp (ORCPT ); Mon, 2 May 2022 08:52:45 -0400 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13D3914000 for ; Mon, 2 May 2022 05:49:13 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id x33so25105199lfu.1 for ; Mon, 02 May 2022 05:49:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kinvolk.io; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0eFk3CzuDkxDpPniRqtaFxJeQbfsTLgh4mE837V0A8Y=; b=WHez4RIelBuHg8j+rO7kE5+U3jaMpBScFhklfdh/mMSyiHOkSwCSHua8oJR3fZuilp UNx5A1idSZuI/VD2IFaT07lwhXqGfPKDPNKN2B0Nry9WnVco6BZbwmprz+/IVgODHF6b iyPLFLyJXAtrUPaAVQPsuFk407AwgvJxuTXIQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0eFk3CzuDkxDpPniRqtaFxJeQbfsTLgh4mE837V0A8Y=; b=aCV6lA9xoTtklHa//SrEa3hVB15rLtksqA6FFkSAJdLlxBh1SvQcl/g7g4yeINsAmr Ssy82LEgF7baNiTaU0g0Sb/PvJCumrHejtPgDuUqVa3iByF/F9dw5aUc5kx+qzQgkqi7 /wcZIbsWjadVLPoxSDk9wXSQFRsyKooPKuqmzsDu4YSczF2HS//CTiVQqttFShVJZJLw BBdYb6t/wKU8Y3ChbCdfgQLYHZxU8BEMZVuxr/dhnwaRDdRkOWtfy4x3a40eUKaezlLV +MDHcf/O2XCoZ4ZCxgf2DSD5t69PjVCfFOH7eBpI6csu3f8mzHaSNECq6vYRXpWYAuGu dZ8w== X-Gm-Message-State: AOAM530YvVwXhOTmk51sDbDWTgrOGOa9a57czcH7BtV7rtVJuy1Lyny5 qTuf/HAKsE+UyVkoKnCGxZFtjok02eKovxMoVCnHw+f8IUWMLg== X-Received: by 2002:a05:6512:1398:b0:448:bda0:99f2 with SMTP id p24-20020a056512139800b00448bda099f2mr8600628lfa.681.1651495751352; Mon, 02 May 2022 05:49:11 -0700 (PDT) MIME-Version: 1.0 References: <20220429023113.74993-1-sargun@sargun.me> <20220429023113.74993-2-sargun@sargun.me> <20220429171437.GA1267404@ircssh-3.c.rugged-nimbus-611.internal> <202204291120.428EB85@keescook> In-Reply-To: <202204291120.428EB85@keescook> From: Rodrigo Campos Date: Mon, 2 May 2022 14:48:35 +0200 Message-ID: Subject: Re: [PATCH v3 1/2] seccomp: Add wait_killable semantic to seccomp user notifier To: Kees Cook Cc: Sargun Dhillon , LKML , Linux Containers , Christian Brauner , Giuseppe Scrivano , Will Drewry , Andy Lutomirski , Alban Crequy Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 29, 2022 at 8:20 PM Kees Cook wrote: > On Fri, Apr 29, 2022 at 05:14:37PM +0000, Sargun Dhillon wrote: > > On Fri, Apr 29, 2022 at 11:42:15AM +0200, Rodrigo Campos wrote: > > > On Fri, Apr 29, 2022 at 4:32 AM Sargun Dhillon wrote: > > > > the concept is searchable. If the notifying process is signaled prior > > > > to the notification being received by the userspace agent, it will > > > > be handled as normal. > > > > > > Why is that? Why not always handle in the same way (if wait killable > > > is set, wait like that) > > > > > > > The goal is to avoid two things: > > 1. Unncessary work - Often times, we see workloads that implement techniques > > like hedging (Also known as request racing[1]). In fact, RFC3484 > > (destination address selection) gets implemented where the DNS library > > will connect to many backend addresses and whichever one comes back first > > "wins". > > 2. Side effects - We don't want a situation where a syscall is in progress > > that is non-trivial to rollback (mount), and from user space's perspective > > this syscall never completed. > > > > Blocking before the syscall even starts is excessive. When we looked at this > > we found that with runtimes like Golang, they can get into a bad situation > > if they have many (1000s) of threads that are in the middle of a syscall > > because all of them need to elide prior to GC. In this case the runtime > > prioritizes the liveness of GC vs. the syscalls. > > > > That being said, there may be some syscalls in a filter that need the suggested > > behaviour. I can imagine introducing a new flag > > (say SECCOMP_FILTER_FLAG_WAIT_KILLABLE) that applies to all states. > > Alternatively, in one implementation, I put the behaviour in the data > > field of the return from the BPF filter. Makes sense, if we need to, we can implement that in the future too. > I'd add something like the above to the commit log, just to have it > around. Yes, please. It was not obvious to me.