Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp4061005pxb; Fri, 11 Feb 2022 14:21:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJw27cJZ1N9S1MysUlDw5YZHQgbu/oXvGgpb0UuuXrbicA6FsemHtj7+7E7aluVGgsEqJ1HP X-Received: by 2002:aa7:d297:: with SMTP id w23mr4084354edq.313.1644618065342; Fri, 11 Feb 2022 14:21:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644618065; cv=none; d=google.com; s=arc-20160816; b=eEUjXr6faHsoBZQewC/9KBPV3WsAzOMuYHJ3yP/NXu7C1sPSD8wkUohVPoKqo6PLDr mksRiaT5/7OBTdv9u88RTkLSIP68czdQF9Z8vBozY/yHFkZb+bA1HX7aQVKNV04TGwQp 8gtxHUsJg5G50I3de809ZfGi9/IUmUZVKkLG06ga7evqkQFrRsf2GYcMQXpkf5+wdSt9 cwszoTVIkga57w0vh0Mq0FTM0p/iFO8mql5RGShj+rG2Cf01jrKEEf0kZ2fAEPAUkqXG vxn3grUlnkIGHpCpd4DN1bKqWyr0wK4Kj+dxjev5as5etWYlSMi7g9qBkSodUD9ac4SW IbOw== 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=SPfAVMPxFXWP9yaWNQ8kQASSQMlDzKBO7XOnuPeP+c8=; b=wo6Dz0t+1IolnkkKXlCqnURhI+aycfQfZJNyacd6ANkgq8Iy0HoX1rDbAyD7dGZJt9 A1/U1cju3jRvH9ChHgMKPdTP1KkfvYDiBC/Er70w3RAR8dauD/hKlmMDV1bpKE9BMnh8 uhawWkVJOq1mJ+ncLwSkIg9KXXdeGonM/wtsMnYHOZLYgRRD4l78n5fL/FlW/GB7hDnA 5uC0dW9iZNETf9Ch3yZ/c2I6mGFhqBblvhu+1y6jlJpmWN486d1kURILQi6kyhHC1s0I C7o8vBOyoTYaAN+OGXhtgRMkzwIhaIrlPqgUjJ+NVNyRANUQ7DkR7kEgt+bQs5PdYkl6 nN8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=lly4ZI04; 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 c7si16778006ejc.853.2022.02.11.14.20.41; Fri, 11 Feb 2022 14:21:05 -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=lly4ZI04; 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 S1353046AbiBKT6T (ORCPT + 99 others); Fri, 11 Feb 2022 14:58:19 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:39672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353041AbiBKT6S (ORCPT ); Fri, 11 Feb 2022 14:58:18 -0500 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C3F1B90 for ; Fri, 11 Feb 2022 11:58:16 -0800 (PST) Received: by mail-pf1-x434.google.com with SMTP id d187so18062639pfa.10 for ; Fri, 11 Feb 2022 11:58:16 -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=SPfAVMPxFXWP9yaWNQ8kQASSQMlDzKBO7XOnuPeP+c8=; b=lly4ZI04Jy6RBjOUgr4jYMTzZ2uCUnQ3vwJQpca1ZJyg5XJGU1J1k7CqP3pi6dHa5I Ps0uTkqHLTqZnb19yEQekzG4SeA3fPgRU76s2ZHiGEivW5YlFNnIYXPeYtG/jiP9RSzi s+QkHFWRhfnxbdBWMua2H6Vv7DXTB1q6VZsAg= 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=SPfAVMPxFXWP9yaWNQ8kQASSQMlDzKBO7XOnuPeP+c8=; b=xa8nsrQaH5IIz+iYERBrskj8UgisovqPfGFhpGALExtktDxmVNJ7ZpnRCwCmeffa4j PINIK3WuOt/1V+4pzsZTjwfSB0F+vG5CtLFG/X/HAprgRWtOLN1Zja/vDJInWQ9imd/J OCauRHquzwnWVMrZeWJmrSb588H3IeI2plbSvDXrUZTUSpAZSP8YWfF2yCvCgF29RM5x O3QAWZmcatRdulap/iz+5vbVovcG7dpFzbIdpAMgTtuor6e6uc8h/gpEzemlgFnUXnfj xJQiLebq+in4fzpX+WDGc/6P8lgG2qtvVRfGWKi2QU3lpuD1Aylb3cRjLhRqA+K2lsrP WfaQ== X-Gm-Message-State: AOAM532IfDCLh3c+8hfDL8Ax9c0e46+B7JvBEUy+mAqKI9V8T/0Hvn6c 1W+04cgYf5ez4lFOrtfCrgulcg== X-Received: by 2002:a05:6a00:b84:: with SMTP id g4mr3220812pfj.10.1644609496082; Fri, 11 Feb 2022 11:58:16 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id d20sm27369792pfu.9.2022.02.11.11.58.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Feb 2022 11:58:15 -0800 (PST) Date: Fri, 11 Feb 2022 11:58:14 -0800 From: Kees Cook To: Robert =?utf-8?B?xZp3acSZY2tp?= Cc: "Eric W. Biederman" , 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: References: <20220210025321.787113-1-keescook@chromium.org> <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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-K9mail-Identity: !l=0&o=0&qs=PREFIX&f=TEXT&s=--%20%0D%0AKees%20Cook&m= %23%3AOGM4OWE1MTEtMTdkZS00ODEzLTlhNDQtMGY1OTRhYjk5NDcx%3AMg%3D%3D%3AODc 5NTg%3D%3AANSWERED&p=0&q=SHOW X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, 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=unavailable 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 February 11, 2022 4:54:26 AM PST, "Robert Święcki" wrote: >> It's mainly about the exit stuff having never been run before on these >> kinds of process states, so things don't make sense. For example, on the >> SIGSYS death, the registers have been rewound for the coredump, so when >> the exit trace runs on x86 it sees the syscall return value as equal to >> the syscall number (since %rax is used for the syscall number on entry >> and for the syscall result on exit). So when a tracer watches a seccomp >> fatal SIGSYS, it sees the syscall exit before it sees the child exit >> (and therefore the signal). For example, x86_64 write (syscall number >> 1), will return as if it had written 1 byte. :P >> >> So, it's not harmful, but it's confusing and weird. :) >> >> > I am trying to figure out if there is a case to be made that it was a >> > bug that these events were missing. >> >> I don't think so -- the syscall did not finish, so there isn't a valid >> return code. The process exited before it completed. > >A tangential point: please ignore for the purpose of fixing the >problem at hand. I'm mostly making it, in case it can be taken into >account in case some bigger changes to this code path are to be made - >given that it touches the problem of signal delivery. > >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. I had hoped that the parent could read the SIGSYS siginfo_t from the child, but I haven't found any way to do this. :( :( I don't seem to be able to use: - PTRACE_ATTACH to use PTRACE_PEEKSIGINFO on a dead process. - signalfd (nothing is in the fd after the exit). Hmpf. -- Kees Cook