Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 686AEC4332F for ; Wed, 17 Nov 2021 19:06:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 50B2A61B6F for ; Wed, 17 Nov 2021 19:06:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240332AbhKQTJJ (ORCPT ); Wed, 17 Nov 2021 14:09:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240319AbhKQTJH (ORCPT ); Wed, 17 Nov 2021 14:09:07 -0500 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87BDEC0613B9 for ; Wed, 17 Nov 2021 11:06:08 -0800 (PST) Received: by mail-ed1-x529.google.com with SMTP id r11so15595621edd.9 for ; Wed, 17 Nov 2021 11:06:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kylehuey.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6F06jbeyt9mOtQ/ejGOdNSiaeOgainiDjsIp/GYxA8k=; b=Gbvyge049vFVIpoykKRpTf08urXrlJlaXoMyMCZAPDYfeFcVS6KIJKOKWEPRHtT8Gc pYdbbmJq98pqqk3639W6LrIb7iZ5bCQ3ybAeoYT1+zY6EnzIU5IJRlC1O/ZJdDSWlebe Hs8sVftP80dj2Wse/RxMYNv20bC/un1qSZ4to9bt1+q8GFuq8MnGnC7aPtUIHO6uu+4j twY1VhWYCnhP6JXqCI0VSKlS7I+Nc7CLzHJO2MWHevisbz0UAagNXGScIVdY4Zzr4h1i OJvaVh1b2hYbFzwIo4TJyLmGrQNaCD1nKQh4urU/Y90yIZdR3f3/MMX/XHJT8Egt1/yj YOCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6F06jbeyt9mOtQ/ejGOdNSiaeOgainiDjsIp/GYxA8k=; b=VSSS08NfK8zahl9CwpsqY+uMbz6ZLhqAjoVkly7PQkQzao0/7+0kybjqH4uR5wbmod K2cy6KrSzXAyFIGaGRfc4xUODRaBUIZehj90J7ekunsHT08IbU7a7vN7OxP0wfxJ9q9k 6cKF6ZFZrrgNsLMaeekG2uFgxINZeMbtwtqKMtKmaJRftIeagWOz93z3ji+IkdhYK8Wk t1Zv1cTDbxxny9oXcmAZGAhcrGX/5mpIZpA8Jmqfmsp0DkuheXjKB1xIAWScZ0ZlwYTO 46GxpJ+Nojlua9x6+RF3xMVJckzwOYEz0BAg/bsTmpLgxa+Q6x0ZigGbDE3iZ3ZvU8r9 rvHQ== X-Gm-Message-State: AOAM5327h6tfzNKPxV5QLBW7kVUnVU/bO4afyYE0Xamv9lITkT0RDrmi HqdfbVzz7Y6CUpH6a44J7Kg8OrRC4g2+ZEcfygR+cw== X-Google-Smtp-Source: ABdhPJxWlFOYJ0DB220x9oOZG7JB4Dhm+0+i6l+k2Fo8gixNzexi1o1ISJkCnmAF6U2ntzqhoR7b5XKlCilOASfM8tk= X-Received: by 2002:a17:906:140b:: with SMTP id p11mr24651600ejc.116.1637175966957; Wed, 17 Nov 2021 11:06:06 -0800 (PST) MIME-Version: 1.0 References: <202111171049.3F9C5F1@keescook> In-Reply-To: <202111171049.3F9C5F1@keescook> From: Kyle Huey Date: Wed, 17 Nov 2021 11:05:51 -0800 Message-ID: Subject: Re: [REGRESSION] 5.16rc1: SA_IMMUTABLE breaks debuggers To: Kees Cook Cc: "Eric W. Biederman" , Andrea Righi , Shuah Khan , Alexei Starovoitov , Andy Lutomirski , Will Drewry , "open list:KERNEL SELFTEST FRAMEWORK" , bpf@vger.kernel.org, open list , linux-hardening@vger.kernel.org, Linus Torvalds , "Robert O'Callahan" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 17, 2021 at 10:51 AM Kees Cook wrote: > > On Wed, Nov 17, 2021 at 10:47:13AM -0800, Kyle Huey wrote: > > rr, a userspace record and replay debugger[0], is completely broken on > > 5.16rc1. I bisected this to 00b06da29cf9dc633cdba87acd3f57f4df3fd5c7. > > > > That patch makes two changes, it blocks sigaction from changing signal > > handlers once the kernel has decided to force the program to take a > > signal and it also stops notifying ptracers of the signal in the same > > circumstances. The latter behavior is just wrong. There's no reason > > that ptrace should not be able to observe and even change > > (non-SIGKILL) forced signals. It should be reverted. > > > > This behavior change is also observable in gdb. If you take a program > > that sets SIGSYS to SIG_IGN and then raises a SIGSYS via > > SECCOMP_RET_TRAP and run it under gdb on a good kernel gdb will stop > > when the SIGSYS is raised, let you inspect program state, etc. After > > the SA_IMMUTABLE change gdb won't stop until the program has already > > died of SIGSYS. > > Ah, hm, this was trying to fix the case where a program trips > SECCOMP_RET_KILL (which is a "fatal SIGSYS"), and had been unobservable > before. I guess the fix was too broad... Perhaps I don't understand precisely what you mean by this, but gdb's behavior for a program that is SECCOMP_RET_KILLed was not changed by this patch (the SIGSYS is not observed until after program exit before or after this change). - Kyle