Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4036552pxj; Mon, 21 Jun 2021 12:00:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8F9hhzISGgAok5wiLAIJNfH/ohg2r19F2fW3AgTSXFr/ywyUSPSPP8g5umIZOQwF0vLbu X-Received: by 2002:a05:6e02:13e4:: with SMTP id w4mr14631985ilj.127.1624302033416; Mon, 21 Jun 2021 12:00:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624302033; cv=none; d=google.com; s=arc-20160816; b=0G3IPCI4AXlaey8BC1WHCX07JFz68C0QMrpJbI+WERQJEGoyBtXBnwWw5Fr5+2CJf1 YLf0FAbuPkZPirbBPVbR6mAlzDjk+HRiGSo5lwpE4B4vs4P16YrOlnL+uhj0HSGWGEEg vAcePuPZFfjIn/uPMugadkg9YNECqbX+VdiyEDooh3FkKFcrID+QnPBCiUmInrQm2yDE kouKh6TxcrZ3wRnUtSFACV2rWrcTx2E6TE8h3nbXwdoDtZukmvLtlnW2o0yX5n+gQlDJ PPkjgBrCHUIik100MsIXHUb7hNpTA5l38pJA4TeOKTnhMBoH1clF8mivl+vMNJkabBE5 /Ijw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=e1VUS7T8g63X883PcRYqPMIYLtVBLsiSW+rn2exUogs=; b=0idw2SpJ3qT8eXmzK/cC/XKcMIQyeLlUDz+bdxT1q2AYJZFyJ0IgIumD/ajyx4QKwL ZxRWS85PXpEdrM6UhHylbz9yvlhoM4MMEeIV7ukNV1SVfzoTObL488RIo64dNjw6DcQA bTlVoEx1i4jCqdWV5NbkT/mRu97GCPf/QVbX2CX6slzNH9ktQb4x41DZFIDEBAK3YHFg zyFeAtewGd+ooHpx8RdsZ0h06wi3Y3KSY/FdkpwjxAHU4Xa2EpNd4ZYaEBe5ggtVNnhn 7IUoIXtsAXfr2hvYibncC8zIxGYSuJDiVMrDH0gPwULETM11aKW4u7jh9h28UVCaAF6v Pulg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g7si19668701jaq.75.2021.06.21.12.00.16; Mon, 21 Jun 2021 12:00:33 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231268AbhFUTB3 (ORCPT + 99 others); Mon, 21 Jun 2021 15:01:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230189AbhFUTB3 (ORCPT ); Mon, 21 Jun 2021 15:01:29 -0400 Received: from zeniv-ca.linux.org.uk (zeniv-ca.linux.org.uk [IPv6:2607:5300:60:148a::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB6D2C061574; Mon, 21 Jun 2021 11:59:14 -0700 (PDT) Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1lvP8P-00AvlT-GG; Mon, 21 Jun 2021 18:59:01 +0000 Date: Mon, 21 Jun 2021 18:59:01 +0000 From: Al Viro To: Linus Torvalds Cc: "Eric W. Biederman" , Michael Schmitz , linux-arch , Jens Axboe , Oleg Nesterov , Linux Kernel Mailing List , Richard Henderson , Ivan Kokshaysky , Matt Turner , alpha , Geert Uytterhoeven , linux-m68k , Arnd Bergmann , Ley Foon Tan , Tejun Heo , Kees Cook Subject: Re: Kernel stack read with PTRACE_EVENT_EXIT and io_uring threads Message-ID: References: <87sg1lwhvm.fsf@disp2133> <6e47eff8-d0a4-8390-1222-e975bfbf3a65@gmail.com> <924ec53c-2fd9-2e1c-bbb1-3fda49809be4@gmail.com> <87eed4v2dc.fsf@disp2133> <5929e116-fa61-b211-342a-c706dcb834ca@gmail.com> <87fsxjorgs.fsf@disp2133> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 21, 2021 at 01:54:56PM +0000, Al Viro wrote: > On Tue, Jun 15, 2021 at 02:58:12PM -0700, Linus Torvalds wrote: > > > And I think our horrible "kernel threads return to user space when > > done" is absolutely horrifically nasty. Maybe of the clever sort, but > > mostly of the historical horror sort. > > How would you prefer to handle that, then? Separate magical path from > kernel_execve() to switch to userland? We used to have something of > that sort, and that had been a real horror... > > As it is, it's "kernel thread is spawned at the point similar to > ret_from_fork(), runs the payload (which almost never returns) and > then proceeds out to userland, same way fork(2) would've done." > That way kernel_execve() doesn't have to do anything magical. > > Al, digging through the old notes and current call graph... There's a large mess around do_exit() - we have a bunch of callers all over arch/*; if nothing else, I very much doubt that really want to let tracer play with a thread in the middle of die_if_kernel() or similar. We sure as hell do not want to arrange for anything on the kernel stack in such situations, no matter what's done in exit(2)...