Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4211663pxj; Mon, 21 Jun 2021 16:38:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvrIPMCd8mzMvMaZL8gXl3tYKQC5lDUG7YjzQjI6RtJfgIQmFOLeq8I+hwAnf519SNCb2O X-Received: by 2002:aa7:d7d3:: with SMTP id e19mr1071547eds.46.1624318724024; Mon, 21 Jun 2021 16:38:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624318724; cv=none; d=google.com; s=arc-20160816; b=BrqfipxU86hLRflyPA2MqhS5eLvAKdlMu/gZOQUBeO7mxdzzH3irbkuiDVyIwJeLn5 +FwRLAIh24rVItQgf4QaIzIll5YDIABa0m+TMNgVBJ3EniacefbhMfbfKI7/aIX9NSfj 5UzPC/o1bSEdfIl9hVw+sdfFNtsURmhryUdnXZakBTLzMHYYCoUpzgNnaZqyO5oHAylE PN/AdXhWaUfWKO7oBDNegK+LhB7Q2bz5NRH1DchuRnoFz8DwAleAL5jvs9a9xLQZJKXy S2gw0zqfKJo5/PBH75oBzInWKTqV0YJ9b0MUaeZWYCODf63mjBlmwDO5khOYo0H/I8of w+SQ== 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=fqBMFMkh+3vsj4PE2zy4sOG9Di6zkfuPgmZeKyRMggk=; b=P/isdKxb7HX/bpg03kUiVFzERWlTqzGZ+AbgE7X2U3bnuOh84gT1Yygrex36iH+2UU dUlRgjpnHRmrJa2oflvJkgyA9Q3c4fC+1PLQtF+1Oj9JHVCbgbVXZTHX98gEV4nDelSm 0KVuEw12TcH46KI/ltlzOCr+zas/1r7+1Jh0sYT/C6p5rM7XIjQoY5S+FvhDH6NScvZ6 fSTzEmudH9YnZGhCzV9ZySHBfmLnqJCZVYz4aOo2KiyMrh1QlhaHFPkb6WTu5dWNIVd3 mA4ecEAoIgH9ly1jzsvMbkEpAwh5VaayThxNMS3tNz9ay/ssUPW7/R1nWvXGEU6N0Sr8 9Lkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=FwTzGNcp; 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 bt12si11867124ejb.669.2021.06.21.16.38.21; Mon, 21 Jun 2021 16:38:44 -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=FwTzGNcp; 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 S232014AbhFUXjL (ORCPT + 99 others); Mon, 21 Jun 2021 19:39:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232064AbhFUXjH (ORCPT ); Mon, 21 Jun 2021 19:39:07 -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 0D1C9C061756 for ; Mon, 21 Jun 2021 16:36:52 -0700 (PDT) Received: by mail-lj1-x22c.google.com with SMTP id z22so27514641ljh.8 for ; Mon, 21 Jun 2021 16:36:51 -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=fqBMFMkh+3vsj4PE2zy4sOG9Di6zkfuPgmZeKyRMggk=; b=FwTzGNcpDtlrI1kY0RIGO3zETGbXVETw5XVSJFPsLGj6Xz/SJV56ObDVCGf2pDuQ1Z igDUi27LyzA/lOjip7sVylirPYT+bZ/hF+sKh406iS7GyB+Vq1L8K8GDXIUSy1RHLXYZ 859pKuXlceGLPjaK41xP26kUTIY685CWI4qnY= 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=fqBMFMkh+3vsj4PE2zy4sOG9Di6zkfuPgmZeKyRMggk=; b=TBh78ux4wJm/6qOfEPo1/WGChxFd9Mvuyhooe/buanL8Sr4qCHZVJ9a0ybhkXnFbKM axJLHTsuGJp5Wb8tzXxXwV9XZnEzOiUJX6PO8lpJOQEGnqbaYL/xYsnL/RDdWoe4yQ47 Q/F+HNEztWxSuEalCWqCG1b4fxZLPOxVmHZDvGAP47VsryzM5YN1L8GeIqU3sL/ZO2St XjCQCdxAsB53vFNy45MTWiRAbgHZwHuAnMg84gomcfoai7AwJwYF4fb2fOI1WMZSAjuA BPF/g2t1WS/c57Dc6aOvSSsefbfKDT7sHzIRl0FlIZmIgCVWJhb0UX38aU7ltl9I7y4Y TmMw== X-Gm-Message-State: AOAM531wdqo/dwnwPRk3cfm9/jwkBPqDbMcUgbiQbnSlWkgXuxx9/sJa XcY+Lc3bOFK3LMb74a24zGynYWZbLIwnaoboV14= X-Received: by 2002:a05:651c:33c:: with SMTP id b28mr555295ljp.489.1624318610258; Mon, 21 Jun 2021 16:36:50 -0700 (PDT) Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com. [209.85.208.175]) by smtp.gmail.com with ESMTPSA id b13sm789782lfv.89.2021.06.21.16.36.49 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Jun 2021 16:36:49 -0700 (PDT) Received: by mail-lj1-f175.google.com with SMTP id r16so27543217ljk.9 for ; Mon, 21 Jun 2021 16:36:49 -0700 (PDT) X-Received: by 2002:a2e:22c4:: with SMTP id i187mr544552lji.251.1624318609289; Mon, 21 Jun 2021 16:36:49 -0700 (PDT) MIME-Version: 1.0 References: <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 16:36:33 -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 , Tetsuo Handa 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 4:23 PM Al Viro wrote: > > How would it help e.g. oopsen on the way out of timer interrupts? > IMO we simply shouldn't allow ptrace access if the tracee is in that kind > of state, on any architecture... Yeah no, we can't do the "wait for ptrace" when the exit is due to an oops. Although honestly, we have other cases like that where do_exit() isn't 100% robust if you kill something in an interrupt. Like all the locks it leaves locked etc. So do_exit() from a timer interrupt is going to cause problems regardless. I agree it's probably a good idea to try to avoid causing even more with the odd ptrace thing, but I don't think ptrace_event is some really "fundamental" problem at that point - it's just one detail among many many. So I was more thinking of the debug patch for m68k to catch all the _regular_ cases, and all the other random cases of ptrace_event() or ptrace_notify(). Although maybe we've really caught them all. The exit case was clearly missing, and the thread fork case was scrogged. There are patches for the known problems. The patches I really don't like are the verification ones to find any unknown ones.. Linus