Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3885380pxj; Mon, 21 Jun 2021 08:39:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYexR5OXbnpSCAFKrfa0wjB0JgX6uW9BC2YbgGzCfrKY8VtchAdtqaqRgnp0pPPlplzpBQ X-Received: by 2002:a17:906:1c4e:: with SMTP id l14mr25321536ejg.172.1624289997883; Mon, 21 Jun 2021 08:39:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624289997; cv=none; d=google.com; s=arc-20160816; b=YUYInL7fFmn2HwAxpXld6jn9IaEeJgfJmONS2f2j5KTrv3OXH0UBp72+t1yxZCSLKK K+HChF8ey4QXyIQafOPxaXNOLGmehHndP475gMTiKNaL+UWwEgX2nl3mzaeRqXRokUa1 EUAUr/2SI0CEjZj6et3irNqZbkHtrcI8RCphAH21agleaGUCqUNUKe6ocfKvx0IbCVYs 93qFij2ySzcoo+7PVsUzPXXY3L5RZezCatYUEbNWIsrWNHYy8PEZiqGlw0mDl59YU3Oq JvF6geFysirrC13czRIWWkEv202yKFXMl75LQ5zeQfNOoXkJoDdZBemPT7qLBjlwN2E2 GTUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=R/gsr/Z80fSxEB0qmGqShvDUtlhm4ESakW3xcimnUEw=; b=OA00TYnzGnPYKBMa8U2BJZwKV7V/EoR6LzKHAWAsH7dGcZiGXGj/RKhvrRjLywFGd4 HLu2mUqT4PKqR4dTdBaPKcF/hkNT+Oo5Q0Cf1gP175DZxKgv5eJaMYLaFGMCVas1m/qB uVTID9d3jLFhE6fUn3z45Nh3YM3z9NTZyzH9AOuVMdZG2WdKB6mStCDyjVk2koGtWGUa Dm7+gqGRWFfJ+iNd7Luwp85gDDBwrF+Ucoef0fQfuwEz+Rk2MYVo5Sw92LDx1NJYYwI6 O88VYED0xlymtsIgHVc3PKaCp4sTs5bakublU1+bqfkU70G8Ka3PeagsGx5Qfox2uxIz 6deQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=a39nbPZC; 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 de6si11384583ejc.483.2021.06.21.08.39.35; Mon, 21 Jun 2021 08:39: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; dkim=pass header.i=@linux-foundation.org header.s=google header.b=a39nbPZC; 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 S230082AbhFUPkv (ORCPT + 99 others); Mon, 21 Jun 2021 11:40:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229789AbhFUPku (ORCPT ); Mon, 21 Jun 2021 11:40:50 -0400 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BA13C06175F for ; Mon, 21 Jun 2021 08:38:35 -0700 (PDT) Received: by mail-lj1-x22c.google.com with SMTP id c11so25848082ljd.6 for ; Mon, 21 Jun 2021 08:38:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=R/gsr/Z80fSxEB0qmGqShvDUtlhm4ESakW3xcimnUEw=; b=a39nbPZCP+nWMeIZ/x5qt0slwYnbNb/TvhmNaAml5kNvhs0i32rgF44OFGvy4ACZ5M SfNAyRTK1aJ1m7aW6sC2No3kMhETcLZ7kUjianICGGeVyVPSyizOAaXDDMbjMew6KcRK SAT8eIJUsUOJFoDNwA7oyYdllQrDrIWi08wng= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=R/gsr/Z80fSxEB0qmGqShvDUtlhm4ESakW3xcimnUEw=; b=D303n3PqZGZuwrpeUKw+hHPRRIvDvOWpQbeox4A5DlsTLMufd9mk+54GY59dXRjw74 IGy+DWsSXafbGThkC3g6clm0hQ91vzw+xj/plHmgQRanRxxPH1JYc/bSTrfdGZneP24D kDo8l88D0XOiYJSNp5kxyudQMG97GY8HVFJo+2jbH3CaQPZRQrAIgQAxqstYUgOC6Z2V 1u7TjWwy69Vuw4ItxyDxTxGVr6yE5snjc1/VIlXUYiZZ00zWPPu/3hmFyNJDEGABc+G1 Eu9snGSpQGZ1SrJMr4eK9Eb1YdBDEAqfdSzmHMKmzeZ4g/QW7stllYuDAvlmw3aMT22p Nbqg== X-Gm-Message-State: AOAM533us4QVQlwwwY8Dmvi5Kp2oJq9nLLZmP7pnRVzloN8YS/5Lw5hV 3yw4WEuxEgrIDM8utcAcCm3I4tnO2IReMcWj X-Received: by 2002:a2e:891a:: with SMTP id d26mr22144454lji.392.1624289911757; Mon, 21 Jun 2021 08:38:31 -0700 (PDT) Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com. [209.85.208.176]) by smtp.gmail.com with ESMTPSA id o16sm1491073lfb.98.2021.06.21.08.38.30 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Jun 2021 08:38:30 -0700 (PDT) Received: by mail-lj1-f176.google.com with SMTP id a21so693227ljj.1 for ; Mon, 21 Jun 2021 08:38:30 -0700 (PDT) X-Received: by 2002:a2e:b618:: with SMTP id r24mr22042332ljn.48.1624289909978; Mon, 21 Jun 2021 08:38:29 -0700 (PDT) MIME-Version: 1.0 References: <87pmwsytb3.fsf@disp2133> <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> In-Reply-To: From: Linus Torvalds Date: Mon, 21 Jun 2021 08:38:14 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Kernel stack read with PTRACE_EVENT_EXIT and io_uring threads To: Al Viro 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 21, 2021 at 6:55 AM 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... Hmm. Maybe the alternatives would all be worse. The current thing is clever, and shares the return path with the normal case. It's just also a bit surprising, in that a kernel thread normally must not return - with the magical exception of "if it had done a kernel_execve() at some point, then returning is magically the way you actually start user mode". So it all feels very special, and there's not even a comment about it. I think we only have two users of that thing (the very first 'init', and user-mode-helpr), So I guess it doesn't really matter. Linus