Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp797683pxb; Thu, 21 Oct 2021 09:38:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9Ota8oQlLuhQHd+yfpwPIsHRSKWVp1OqY99511HVu0NlZI394IqY8+TnrgDxbziJpvUeD X-Received: by 2002:a17:906:b09:: with SMTP id u9mr8578983ejg.4.1634834337034; Thu, 21 Oct 2021 09:38:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634834337; cv=none; d=google.com; s=arc-20160816; b=VphozqXg8nKAgM6EZRdu3g3bGkZlX2XwRSODk6BYDiyegFqw3QeS5ZHLRvv+KWGTJu guAPGBGRtwtl5aXeXIwNJgBPKgRjradH4P51qH9o/ZAqJsKpL7oUYCXAxKPc9UfzkNF2 fGajoDwg5XssAV03dNAaYZRfo8DCJO45k3NIs9knb0iLe93QGy3KT55m6rm1D0jwObxP Dy9MVFNH6SAQx+W+9YPhAhlPWdaS8BHbKXp02icXKdPShonbXj0hzX0zya6yQUH8P7HR K2oi6noYExypYGX3GPT8HDkrDjXjpF9r3bQcAwD+vLIZc2mzCswWpjp6lpNw8EDhZcOm v2aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:organization:subject:cc:to:from; bh=JQShHiQMjE/YUtbhz+M8+ZuJWBQzjy/srrobRB+cwtk=; b=puTBn/SoKGfOFaldZd7r7Zh+tkmBZ1PyFb7/ex65ezNefaJ7tyKsKCNf7O9M9Kq59n e7h1ZSzS7A4uRylIspsF9QgVj+iIx++XsPxd8bQADxm2ksLgvUY8roRT+OHMnkp0KpUu T9xqC/5DHUr0Z3j2NKvQ6yKjrB1uKELAwj3seID8JxSvYVMUdmgRXzHaZGrKLYlbwSPt cZ5NeJkiNpP5Eo79rsRPQO7Flf8NYUtxUlUUhrNfflK163yDFDfHa2RFN8Gt3gIFC6bf wzxLNIrn5evmRR2jDBm+xnIyD/Z3dZ6dJrm6DgEdksKV0PtLvKCyG8VuSFVf34M2hOtb 75vA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d5si7115324eje.143.2021.10.21.09.38.33; Thu, 21 Oct 2021 09:38:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231971AbhJUQiH (ORCPT + 99 others); Thu, 21 Oct 2021 12:38:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231934AbhJUQiE (ORCPT ); Thu, 21 Oct 2021 12:38:04 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B39AEC061764; Thu, 21 Oct 2021 09:35:48 -0700 (PDT) Received: from localhost (unknown [IPv6:2804:14c:124:8a08::1002]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: krisman) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 8817B1F44CC0; Thu, 21 Oct 2021 17:35:46 +0100 (BST) From: Gabriel Krisman Bertazi To: "Eric W. Biederman" Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Linus Torvalds , Oleg Nesterov , Al Viro , Kees Cook , Thomas Gleixner , Peter Zijlstra , Andy Lutomirski Subject: Re: [PATCH 14/20] exit/syscall_user_dispatch: Send ordinary signals on failure Organization: Collabora References: <87y26nmwkb.fsf@disp2133> <20211020174406.17889-14-ebiederm@xmission.com> Date: Thu, 21 Oct 2021 13:35:40 -0300 In-Reply-To: <20211020174406.17889-14-ebiederm@xmission.com> (Eric W. Biederman's message of "Wed, 20 Oct 2021 12:44:00 -0500") Message-ID: <875ytq1gkj.fsf@collabora.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org "Eric W. Biederman" writes: > Use force_fatal_sig instead of calling do_exit directly. This ensures > the ordinary signal handling path gets invoked, core dumps as > appropriate get created, and for multi-threaded processes all of the > threads are terminated not just a single thread. > > When asked Gabriel Krisman Bertazi said [1]: >> ebiederm@xmission.com (Eric W. Biederman) asked: >> >> > Why does do_syscal_user_dispatch call do_exit(SIGSEGV) and >> > do_exit(SIGSYS) instead of force_sig(SIGSEGV) and force_sig(SIGSYS)? >> > >> > Looking at the code these cases are not expected to happen, so I would >> > be surprised if userspace depends on any particular behaviour on the >> > failure path so I think we can change this. >> >> Hi Eric, >> >> There is not really a good reason, and the use case that originated the >> feature doesn't rely on it. >> >> Unless I'm missing yet another problem and others correct me, I think >> it makes sense to change it as you described. >> >> > Is using do_exit in this way something you copied from seccomp? >> >> I'm not sure, its been a while, but I think it might be just that. The >> first prototype of SUD was implemented as a seccomp mode. > > If at some point it becomes interesting we could relax > "force_fatal_sig(SIGSEGV)" to instead say > "force_sig_fault(SIGSEGV, SEGV_MAPERR, sd->selector)". > > I avoid doing that in this patch to avoid making it possible > to catch currently uncatchable signals. > > Cc: Gabriel Krisman Bertazi > Cc: Thomas Gleixner > Cc: Peter Zijlstra > Cc: Andy Lutomirski > [1] https://lkml.kernel.org/r/87mtr6gdvi.fsf@collabora.com > Signed-off-by: "Eric W. Biederman" > --- > kernel/entry/syscall_user_dispatch.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > Hi Eric, Feel free to add: Reviewed-by: Gabriel Krisman Bertazi Thanks, -- Gabriel Krisman Bertazi