Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp4251361pxb; Fri, 11 Feb 2022 21:49:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJzB7PV2eSzub3MkSJPkYtc1MBfOHGTE1H7nvChFYK0Icl5kPXAmxFT4oTujEP9hlo1zPr6R X-Received: by 2002:a63:dc49:: with SMTP id f9mr4096842pgj.580.1644644973904; Fri, 11 Feb 2022 21:49:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644644973; cv=none; d=google.com; s=arc-20160816; b=Ew7TNlSeB0rkbVQoTghjnynNUQtABRL1EcwSI3CBwV9E/fJ+n8e5PTsOgka39dUyVI QHAaS5M41nbZ6sz9vVpa0QUTsc6MOf+JKtLaDVDGKA/T91xX5LtJsXg+tff+/WMLTqmC B3Dzxn6l6WyvvMKMJ2LG+zjQNIM91pLZ6/Mnxp8tfgOFuJqtnWeyEHqJz19wkWgYmFjZ rgKxa7AuMI71LXuFJTb3tJvgZyYbwGtm5Qsk/FRKpI24U/7FglE/FJNRmdkFAfaXv0Ei nBaYRoL2ys71EfkSqpJUohOgVmnGCAnRDycsWwtMbWp7Po0wqXXldh1UIYqiYhtRtGtk EO9Q== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=QNqvweKtPqIF4attpHp1noQLaabICsimXqSeB/QPjEI=; b=JOWFbBKFIMGge4DhOCUEFq7cHWLhd6d9HjTOpO/1Z2rQKeqhlachveI3CBol4/2JPC 2yaNO3CZ2KU44hkDmm6a/smUDaHqPGnfStBW/QuhDLKLLBLqLzBkWk0Mu5YqDPBZo2XA NYbN9E5G9n9jjAglsw5BfuLSJNtqxcCFDd4Pc3vDgH2DnxdB7ihYUJkqzeiAl1Vh3Fo2 vEtvf8Uh1oe1TAr6j6JnKJsEJY7mNLgkqPgSykPQKMQPxu0DmxBThMtxKY4VY3gi+2jC fslJrqRmqvANTAh9C9yCAcSDxqCkI/ic/h4r5OjKNvnPmO4q8mGZ7l8Fggjgxi4cGHvr 7Glg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=DpIN81zj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a70si2504263pge.54.2022.02.11.21.49.20; Fri, 11 Feb 2022 21:49:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=DpIN81zj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S1353053AbiBKUBH (ORCPT + 93 others); Fri, 11 Feb 2022 15:01:07 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235284AbiBKUBG (ORCPT ); Fri, 11 Feb 2022 15:01:06 -0500 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A54CFC51 for ; Fri, 11 Feb 2022 12:01:01 -0800 (PST) Received: by mail-pf1-x431.google.com with SMTP id l19so12304926pfu.2 for ; Fri, 11 Feb 2022 12:01:01 -0800 (PST) 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:content-transfer-encoding:in-reply-to; bh=QNqvweKtPqIF4attpHp1noQLaabICsimXqSeB/QPjEI=; b=DpIN81zjnh+AwCO+qCWcnLW920fFY9PMwlJ3PW0Ee5vWBCqso1AyT9kdGi/ouyKLeQ RPUIDaScKejJU5SIIErkiywv1jEBq22/gq1gLqIZhlxR9SPmoJZaGuYxRuE2mCHVsIXy wyVqBsoQh4qoAteYdlaENTxzZ8rO0FY7grMN8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=QNqvweKtPqIF4attpHp1noQLaabICsimXqSeB/QPjEI=; b=EeZSfOgbNRSmH3U8lX8FRGkpkb4znXg4G38vquo6gvhtUrK/EP7k4KeBivJQf/UPf7 qiyEMxXb9Aj+OmQon3GaUZuUw0D+zExvXchR6oWkTu1iA8u0lVnHOl/9GGV18xLWDt7l r3bM14Uc+XH21D4ybInqzMJb+GGmZfIKarTtKBUW/epT1Zex7Qpt4ARa2ZYyjf8EMFEj updvK0kz0AY60/3VHl7LiUvKFHygdeg4YKK69RmX3BJRGz1PL/qe0VDRH6276pcgy+LC zOWvKcpX0TGPnYrsUodpTq13/ZY6l4pkoLguqNfZ3q2RSapHKkLTKgw7RVsdlip26Myy BrOA== X-Gm-Message-State: AOAM530iA+m+mV1Y15L6a0KZwFwvpZYrPWsOwRcX02y1ahDxXH9BimQr W9idpRdPDUq0JUK19bt7A+qrEw== X-Received: by 2002:a63:8849:: with SMTP id l70mr2701342pgd.25.1644609661110; Fri, 11 Feb 2022 12:01:01 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id k22sm28951487pfu.210.2022.02.11.12.01.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Feb 2022 12:01:00 -0800 (PST) Date: Fri, 11 Feb 2022 12:01:00 -0800 From: Kees Cook To: "Eric W. Biederman" Cc: Robert =?utf-8?B?xZp3acSZY2tp?= , Andy Lutomirski , Will Drewry , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH 0/3] signal: HANDLER_EXIT should clear SIGNAL_UNKILLABLE Message-ID: <202202111159.7B2BAD2EF1@keescook> References: <871r0a8u29.fsf@email.froward.int.ebiederm.org> <202202101033.9C04563D9@keescook> <87pmnu5z28.fsf@email.froward.int.ebiederm.org> <202202101137.B48D02138@keescook> <87k0e249tt.fsf@email.froward.int.ebiederm.org> <202202101710.668EDCDC@keescook> <875ypm41kb.fsf@email.froward.int.ebiederm.org> <202202101827.4B16DF54@keescook> <87a6ex1ek2.fsf@email.froward.int.ebiederm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87a6ex1ek2.fsf@email.froward.int.ebiederm.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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, Feb 11, 2022 at 11:46:53AM -0600, Eric W. Biederman wrote: > Robert Święcki writes: > > When I noticed this problem, I was looking for a way to figure out > > what syscall caused SIGSYS (via SECCOMP_RET_KILL_*), and there's no > > easy way to do that programmatically from the perspective of a parent > > process. There are three ways of doing this that come to mind. > > Unless I am misunderstanding what you are looking for > this information is contained within the SIGSYS siginfo. > The field si_syscall contains the system call number and > the field si_errno contains return code from the seccomp filter. > > All of that can be read from the core dump of the process that exited. > > Looking quickly I don't see a good way to pull that signal information > out of the kernel other than with a coredump. > > It might be possible to persuade PTRACE_EVENT_EXIT to give it to you, > but I haven't looked at it enough to see if that would be a sensible > strategy. If there is already a ptrace on the child with PTRACE_O_TRACEEXIT, it should be possible to use PTRACE_GETSIGINFO. > > I think it'd be good to have some way of doing it from the perspective > > of a parent process - it'd simplify development of sandboxing managers > > (eg nsjail, minijail, firejail), and creation of good seccomp > > policies. > > By development do you mean debugging sandbox managers? Or do you mean > something that sandbox managers can use on a routine basis? It'd really be nice to be able to get this info without the ptrace relationship already in place... hmmm. -- Kees Cook