Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp3159782pxb; Thu, 10 Feb 2022 13:52:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJxCHHYKQyRVcgENmjaeaZx2duEyDTrYDWZEz7ve+WvZeKGdjM9XVoOGuMa8nDniVuF8y9po X-Received: by 2002:a05:6402:190f:: with SMTP id e15mr10634474edz.195.1644529947182; Thu, 10 Feb 2022 13:52:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644529947; cv=none; d=google.com; s=arc-20160816; b=dadlwHJlZAe68zox6ledIFE5JZjA4SIDj3L/AfjOl3Xo5hI+27BHzVw0fg9/q7/K3f /SSviyR/psX+XnVP+HyamOra5OB5EQLm2GkDmTShJgcqlmnS6SMG4rCGt4UJDyBx/mJI Xd5lNE0GpGNKU96wnvtouWsh4eyyTVb3u5Jt4mtON7I1Og4uvBb2F4tYRXeCLd7DmGI8 7TMnKj8ZWpEcWrv69UIXBljcW597VFzGYN9tRE5LACsaLoc7dAGrJo52blF3YUp0yTDJ dZQZCb61KlGu0PVyqTWGyLNJvCC7GtuT5fEpUfJjpZsovmnBrQhfQVXYItNn78SFlhhw qvpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:mime-version:user-agent:message-id :in-reply-to:date:references:cc:to:from; bh=b71dGgb2bMWNUYx92Vdiswz0VzdToWSpYs9flDzWBZU=; b=MCCky1UlmIdAsKnIJf0HdoKZWZe1/DDM7VpnoF7zzkdP9s1ngcYM78br2fFb6P+EBb S0G2pgr/yjlz8ShjZwPBMq9C/+Ema9aLG0MNDm8ghvH/o3ofOujJUDHGL8dhLxFALjk/ 5t7n6Exq2yvaXWDMfhlXn4Zi57s9WHQYAEjawTU6AjNnwjhN8vdnZ/RNdFzdPCM/eFDX tDvR4ym3JXMQ4jXZo1Ba2jCiyj+Hhu+kEyy/BZFnYo6NOKoR5fvX4OR6TcesSr299jv+ yKxGKiKMUhemN1nY/ysfju4KEhbKAsEdW/Pdd+kLOCrJDtJaQM5GdREM5LRhv5dUih8T EY+w== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t16si10539807edi.545.2022.02.10.13.52.02; Thu, 10 Feb 2022 13:52:27 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343610AbiBJS6Q (ORCPT + 99 others); Thu, 10 Feb 2022 13:58:16 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239113AbiBJS6P (ORCPT ); Thu, 10 Feb 2022 13:58:15 -0500 Received: from out03.mta.xmission.com (out03.mta.xmission.com [166.70.13.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2AB810B7; Thu, 10 Feb 2022 10:58:15 -0800 (PST) Received: from in01.mta.xmission.com ([166.70.13.51]:47730) by out03.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1nIEdy-00AOdS-VC; Thu, 10 Feb 2022 11:58:15 -0700 Received: from ip68-227-174-4.om.om.cox.net ([68.227.174.4]:42386 helo=email.froward.int.ebiederm.org.xmission.com) by in01.mta.xmission.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1nIEdx-00DkzX-P8; Thu, 10 Feb 2022 11:58:14 -0700 From: "Eric W. Biederman" To: Kees Cook Cc: Robert =?utf-8?B?xZp3acSZY2tp?= , Andy Lutomirski , Will Drewry , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org References: <20220210025321.787113-1-keescook@chromium.org> <871r0a8u29.fsf@email.froward.int.ebiederm.org> <202202101033.9C04563D9@keescook> Date: Thu, 10 Feb 2022 12:58:07 -0600 In-Reply-To: <202202101033.9C04563D9@keescook> (Kees Cook's message of "Thu, 10 Feb 2022 10:41:57 -0800") Message-ID: <87pmnu5z28.fsf@email.froward.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1nIEdx-00DkzX-P8;;;mid=<87pmnu5z28.fsf@email.froward.int.ebiederm.org>;;;hst=in01.mta.xmission.com;;;ip=68.227.174.4;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1+JrQ7YMIrXD3csaWAuHpMyqCe9x5AzMzo= X-SA-Exim-Connect-IP: 68.227.174.4 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Virus: No X-Spam-DCC: XMission; sa01 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: **;Kees Cook X-Spam-Relay-Country: X-Spam-Timing: total 568 ms - load_scoreonly_sql: 0.03 (0.0%), signal_user_changed: 4.4 (0.8%), b_tie_ro: 3.0 (0.5%), parse: 1.12 (0.2%), extract_message_metadata: 11 (1.9%), get_uri_detail_list: 1.91 (0.3%), tests_pri_-1000: 10 (1.8%), tests_pri_-950: 1.07 (0.2%), tests_pri_-900: 0.81 (0.1%), tests_pri_-90: 308 (54.2%), check_bayes: 304 (53.6%), b_tokenize: 5.0 (0.9%), b_tok_get_all: 7 (1.3%), b_comp_prob: 1.73 (0.3%), b_tok_touch_all: 287 (50.5%), b_finish: 0.86 (0.2%), tests_pri_0: 217 (38.2%), check_dkim_signature: 0.37 (0.1%), check_dkim_adsp: 1.80 (0.3%), poll_dns_idle: 0.26 (0.0%), tests_pri_10: 3.0 (0.5%), tests_pri_500: 9 (1.6%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH 0/3] signal: HANDLER_EXIT should clear SIGNAL_UNKILLABLE X-SA-Exim-Version: 4.2.1 (built Sat, 08 Feb 2020 21:53:50 +0000) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Kees Cook writes: > On Thu, Feb 10, 2022 at 12:17:50PM -0600, Eric W. Biederman wrote: >> Kees Cook writes: >> >> > Hi, >> > >> > This fixes the signal refactoring to actually kill unkillable processes >> > when receiving a fatal SIGSYS from seccomp. Thanks to Robert for the >> > report and Eric for the fix! I've also tweaked seccomp internal a bit to >> > fail more safely. This was a partial seccomp bypass, in the sense that >> > SECCOMP_RET_KILL_* didn't kill the process, but it didn't bypass other >> > aspects of the filters. (i.e. the syscall was still blocked, etc.) >> >> Any luck on figuring out how to suppress the extra event? > > I haven't found a good single indicator of a process being in an "I am dying" > state, and even if I did, it seems every architecture's exit path would > need to add a new test. The "I am dying" state for a task is fatal_signal_pending, at least before get_signal is reached, for a process there is SIGNAL_GROUP_EXIT. Something I am busily cleaning up and making more reliable at the moment. What is the event that is happening? Is it tracehook_report_syscall_exit or something else? From the bits I have seen it seems like something else. > The best approach seems to be clearing the TIF_*WORK* bits, but that's > still a bit arch-specific. And I'm not sure which layer would do that. > At what point have we decided the process will not continue? More > than seccomp was calling do_exit() in the middle of a syscall, but those > appear to have all been either SIGKILL or SIGSEGV? This is where I get confused what TIF_WORK bits matter? I expect if anything else mattered we would need to change it to HANDLER_EXIT. I made a mistake conflating to cases and I want to make certain I successfully separate those two cases at the end of the day. Eric