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=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 15565C2B9F4 for ; Tue, 22 Jun 2021 20:19:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EB97961352 for ; Tue, 22 Jun 2021 20:19:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229747AbhFVUVZ (ORCPT ); Tue, 22 Jun 2021 16:21:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229567AbhFVUVZ (ORCPT ); Tue, 22 Jun 2021 16:21:25 -0400 Received: from zeniv-ca.linux.org.uk (zeniv-ca.linux.org.uk [IPv6:2607:5300:60:148a::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0737DC061574; Tue, 22 Jun 2021 13:19:09 -0700 (PDT) Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1lvmrH-00BHkC-6N; Tue, 22 Jun 2021 20:18:55 +0000 Date: Tue, 22 Jun 2021 20:18:55 +0000 From: Al Viro To: Michael Schmitz Cc: Linus Torvalds , "Eric W. Biederman" , linux-arch , Jens Axboe , Oleg Nesterov , Linux Kernel Mailing List , Richard Henderson , Ivan Kokshaysky , Matt Turner , alpha , Geert Uytterhoeven , linux-m68k , Arnd Bergmann , Tejun Heo , Kees Cook , Tetsuo Handa , Andreas Schwab Subject: Re: Kernel stack read with PTRACE_EVENT_EXIT and io_uring threads Message-ID: References: <87eed4v2dc.fsf@disp2133> <5929e116-fa61-b211-342a-c706dcb834ca@gmail.com> <87fsxjorgs.fsf@disp2133> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-m68k@vger.kernel.org On Wed, Jun 23, 2021 at 08:04:11AM +1200, Michael Schmitz wrote: > All syscalls that _do_ save the switch stack are currently called through > wrappers which pull the syscall arguments out of the saved pt_regs on the > stack (pushing the switch stack after the SAVE_ALL saved stuff buries the > syscall arguments on the stack, see comment about m68k_clone(). We'd have to > push the switch stack _first_ when entering system_call to leave the syscall > arguments in place, but that will require further changes to the syscall > exit path (currently shared with the interrupt exit path). Not to mention > the register offset calculations in arch/m68k/kernel/ptrace.c, and perhaps a > few other dependencies that don't come to mind immediately. > > We have both pt_regs and switch_stack in uapi/asm/ptrace.h, but the ordering > of the two is only mentioned in a comment. Can we reorder them on the stack, > as long as we don't change the struct definitions proper? > > This will take a little more time to work out and test - certainly not > before the weekend. I'll send a corrected version of my debug patch before > that. This is insane, *especially* on m68k where you have the mess with different frame layouts and associated ->stkadj crap (see mangle_kernel_stack() for the (very) full barfbag).