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=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 1D756C48BE8 for ; Tue, 15 Jun 2021 22:03:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E8D10610EA for ; Tue, 15 Jun 2021 22:03:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230045AbhFOWFX (ORCPT ); Tue, 15 Jun 2021 18:05:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229868AbhFOWFW (ORCPT ); Tue, 15 Jun 2021 18:05:22 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6572C06175F for ; Tue, 15 Jun 2021 15:03:16 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id i13so683697lfc.7 for ; Tue, 15 Jun 2021 15:03:16 -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=hoQkSnA6XRE+cBEiih5+9r6Hum8C///uGbJ9Kw2ELY0=; b=g/G9Q+2q40OzWZg7EFc4fouy9Igftb3L4Bk0mo8X1bGB4ay1i3Hzx7gDAXF7I9BNha YY8Tb63PTEjuFPLmasFyOxKTcxDVfcgS07QY91o7V0JoZ5Vat/JBFwVsnn2A0xh999aU tK9zqa7kM5VekQfnZejDxEUyMFWO9psHM4igQ= 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=hoQkSnA6XRE+cBEiih5+9r6Hum8C///uGbJ9Kw2ELY0=; b=qC4DVUp2BjpeaU71kbo4wnWe7+1Oep1psshCPL36m7aiqJN5wiFkLONEEgZh4ErCgr qYQfPLnqTKtsM/cAQckaKY9RLcZgCK0TMuZUbu6NAr6lSkwLNuSEEzSyynQuIlIwVTtA /fAwt+XhyyEeWouqvh2i0ce2fl79Mf2zC1zKDiHItI1KmZhfrWa2Ai/UusMfNnCOKw1C HLK6D7rXyHGJKnMD68bOHPQytuSn+8nOoUcdEMT2Sg4r7DGGMbSCG+79ae5NEof7m7y2 PcDkhVAY1y8GvsjTGt1HdDKph0GGAad+iJfQrh4CKQqREAUuJO5njQX8x2lf7ZheRriJ l4EQ== X-Gm-Message-State: AOAM531GOXNbKM2Xrd1/j/hFWrxrxQun/0d1dQk6loBZ+gcbXMxZgzAY ZhwaXbRHagRC8co8uLlck6zGm/67iagJKY1h X-Google-Smtp-Source: ABdhPJxdkONpcJ3W0TK4VIWqbr5MYjiJM7Fj64ZmyN/FcA6kbBHRfhio5DE+Bdtd6CW0O40qBQM2kA== X-Received: by 2002:a05:6512:c23:: with SMTP id z35mr1067176lfu.549.1623794594806; Tue, 15 Jun 2021 15:03:14 -0700 (PDT) Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com. [209.85.208.171]) by smtp.gmail.com with ESMTPSA id m8sm30982lfh.198.2021.06.15.15.03.13 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 15 Jun 2021 15:03:14 -0700 (PDT) Received: by mail-lj1-f171.google.com with SMTP id 131so825842ljj.3 for ; Tue, 15 Jun 2021 15:03:13 -0700 (PDT) X-Received: by 2002:a2e:9644:: with SMTP id z4mr1520639ljh.507.1623794593506; Tue, 15 Jun 2021 15:03:13 -0700 (PDT) MIME-Version: 1.0 References: <87sg1p30a1.fsf@disp2133> <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> <87zgvqor7d.fsf_-_@disp2133> In-Reply-To: <87zgvqor7d.fsf_-_@disp2133> From: Linus Torvalds Date: Tue, 15 Jun 2021 15:02:57 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] alpha: Add extra switch_stack frames in exit, exec, and kernel threads To: "Eric W. Biederman" Cc: Michael Schmitz , linux-arch , Jens Axboe , Oleg Nesterov , Al Viro , 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 Tue, Jun 15, 2021 at 12:36 PM Eric W. Biederman wrote: > > I looked and there nothing I can do that is not arch specific, so > whack the moles with a minimal backportable fix. > > This change survives boot testing on qemu-system-alpha. So as mentioned in the other thread, I think this patch is exactly right. However, the need for this part > @@ -785,6 +785,7 @@ ret_from_kernel_thread: > mov $9, $27 > mov $10, $16 > jsr $26, ($9) > + lda $sp, SWITCH_STACK_SIZE($sp) > br $31, ret_to_user > .end ret_from_kernel_thread obviously eluded me in my "how about something like this", and I had to really try to figure out why we'd ever return. Which is why I came to that "oooh - kernel_execve()" realization. It might be good to comment on that somewhere. And if you can think of some other case, that should be mentioned too. Anyway, thanks for looking into this odd case. And if you have a test-case for this all, it really would be a good thing. Yes, it should only affect a couple of odd-ball architectures, but still... It would also be good to hear that you actually did verify the behavior of this patch wrt that ptrace-of-io-worker-threads case.. Linus Linus