Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp27787pxv; Tue, 29 Jun 2021 22:26:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXCUInBZ4aGdhImJa7iNe6ICTYuM6p5NazQVAScoZkj8JKw6w77EGDbXSR/LCfJSSwK9Qk X-Received: by 2002:aa7:c548:: with SMTP id s8mr43822887edr.148.1625030803814; Tue, 29 Jun 2021 22:26:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625030803; cv=none; d=google.com; s=arc-20160816; b=iWlSuV1eluYCod9KhmEIV1oQBplX/MRlJPh9CXAZCdXJRUzOOfltRFJejbE7A+UOpj sr6SwEsMr7V39cjvMDzFkZ/PXIXhYPo5T1C8X/Ry1QDgSqGQwgLEHfixHGj76y0CSkYw gdr37yZ6TsBJAMu20ORJE8pJ3mm+BOYtgq1rRUEwCLuCm323rvEJvSv9gShdM05794RK JCiw6a/xDV4eQkikNMLexB8U5slVU4xgkoj16kcuw+ovMAqqvrvSLYen0FbYJxgJ0kdy cvVFZq/A37lYBZ5as8XGAS1uS7cM3unh0JdE8XTTyz1PIy6I6dumP4WJLSVoKYgLVRuu uioQ== 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=OkgX/l6nyVHOkHtVICWEWlZsAs77Eh7E8vZnP+04cZU=; b=dNncd5zYTVOiRBMHPyKH7JhM1LpB8HSt4MDpwduXPPKnzjmUUojt8a/TAzlbcqn7MY Dm+5S6n5I8eo7lSDAji//hIStUwtvQJSy/9OKYlZKPq4YVstB+jogp/oLjWOwVXbQNlk 2xKX3liqmoFyi6Io4wBeM0KyzcL37CqgcBTBucdUDHSS9fTu5RJUFEmJHL/lVq6Ecg0w I11Z9/DXJ++uXCGHyaGCy01wI2QEtwCd8RujIRPndtvPdALqb10ggeyhx80rUnBqp0Si kh4ed8SXJZnoTsCgKIaZaVMqqTni85ZoJGWiICB7+TBfXls3uPvxoJgndx4jtki+ZPng LUww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Ozuu7aPn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p3si18540425ejo.95.2021.06.29.22.26.19; Tue, 29 Jun 2021 22:26:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Ozuu7aPn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230005AbhF3FZi (ORCPT + 99 others); Wed, 30 Jun 2021 01:25:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229510AbhF3FZh (ORCPT ); Wed, 30 Jun 2021 01:25:37 -0400 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F157C061768 for ; Tue, 29 Jun 2021 22:23:08 -0700 (PDT) Received: by mail-pg1-x52c.google.com with SMTP id h4so1091351pgp.5 for ; Tue, 29 Jun 2021 22:23:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=OkgX/l6nyVHOkHtVICWEWlZsAs77Eh7E8vZnP+04cZU=; b=Ozuu7aPncD/CMLJza+F4JwA5PsKvNqi55YrM7STSKGqVfTpUR6pNiqkih8C4Yej/UI pX+laWJdYLjpLb9flbG3+U2C2Ptmg+Az4aAgDQyct0uzw/FYqXma79YGfBZ+XB5d0fJG dq5rXy7x0hVB2s2mU6bck5fQekMMTukz/ufvc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=OkgX/l6nyVHOkHtVICWEWlZsAs77Eh7E8vZnP+04cZU=; b=mtsTgrrmjdeP8/CEwFNtOykqZYsTmagbqtIxCuGT8L7ikckKuBA8XOg5n+5wjKtnKi LLN714WQX0E1zXj50JseaQS/gzLRPsjfaASS4S4VrJhVtW1p8oZ6fJS9npF8ur4Gb5sb 2YQ7oQ7s7TXZGelp0FObCVTW5NzKUFfefMzIw062oo2KrE4R+7uNb4Ikl4Ju/5g+J0hL tCKVac0KnFBWx61NA5TQaSO7QyuBJJxW8/ILEzTETXWLTUvoIFQozFYOANoH6z2jaeJx ifhQ8ltWNfndQjcNCVVaeXsVwadiReX55De5jAcKOqqrgZFIcSawu6naZ6Gc7CAxzczd 7DHQ== X-Gm-Message-State: AOAM531/ojRksqcWkg2Am/r3Ribg073jNTK7sNIfHzqQu9cNrMAQ/zAP JPUGsBGAaHoa2iwoi2q5/TujAg== X-Received: by 2002:a62:380c:0:b029:2f7:4057:c3ed with SMTP id f12-20020a62380c0000b02902f74057c3edmr34233852pfa.21.1625030588089; Tue, 29 Jun 2021 22:23:08 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id q18sm20087789pfj.178.2021.06.29.22.23.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 22:23:07 -0700 (PDT) Date: Tue, 29 Jun 2021 22:23:06 -0700 From: Kees Cook To: "Eric W. Biederman" Cc: linux-api@vger.kernel.org, Andy Lutomirski , Will Drewry , Linus Torvalds , Al Viro , Michael Kerrisk , linux-man@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: Semantics of SECCOMP_MODE_STRICT? Message-ID: <202106292156.9458CF22@keescook> References: <87r1gkp9i7.fsf@disp2133> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87r1gkp9i7.fsf@disp2133> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 29, 2021 at 05:54:24PM -0500, Eric W. Biederman wrote: > > I am the process of cleaning up the process exit path in the kernel, and > as part of that I am looking at the callers of do_exit. A very > interesting one is __seccure_computing_strict. > > Looking at the code is very clear that if a system call is attempted > that is not in the table the thread attempting to execute that system > call is terminated. > > Reading the man page for seccomp it says that the process is delivered > SIGKILL. > > The practical difference is what happens for multi-threaded > applications. > > What are the desired semantics for a multi-threaded application if one > thread attempts to use a unsupported system call? Should the thread be > terminated or the entire application? > > Do we need to fix the kernel, or do we need to fix the manpages? I don't know of anyone actually using SECCOMP_MODE_STRICT, but the original implementation was (perhaps accidentally) thread-killing. It turns out this is not a particularly desirable situation, and when SECCOMP_MODE_FILTER was created, it continued with that semantic, but later grew a process-killing flags, as that's what most programs actually wanted. It's likely the manpage needs fixing (we had to make similar updates for SECCOMP_MODE_FILTER), since some of the early examples of using SECCOMP_MODE_STRICT were basically "fork, calculate, write result to fd, exit". FWIW the seccomp selftests don't even check for the thread-vs-process SIGKILL of SECCOMP_MODE_STRICT. :) -- Kees Cook