Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4053753pxj; Mon, 21 Jun 2021 12:24:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7+rt1DZIGfxNeZR+9dwGQul3J2yMjrYRa1LDhi+0RqfW3xgCHSQogw5HvrWq/6v574Tzc X-Received: by 2002:a17:906:15d5:: with SMTP id l21mr24492543ejd.429.1624303458252; Mon, 21 Jun 2021 12:24:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624303458; cv=none; d=google.com; s=arc-20160816; b=Dz4HC5hfNiUPOcWdsTLmhCIqkRAhZ3M2qo66e4HxduyhjC8e21/V9OtZQh8IQREYU2 0t38iJrqUxuO1S/Ev18+AWSo4Yp+G7UCuJ8EkwAyRmOOQApFs5wDJgBmiUywnKXRsTF8 FULQ+JRPbgqD52238kyT6zjj7beTZ2BnjbcFNCeOf0qIAeZKnokSa4QuEFjNgveIQxwh 13sivZM86Csb+d+TH8gA2r+PsJ/YZWZgMreZ3vZJhT0xGGGzCKLOvsMqACFHzF4st+EQ ISoJM7JTpcMblWiXY/5LhdeEexScK+M7ZZT9agyoVpHJI4pBOHqfA+GjGN13iwXXRsjj 4Ulw== 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=UWwkKMPjf9VHxhA/g9kybS/n5fjzQ1lCr96tYKbsWb4=; b=ssHmb5wdpKb4rXCgFrg3Qxwf/VNN2O1Q79czJjwYb2UDKCHRzWkpQZkbrW9efMWNCE OSJlc8XiZrPzBfuk/JQTbK4gdW/o8bbHAZTRON4MtEU6+QXMdVIXpf3wUiR0RA27U0RG ITByJqw2JxzUFg8TSU/rVMBK+m4uB3G7KO3ARnQk22J84KgXP1fvdhNblCe/UArxafUF zik0MVpp2tsfUgYaEx4ZgP/xqHhmoVWmxi6jWj4lx/gebPVaIY07rA0vEdRZc56DCJD4 3SFPrIRCQmkhbxDuqgKM5pH3u78jelxmCCJTDDcXQcFYDng8jIfQge/YJ37n/9aC/BAj I0/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="OWY9B/m6"; 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 z13si7673895ejl.264.2021.06.21.12.23.54; Mon, 21 Jun 2021 12:24:18 -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="OWY9B/m6"; 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 S231151AbhFUTYp (ORCPT + 99 others); Mon, 21 Jun 2021 15:24:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230170AbhFUTYm (ORCPT ); Mon, 21 Jun 2021 15:24:42 -0400 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E01A7C061756 for ; Mon, 21 Jun 2021 12:22:25 -0700 (PDT) Received: by mail-lj1-x22b.google.com with SMTP id u20so7068289ljl.13 for ; Mon, 21 Jun 2021 12:22:25 -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=UWwkKMPjf9VHxhA/g9kybS/n5fjzQ1lCr96tYKbsWb4=; b=OWY9B/m6/Mxc4KE4rlqUmS8up4KOodyzZabkrCDG8PZQO7BOG22XJGJUOTvpEvWYz8 5PgA6ftqBTHNUdu8z3XpFvF/2p6ZVtR21Nv8hDF/pcwb1wKzuer3Yr3ZrfLh8V5mdy+M eKJPw1pfo8vN7QoUHB7TWIVl4z9STd1R+XvlA= 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=UWwkKMPjf9VHxhA/g9kybS/n5fjzQ1lCr96tYKbsWb4=; b=C7VHhM5UB27QQxYssd9FGPELsUN4VIDw+lx2vo7/mJeSuPjRRfLtcfBN4Kvg0aTb5/ HEx2TsT3pr1ymVHKcFKdQEdseaPKyIqOHQ9N7Onni9Cwsia5FS8qbDw8mzaKhRR7fjGQ cyk5LRq/9mbADkjs888vmbKSdjvFw8ytNcL4Vx5DRWguj8Fn1jao+ItxxKyu+SlntEZR 5R9EIijDDWbJ1kxYtIpEVUylQ8UKSU1eGAApuVGK2DySzaEHMrYup4EVSB+5yqNPYW43 igbP0sE62xZhelLuTImSxu9mLu7UAZR5Yo9ecRAPOvoJ+VWjxqnybrQqFLxwVd79eAt+ el6w== X-Gm-Message-State: AOAM530FNV1vXuyEmqjTw6d1D8prkBQG6bQKO15aaH6yG9+HMhHk03QK hQO8YhZWxUEyHX31N/y3iTsUdyAUk6HNGEzQn0s= X-Received: by 2002:a05:651c:323:: with SMTP id b3mr23463648ljp.139.1624303344040; Mon, 21 Jun 2021 12:22:24 -0700 (PDT) Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com. [209.85.208.179]) by smtp.gmail.com with ESMTPSA id w6sm1889397ljh.23.2021.06.21.12.22.22 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Jun 2021 12:22:22 -0700 (PDT) Received: by mail-lj1-f179.google.com with SMTP id u20so7068200ljl.13 for ; Mon, 21 Jun 2021 12:22:22 -0700 (PDT) X-Received: by 2002:a2e:9644:: with SMTP id z4mr23025776ljh.507.1624303342282; Mon, 21 Jun 2021 12:22:22 -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> In-Reply-To: From: Linus Torvalds Date: Mon, 21 Jun 2021 12:22:06 -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-kernel@vger.kernel.org On Mon, Jun 21, 2021 at 11:59 AM Al Viro wrote: > > There's a large mess around do_exit() - we have a bunch of > callers all over arch/*; if nothing else, I very much doubt that really > want to let tracer play with a thread in the middle of die_if_kernel() > or similar. Right you are. I'm really beginning to hate ptrace_{event,notify}() and those PTRACE_EVENT_xyz things. I don't even know what uses them, honestly. How very annoying. I guess it's easy enough (famous last words) to move the ptrace_event() call out of do_exit() and into the actual exit/exit_group system calls, and the signal handling path. The paths that actually have proper pt_regs. Looks like sys_exit() and do_group_exit() would be the two places to do it (do_group_exit() would handle the signal case and sys_group_exit()). Linus