Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp3217450pxb; Thu, 10 Feb 2022 15:29:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJx+w5gd0dnSDD6LFp//Z8+TP6fWD//8u4sKvpzytNZqA6JBJ/OSeTg8ODRSwXTRPFoXHm+K X-Received: by 2002:a17:906:5191:: with SMTP id y17mr4493919ejk.747.1644535781173; Thu, 10 Feb 2022 15:29:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644535781; cv=none; d=google.com; s=arc-20160816; b=HrDPLQEo12g+FnmEbIgegGMfwI25IVc3fxMWbDzOjzPIZ8HzYuB4v+LG3KzPqXLFe6 iDxg0YzdQfvhlkYOz4N7UF/yioFIFR6TcPWkoS5npKHgn6Ox+XpuBLY/K7459HE0Guyf y48qvsclgq2TUXakg7ZWU/ed5Sms21O3myEVKj+DoR5HAPyHSYPm9dfoBeIynnCpjcx8 lKDTirUzhiD15+Y8I2jp7nw277hDkAnft/rzlSRP5P/nNOgzGfLLctMJtmO+9jSXZ0kh ZsgHY9sKMYjyzVAilRj/kyLciQBA68maFIQsWNUhoclXZjaKCaXsFAZ7UfvhMMiShoAR FvIw== 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=N0oLRk9WeOqKeOJsm7SffWghsKhMRhJhnNCJ7hAOzHs=; b=ida3U4g7LL755i9C5uyY+m8WLhIoaXnm5YH1puoEHrUT4D2UGY9fTCOO8MWm9d4o5+ 78pOaE7DBudalz4sxqZG2P25AcmKwz+sBrDS/3nW0hD38IuF4pMmUapzHfsNBWaJZLpk 58R5zYjnkl2br9xJFeI0Q3pPkECgDR/IBLjsRbh688SmWFwCkSguu3Ahe9XdBmwIN1WF AYB+WSDQiqciQioYYuE9wlHEknGYqgGRPAL3cT6aUZxAeYQYaoB22S6MZsYRA77Zv2r0 s1nKvTU/B7TRM+JOHbx4esGPSjRPbic+oEr2uyAQtvy5ccr/7Oj7thjN8eAjh3smwtKP N0Bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=TuUkbtEC; 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 w10si2741831edd.456.2022.02.10.15.29.15; Thu, 10 Feb 2022 15:29:41 -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=TuUkbtEC; 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 S245234AbiBJRhi (ORCPT + 99 others); Thu, 10 Feb 2022 12:37:38 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:46560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245229AbiBJRhg (ORCPT ); Thu, 10 Feb 2022 12:37:36 -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 708AEF03 for ; Thu, 10 Feb 2022 09:37:37 -0800 (PST) Received: by mail-pf1-x434.google.com with SMTP id 9so8612365pfx.12 for ; Thu, 10 Feb 2022 09:37:37 -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=N0oLRk9WeOqKeOJsm7SffWghsKhMRhJhnNCJ7hAOzHs=; b=TuUkbtECnMw5pstxW8Vf9MzxmHFnzQ3VrFEtni7dbPixYPAbEo7NkMJuM1Qgj661KE VJk9b0PYPRSKeDN+YxctUa3QcAVCD7gNix6N+IkF65J+3xW2bM603Gziaqz6EhHSn7Mb /8xvocsd5u5OmtK/6qYupEdGZ7DajwT8DsAUM= 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=N0oLRk9WeOqKeOJsm7SffWghsKhMRhJhnNCJ7hAOzHs=; b=pRD7mZS7vkCQdc0lgYuW3/vinIxRrRalxizdsQDfyGpInkU0lmun0yBsWZ5b/5Znyi T9rOP8u66LnAcyzNSI8ToEIqgc60vlC3q/5mXJNL9UG1xjN0ojeUWJjrcWzXoVoFexIO UjeEo8pj9HsZv/Yn08DkXnbZCsqaeb66Hpij+zG7wRJw0AkFVhxoKLuxNyMG95dCdTCe 68Z/fWyuB9EYzZbBx0/hrap1eRMfaUcB9ptRZWLzNjm3WQtKv6sMCdlgQB0hUbGSbu3f 0z/q1m0Fcj38Cb0Y+tCHI0hT5F+fNcuR9Iq3BztSSNtHV9kaIBGv1jd3MZP5/WX6EevI /2gQ== X-Gm-Message-State: AOAM531rHnpfS+jYrneJc9rJVDwp0WRELF5jbvsrHmTyp//Jan2kn9tP l5/ChT19TIIo/xIvZnfWAFM8pI+j+Bd3gg== X-Received: by 2002:a05:6a00:134b:: with SMTP id k11mr8674137pfu.33.1644514656966; Thu, 10 Feb 2022 09:37:36 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id 13sm23620222pfm.161.2022.02.10.09.37.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Feb 2022 09:37:36 -0800 (PST) Date: Thu, 10 Feb 2022 09:37:36 -0800 From: Kees Cook To: Jann Horn Cc: "Eric W. Biederman" , Robert =?utf-8?B?xZp3acSZY2tp?= , stable@vger.kernel.org, Andy Lutomirski , Will Drewry , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH 1/3] signal: HANDLER_EXIT should clear SIGNAL_UNKILLABLE Message-ID: <202202100935.FB3E60FA5@keescook> References: <20220210025321.787113-1-keescook@chromium.org> <20220210025321.787113-2-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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=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 Thu, Feb 10, 2022 at 05:18:39PM +0100, Jann Horn wrote: > 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 Święcki > > Suggested-by: "Eric W. Biederman" > > Fixes: 00b06da29cf9 ("signal: Add SA_IMMUTABLE to ensure forced siganls do 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 expect > > - * debugging to leave init killable. > > + * debugging to leave init killable, unless it is intended to exit. > > */ > > - if (action->sa.sa_handler == SIG_DFL && !t->ptrace) > > + if (action->sa.sa_handler == SIG_DFL && > > + (!t->ptrace || (handler == HANDLER_EXIT))) > > t->signal->flags &= ~SIGNAL_UNKILLABLE; > > You're changing the subclause: > > !t->ptrace > > to: > > (!t->ptrace || (handler == 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... Sorry, yes, I was not as accurate as I should have been in the commit log. I have changed it to: Fatal SIGSYS signals (i.e. seccomp RET_KILL_* syscall filter actions) were not being delivered to ptraced pid namespace init processes. Make sure the SIGNAL_UNKILLABLE doesn't get set for these cases. > > > ret = send_signal(sig, info, t, PIDTYPE_PID); > > spin_unlock_irqrestore(&t->sighand->siglock, flags); > > -- > > 2.30.2 > > -- Kees Cook