Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4078156pxj; Tue, 15 Jun 2021 15:05:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRgH2xDofVlUKyoSfugIdoEK0UoZXxaIfYeyCJuIE2c0E4vewqDVoEP6q9tn0FpRVwUtXf X-Received: by 2002:a50:9d8d:: with SMTP id w13mr367911ede.94.1623794708481; Tue, 15 Jun 2021 15:05:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623794708; cv=none; d=google.com; s=arc-20160816; b=MgwXaaivSFAz3f1ieI7huIRj+/jj+xYQZkKsVF7oHoBLlO8ALpiUy64t/av7DAspWI cMcq6zJMLbR5eoIUrivXLSUmaX58E1IAfAxEXUJcG5G7OCP4ZewkOjOmnFlY0Zrd1PcQ nAIlcd1H1Oz3OfNpvn0HWeWBKz/AVjrs/JWzJiF1FRFgKoirYxrgiiYYIei0OVvAbKRn UpCm1mhGRn0QtiNFHhtl8LlMoBHFPYcw/hajirdpL8x7YC1nAedet4cf8j8ttkRd1xPU 1arluq9A/di8vTQZ26I0bm2LyvSm/IqwXTmxHLYP/1w2GznoB4ir5IuVeoLGREVmMuBp YtXw== 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=hoQkSnA6XRE+cBEiih5+9r6Hum8C///uGbJ9Kw2ELY0=; b=Htt45gsdPtipZSDuX1h6lmmAH274YNIJfNSQgvUskI+SKSmE3CwS/UW8Dji5E+OyvD 16dgdE9+JcNyefFWN3MxEWyEIbsFx2MNMiHJhXMUha83ZiZ6rhFPhRCKdZIrn/LCKhyU iZg4oI/Ckp9HewZKyu3Gx9lKNZ4PMsbTOzqOm2ijCThdnTgRq5EnMG9tuO6TWSev2noz F7r6X+jQneAA0nM/eHGnKtdZlozUAe+oqZ1pXQ2UNYmIS4AVG0rcAxRMN/W0XOb9bDfW 9tpZk5hzQ046ZFuB5t+pTScQgILiw4BnS1S0x+t9DuBoGa43i9159+zTDKoFGqNf2FSq UNUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="g/G9Q+2q"; 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 g21si190904ejb.437.2021.06.15.15.04.36; Tue, 15 Jun 2021 15:05:08 -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="g/G9Q+2q"; 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 S229760AbhFOWFX (ORCPT + 99 others); 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-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