Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5664402pxb; Mon, 14 Feb 2022 04:51:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJxZUh8rr+/6AO88ktV+mp8aKW+1VuaycpMKW5PVIuln8j9i1/bq2NthCf2JE8RhKQXSeIoX X-Received: by 2002:a50:9d0d:: with SMTP id v13mr15661597ede.242.1644843083870; Mon, 14 Feb 2022 04:51:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644843083; cv=none; d=google.com; s=arc-20160816; b=lBOdbo01MyXYQ1NetRHt/SkCLYo4rciZj9q+8d0uqVy3VLfNry8WPKLBRItRq5qr/I AQ+eSumAPKkhNXaNQGoi9sF5KE7Yr7WND1DcvE1IjDMjIo28sQL/1VXvea/p1p2vHD0l xlnQrHaIwRup0H+WDVuqXak3OFzve5tHmtOuLikaH+CkJH1D5n7XKiInzI10IxTHF36x 9PjdWa4+0p3MMRZH0pbQFfqKIDQwB5jADwYTr8p0cnr4gYqJ7hLgw0gOm9gScMtLpP4F YgCQ5s2qUJTHuh0vZW9k0dWbVhQ5gdcEY3ljZKCq4SX4EgGDWYAcqHpwrU7g+wm3T1Hj 7DjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=JKW081rgGpaiP4kwWeXuyBtPDTahlHH6s9OhRPepRUE=; b=Qoj5EwRhnGongtzPWYbDfgd1aySSyHqamakyHCDjMH8980jaYpt2+FnUuWBToZP6bE 6d6k4Cs7LCymZuB/H/oGst2aJPL8/112Bx1CGW2Cxsut+LHO2BGGpiZkCTtPAPi34TIM BrjqY+nIe9vs+Mnq4LQH5rf7NuotfJHqFkAbTya4MnRHg1e4ENfzP3SwYR6nheTqJol0 IXWRDTStrELvzf6TnohIsAhb8tC0W7MeM0St2i93GeyeK2WkeI5W+vOOjrmB80qutA/x CtD1hwO6BZFpRoAOj/QuxDenZ9TsyIOQcG911nszbUS3EFcOT+AgWKZxP3uuksAWCh/g o8dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=P+OBlYOR; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n12si24594969edx.380.2022.02.14.04.51.00; Mon, 14 Feb 2022 04:51:23 -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=@google.com header.s=20210112 header.b=P+OBlYOR; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244004AbiBJQTK (ORCPT + 95 others); Thu, 10 Feb 2022 11:19:10 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:38006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244118AbiBJQTG (ORCPT ); Thu, 10 Feb 2022 11:19:06 -0500 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BC72397 for ; Thu, 10 Feb 2022 08:19:07 -0800 (PST) Received: by mail-lf1-x131.google.com with SMTP id z19so11359238lfq.13 for ; Thu, 10 Feb 2022 08:19:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=JKW081rgGpaiP4kwWeXuyBtPDTahlHH6s9OhRPepRUE=; b=P+OBlYOROMsamaTxRHS41/nKtUTb4mUW3k2CPzOjp/XYHUPtBGs6jPd01VgUDErVf8 Unk8sJzZKBtnswkppHfrYbVkSkJ5cczyJC0cjllbYGH/KBMcRytWaEGxYdY5uMmWDM0h JK/pVSXO60FPuFXurMeTKq/F7uU/KUZ8yVFMzfXLGQr6NE6QpvcS10pcWo1oEzXwECfO 4gHx3+unCa+lHixMKdaAPxdC53UEfTLeAdNUqoVlTGDMZ82noVy4gzGK3DWPhJrrCgpK lFAC1wuCcD2jaDGDXO8SztoVlPo+ZtD+Uv+3h6obQjaL6lXaJZW/75Hey0myJA7ugfhL nmXQ== 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:content-transfer-encoding; bh=JKW081rgGpaiP4kwWeXuyBtPDTahlHH6s9OhRPepRUE=; b=3VrqCD2Yks/fmEi5ETRS18x3APxLAm/BbD39iXRwOsMMiuAQ5rR5aFMPl03AZiRmad RWnmV6za2LYqXiuBRjGDx+XLcdzAmP990aMkTdfC8iEvGK8zFkgtQxVQlPkEM5LfJ8So Abhe4E6GY5m2uN6TXM2EeDRC0ISwrNNo1kJdNYTNKBS7IoTLPWIV0rgzWP2rInwAAu06 If6TnrUPn4Vfupl6UyUJz21MbPHQv1NYvh5EHYLcVo8xQ1bw/Wdju0dCZ2td5RWD1LIu MFIUVBsbofcK8C9O96ZufMJc8DgejJ1lVueWfqnIwZioC1sRpyv8QnF/pJD3ev3Yv9xb 2plg== X-Gm-Message-State: AOAM531lvwx0kKenKb/Dn8gM5+1U3b/lT/jZ8+m54lrRnxM4it3kr3u8 SWWLj3giAblHrffseYn4ekZtRLWtYsv1rFuKLXHapw== X-Received: by 2002:a19:ee04:: with SMTP id g4mr5504587lfb.157.1644509945581; Thu, 10 Feb 2022 08:19:05 -0800 (PST) MIME-Version: 1.0 References: <20220210025321.787113-1-keescook@chromium.org> <20220210025321.787113-2-keescook@chromium.org> In-Reply-To: <20220210025321.787113-2-keescook@chromium.org> From: Jann Horn Date: Thu, 10 Feb 2022 17:18:39 +0100 Message-ID: Subject: Re: [PATCH 1/3] signal: HANDLER_EXIT should clear SIGNAL_UNKILLABLE To: Kees Cook Cc: "Eric W. Biederman" , =?UTF-8?B?Um9iZXJ0IMWad2nEmWNraQ==?= , stable@vger.kernel.org, Andy Lutomirski , Will Drewry , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 Thu, Feb 10, 2022 at 3:53 AM Kees Cook wrote: > Fatal SIGSYS signals were not being delivered to pid namespace init > processes. Make sure the SIGNAL_UNKILLABLE doesn't get set for these > cases. > > Reported-by: Robert =C5=9Awi=C4=99cki > Suggested-by: "Eric W. Biederman" > Fixes: 00b06da29cf9 ("signal: Add SA_IMMUTABLE to ensure forced siganls d= o not get changed") > Cc: stable@vger.kernel.org > Signed-off-by: Kees Cook > --- > kernel/signal.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/kernel/signal.c b/kernel/signal.c > index 38602738866e..33e3ee4f3383 100644 > --- a/kernel/signal.c > +++ b/kernel/signal.c > @@ -1342,9 +1342,10 @@ force_sig_info_to_task(struct kernel_siginfo *info= , struct task_struct *t, > } > /* > * Don't clear SIGNAL_UNKILLABLE for traced tasks, users won't ex= pect > - * debugging to leave init killable. > + * debugging to leave init killable, unless it is intended to exi= t. > */ > - if (action->sa.sa_handler =3D=3D SIG_DFL && !t->ptrace) > + if (action->sa.sa_handler =3D=3D SIG_DFL && > + (!t->ptrace || (handler =3D=3D HANDLER_EXIT))) > t->signal->flags &=3D ~SIGNAL_UNKILLABLE; You're changing the subclause: !t->ptrace to: (!t->ptrace || (handler =3D=3D HANDLER_EXIT)) which means that the change only affects cases where the process has a ptracer, right? That's not the scenario the commit message is talking about... > ret =3D send_signal(sig, info, t, PIDTYPE_PID); > spin_unlock_irqrestore(&t->sighand->siglock, flags); > -- > 2.30.2 >