From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53449C4743C for ; Mon, 21 Jun 2021 15:38:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2ACAD61042 for ; Mon, 21 Jun 2021 15:38:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229747AbhFUPkt (ORCPT ); Mon, 21 Jun 2021 11:40:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229789AbhFUPkt (ORCPT ); Mon, 21 Jun 2021 11:40:49 -0400 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC75DC061756 for ; Mon, 21 Jun 2021 08:38:33 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id f30so30995005lfj.1 for ; Mon, 21 Jun 2021 08:38:33 -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=QE6FRn6IYztnmRXou6zY9Xgec81S7bicpJbFauqImI72o/2B5MhBM3ZrkukMP+EIKs DKtb6HrdjpG+lTtfFhAdcJQKqIR1cRDq5ue1TevnmC2mNziOcEW1gbDkj1NVIx5wVLq6 epO+ah/xbt2zfXMyhE8Q2JC12bD0SvUERV07eLDDc+dqIT+aIo/NGNKqO74hHgtPrgN5 H7Ergzwfx/bDNC5QqswTTbXXZKhteqLYiqZo+d8Oz01pTi/c4TjRYU81OnCpDlF2lBeY SIrdkkc3nHGIml9vmg4kjvPjt4bNv995LyDieyLyXT6uemOhxl1A1T50vBQAyVGXMkMc 4K/g== X-Gm-Message-State: AOAM532fAtycG7BSLxCzp3ln3b8tbnGvkY9beb6kUCgkdWrOGih9IebQ 94nwA9MFUFZlq7EWqEzBcwx0OwIFhyZvaOzV X-Google-Smtp-Source: ABdhPJzI5Y1xiE7bMdfjJQAkJE9KUi0upLJI7D25NdzkC5LhuKMQpaYrmDRpXQJjzjLblQhYU+NNIw== X-Received: by 2002:a19:c4b:: with SMTP id 72mr14706126lfm.15.1624289911962; Mon, 21 Jun 2021 08:38:31 -0700 (PDT) Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com. [209.85.208.181]) by smtp.gmail.com with ESMTPSA id v1sm1908877lfq.284.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-f181.google.com with SMTP id k8so2807620ljk.7 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-m68k@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