Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5191138pxj; Tue, 22 Jun 2021 17:42:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxS5+Zd/lyi/PnMdftAwcoqNa7RJvC9U5YKvJcphWTBfGGj4xCDRKXDyp2ZM5vR8TaY7w6D X-Received: by 2002:a05:6638:379d:: with SMTP id w29mr6442592jal.2.1624408976263; Tue, 22 Jun 2021 17:42:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624408976; cv=none; d=google.com; s=arc-20160816; b=BBZl8bbwx4SmP2rNrc86P21WyNouzi9cLo+YeRnBScqSYiUiYkVGr9pGCtQdli197F qfNiDcCO28cdVtGoRE8qeG5vntI+jyTwf6Q/CrKvWlb7IvUWILUrciaz1PFJmIEOY8hT sG9DGpQCR+/k0CL480TiMXqRm9Anr2jvzYh7dA1L9fXC++KfpEzH8WTP/uecbKbvRe8h bhrhiUeJAZ5aZyzbxg++uHk3x6bKrXyS/zY/UZrJq6oR+R3eFC3hh6VNxK2tQGow2HB8 pD+/6yJGPNvegH+9ndtoyT5adyK3eF9s7IVrWLm4s9HcdULUGLar11VNiRUKdIFbHA3V EZog== 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=1pJi6stLtza5ZFdImIffUNgdJoHKsMjc09flZZ4qiAI=; b=hfmBZ+BiAKlOIoLpufgxCpXM6/+mJXPiWcDAHr2o+NRC6SzD3ZVvFpVQXSbIcAJkgF 2v89EkMMTI8ioCdxVUDpFlTC9lMgOtP6/VXXShiaqnqJRjxY9R5lWImEv0hTl+dEqBNo RbCbJN5Wa5UPgqYua2Al8biWkvpz17I2sA/J+Ois/x6FTgDatlRj0pliE8ElXDbx1nnS scGe9fLUh8IckzdM7uDIkETrMORPq381yWQPBu6gHjHRXnwHmyGBgoZBnDiL/zNcQZ3k MUNUk8mVf15AUBMotMXYB2WX8z2nu/H1vY5CVgNH1nT99ZlOwUkXvWHuO0V4TIYr/V7E jgBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=SFcCe3m1; 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 i13si19672147ilm.156.2021.06.22.17.42.43; Tue, 22 Jun 2021 17:42:56 -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=SFcCe3m1; 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 S229751AbhFWAo2 (ORCPT + 99 others); Tue, 22 Jun 2021 20:44:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229774AbhFWAo1 (ORCPT ); Tue, 22 Jun 2021 20:44:27 -0400 Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18696C061756 for ; Tue, 22 Jun 2021 17:42:10 -0700 (PDT) Received: by mail-lj1-x236.google.com with SMTP id c11so612225ljd.6 for ; Tue, 22 Jun 2021 17:42:10 -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=1pJi6stLtza5ZFdImIffUNgdJoHKsMjc09flZZ4qiAI=; b=SFcCe3m1FiAXHxPsSVxKjvrdNckQVrxdff+U4unr4V4zJzTMYaBEpSK9jjYtU7tMd6 D6+UsvBUdCLcIdv0JgGtdHlWRGtgBWAILphbvJEUZilovxO8PsYLDfvqyyYAEF0oFQuI Rb1F4OutZ2mQyaIxFkh4FOdwyNm9Ixhuqq2qU= 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=1pJi6stLtza5ZFdImIffUNgdJoHKsMjc09flZZ4qiAI=; b=dRNL4AxNjkyBzHXxcmxiExrh+m7Qs2T1MEj6gC7QJVUqZ+6Tsk067u1hAAfa3SSVq1 V0ssRu7vBCaB3yzfoeOmN/3JbMqkLzRbzJygcyZLuDL+hCnm9i/8WvLQCniTEzeNAVvL z9vcCMiNV4aMAfLhiqaQfP8kwzOv8ejsuBg/+UvGPdY0iRnjRw+fVcfp1/VuKwqCGZbm PmBWwzeTs0iOBa7JLTOF7eR1wakbi1pVKZsGTkVR2WULzEs5jsjmZy+waY08wUrqcIsu I/FOOZiIhWRFPCn6HiLLRWrRL4DJ2a0VH6mfo5WGRyAA05DnLJGkUjLvhkqn6naFsIcw tbBw== X-Gm-Message-State: AOAM530Lt5KrubIUfUTKABNnpnaj9nSVOAF+cIT35Ck9Yy+y6DzFN74u Xtja8RbC5U4qccECTrnUSSRuzhTgObPCmPYf X-Received: by 2002:a2e:870f:: with SMTP id m15mr3571929lji.290.1624408928328; Tue, 22 Jun 2021 17:42:08 -0700 (PDT) Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com. [209.85.167.41]) by smtp.gmail.com with ESMTPSA id g24sm2364101lfv.228.2021.06.22.17.42.07 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 22 Jun 2021 17:42:07 -0700 (PDT) Received: by mail-lf1-f41.google.com with SMTP id x24so1137892lfr.10 for ; Tue, 22 Jun 2021 17:42:07 -0700 (PDT) X-Received: by 2002:a05:6512:15a2:: with SMTP id bp34mr4693530lfb.40.1624408926925; Tue, 22 Jun 2021 17:42:06 -0700 (PDT) MIME-Version: 1.0 References: <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> <87a6njf0ia.fsf@disp2133> <87tulpbp19.fsf@disp2133> In-Reply-To: <87tulpbp19.fsf@disp2133> From: Linus Torvalds Date: Tue, 22 Jun 2021 17:41:51 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Kernel stack read with PTRACE_EVENT_EXIT and io_uring threads To: "Eric W. Biederman" Cc: Al Viro , 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 Tue, Jun 22, 2021 at 1:53 PM Eric W. Biederman wrote: > > Playing with it some more I think I have everything working working > except for PTRACE_EVENT_SECCOMP (which can stay ptrace_event) and > group_exit(2). > > Basically in exit sending yourself a signal and then calling do_exit > from the signal handler is not unreasonable, as exit is an ordinary > system call. Ok, this is a bit odd, but I do like the concept of just making ptrace_event just post a signal, and have all ptrace things always be handled at signal time (or the special system call entry/exit, which is fine too). > For purposes of discussion this is my current draft implementation. I didn't check what is so different about exit_group() that you left that as an exercise for the reader, but if that ends up then removing the whole "wait synchromously for ptrace" cases for good I don't _hate_ this. It's a bit odd, but it would be really nice to limit where ptrace picks up data. We do end up doing that stuff in "get_signal()", and that means that we have the interaction with io_uring calling it directly, but it's at least not a new thing. Linus