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.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 44FE2C433B4 for ; Sat, 1 May 2021 00:10:08 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (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 B659F61260 for ; Sat, 1 May 2021 00:10:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B659F61260 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sargun.me Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=containers-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 7A39743230; Sat, 1 May 2021 00:10:07 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sOFGIaY7D5dQ; Sat, 1 May 2021 00:10:06 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTP id 78763401DD; Sat, 1 May 2021 00:10:06 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 5C063C000E; Sat, 1 May 2021 00:10:06 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id D4ADFC0001 for ; Sat, 1 May 2021 00:10:04 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id C6F376FA67 for ; Sat, 1 May 2021 00:10:04 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp3.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=sargun.me Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9kEEW4agxARQ for ; Sat, 1 May 2021 00:10:03 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) by smtp3.osuosl.org (Postfix) with ESMTPS id 940A1606BB for ; Sat, 1 May 2021 00:10:03 +0000 (UTC) Received: by mail-io1-xd33.google.com with SMTP id b9so17261574iod.13 for ; Fri, 30 Apr 2021 17:10:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sargun.me; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8nmI0Z6GpJ669OoqTL4ZRS5HBzAE6mZbx+jGtxyj3s4=; b=TAk5su9x4YNFiIahiV9a5aaJzJsZ734/S9ixVX7Bz0n5yF+3hMGaPGzcXNECetsqWg JkHS1ySxd3AQSEDQjy+xEZqIembgrUUi7vL6ea9plM5m16ZqVnUV0HCviU/AnqQAXtPQ WY0OTMD6LH4B6yZmmlK4gYsgcNJM2o8nMR04c= 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=8nmI0Z6GpJ669OoqTL4ZRS5HBzAE6mZbx+jGtxyj3s4=; b=FSLPZ1DijjVElgMDwqhv6QGWQ7cN1wZe0sxRpToSnlJgT55PLqvvWfIsW87oQjJ2qB jBXgbj5rN18WN0wZAKOx3jEpmtBN/OUuRzeL8vkHsCrrY5p8ZE9XAr4ZSFd4oEZLtywT MKyuxAKPk+DCa985sIj13SnkN4n9wPZdeZbzo1sXLTpL95Sm9E3ybo9RDAb7afsr2EUG LBUFEQA652oxf101HhEnXqeEuERcKoBZLb1zE1hvcO9NQYlbIe5JztiOYKFNpzCP6M4O Ebx+zBCQ6fxpg9WMssjqC5ajQ9EVgU1uBj9zfACJHJrQgFdaP2QEzTCJmEXaDmCAR5QO ugqw== X-Gm-Message-State: AOAM531OYLvmNQiJzmVK6NngSPpI6t8YVj4lWOYBDpqLnBoB5JV/xhA/ Z+m3UzDwBuBUT8ff+E6uVy61DyAvHl7O+L9AFWZr1g== X-Google-Smtp-Source: ABdhPJyT0j0QeyzLWjQB1x7+UCsurnHz/q9/z3ussQHoMN5YDGUGkx6sJfukt1wBMQ+0ZnLAhavewmPl1lpbl04zjDE= X-Received: by 2002:a5d:84c5:: with SMTP id z5mr5722665ior.33.1619827802465; Fri, 30 Apr 2021 17:10:02 -0700 (PDT) MIME-Version: 1.0 References: <20210430204939.5152-1-sargun@sargun.me> <20210430204939.5152-3-sargun@sargun.me> In-Reply-To: From: Sargun Dhillon Date: Fri, 30 Apr 2021 17:09:26 -0700 Message-ID: Subject: Re: [PATCH v2 2/5] seccomp: Add wait_killable semantic to seccomp user notifier To: Andy Lutomirski Cc: Giuseppe Scrivano , Kees Cook , Linux Containers , LKML , Christian Brauner 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" On Fri, Apr 30, 2021 at 4:23 PM Andy Lutomirski wrote: > > On Fri, Apr 30, 2021 at 1:49 PM Sargun Dhillon wrote: > > > > The user notifier feature allows for filtering of seccomp notifications in > > userspace. While the user notifier is handling the syscall, the notifying > > process can be preempted, thus ending the notification. This has become a > > growing problem, as Golang has adopted signal based async preemption[1]. In > > this, it will preempt every 10ms, thus leaving the supervisor less than > > 10ms to respond to a given notification. If the syscall require I/O (mount, > > connect) on behalf of the process, it can easily take 10ms. > > > > This allows the supervisor to set a flag that moves the process into a > > state where it is only killable by terminating signals as opposed to all > > signals. The process can still be terminated before the supervisor receives > > the notification. > > This is still racy, right? If a signal arrives after the syscall > enters the seccomp code but before the supervisor gets around to > issuing the new ioctl, the syscall will erroneously return -EINTR, > right? > > Can we please just fully fix this instead of piling a racy partial fix > on top of an incorrect design? > > --Andy I thought that you were fine with this approach. Sorry. Maybe this is a dumb question, what's wrong with returning an EINTR if the syscall was never observed by the supervisor? I think that the only other reasonable design is that we add data to the existing action which makes it sleep in wait_killable state. _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/containers 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=-5.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 77E2FC433B4 for ; Sat, 1 May 2021 00:11:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4E70461027 for ; Sat, 1 May 2021 00:11:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233127AbhEAAKx (ORCPT ); Fri, 30 Apr 2021 20:10:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232893AbhEAAKx (ORCPT ); Fri, 30 Apr 2021 20:10:53 -0400 Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B4B8C06174A for ; Fri, 30 Apr 2021 17:10:03 -0700 (PDT) Received: by mail-io1-xd2a.google.com with SMTP id b10so11534446iot.4 for ; Fri, 30 Apr 2021 17:10:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sargun.me; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8nmI0Z6GpJ669OoqTL4ZRS5HBzAE6mZbx+jGtxyj3s4=; b=TAk5su9x4YNFiIahiV9a5aaJzJsZ734/S9ixVX7Bz0n5yF+3hMGaPGzcXNECetsqWg JkHS1ySxd3AQSEDQjy+xEZqIembgrUUi7vL6ea9plM5m16ZqVnUV0HCviU/AnqQAXtPQ WY0OTMD6LH4B6yZmmlK4gYsgcNJM2o8nMR04c= 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=8nmI0Z6GpJ669OoqTL4ZRS5HBzAE6mZbx+jGtxyj3s4=; b=CrgO/bSUT7b8ks5pTUTI3TMfrcsZWZXNWR4cxmk4dqn6SVIwraFW5sonMgLUnpH3DL xlLHVrY1m0samsLkWDsKB2VXqF8tujVJognyF/Vit/XAsNWLQLiv0NLoczlTmE7FL5sD VQ/M3HVEmBziSuljk6jQU1pvQNpuU6YBukd8ZzB8PsbYZm9564F5PkXfOA7TvQUuZLVh /S+KGtvtBUZja0Bocc+cLeiFGWNoXX86Tzvn7xGjfRrJAkx4vZOtoBpWG95pE6VgNA+j /DU7qXAEEoMyiQnCHiqI2VPcZaGWVOTxTpkmD1h5AmhX4yfSumOAlHm4hpe8hzcHZ4R7 Sk7Q== X-Gm-Message-State: AOAM533D1QTG0aX2hoATXvZOY9odO92tYhdJhpTCkVtuMzm8X8ybdJYg PxfM7RvSAEMOQ7yWzgNRupJ1gc4qVRUmaj41obEaRg== X-Google-Smtp-Source: ABdhPJyT0j0QeyzLWjQB1x7+UCsurnHz/q9/z3ussQHoMN5YDGUGkx6sJfukt1wBMQ+0ZnLAhavewmPl1lpbl04zjDE= X-Received: by 2002:a5d:84c5:: with SMTP id z5mr5722665ior.33.1619827802465; Fri, 30 Apr 2021 17:10:02 -0700 (PDT) MIME-Version: 1.0 References: <20210430204939.5152-1-sargun@sargun.me> <20210430204939.5152-3-sargun@sargun.me> In-Reply-To: From: Sargun Dhillon Date: Fri, 30 Apr 2021 17:09:26 -0700 Message-ID: Subject: Re: [PATCH v2 2/5] seccomp: Add wait_killable semantic to seccomp user notifier To: Andy Lutomirski Cc: Kees Cook , LKML , Linux Containers , =?UTF-8?Q?Mauricio_V=C3=A1squez_Bernal?= , Rodrigo Campos , Tycho Andersen , Giuseppe Scrivano , Christian Brauner Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 30, 2021 at 4:23 PM Andy Lutomirski wrote: > > On Fri, Apr 30, 2021 at 1:49 PM Sargun Dhillon wrote: > > > > The user notifier feature allows for filtering of seccomp notifications in > > userspace. While the user notifier is handling the syscall, the notifying > > process can be preempted, thus ending the notification. This has become a > > growing problem, as Golang has adopted signal based async preemption[1]. In > > this, it will preempt every 10ms, thus leaving the supervisor less than > > 10ms to respond to a given notification. If the syscall require I/O (mount, > > connect) on behalf of the process, it can easily take 10ms. > > > > This allows the supervisor to set a flag that moves the process into a > > state where it is only killable by terminating signals as opposed to all > > signals. The process can still be terminated before the supervisor receives > > the notification. > > This is still racy, right? If a signal arrives after the syscall > enters the seccomp code but before the supervisor gets around to > issuing the new ioctl, the syscall will erroneously return -EINTR, > right? > > Can we please just fully fix this instead of piling a racy partial fix > on top of an incorrect design? > > --Andy I thought that you were fine with this approach. Sorry. Maybe this is a dumb question, what's wrong with returning an EINTR if the syscall was never observed by the supervisor? I think that the only other reasonable design is that we add data to the existing action which makes it sleep in wait_killable state.