From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from vmicros1.altlinux.org (vmicros1.altlinux.org [194.107.17.57]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 06AE4386571 for ; Wed, 22 Jul 2026 07:10:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.107.17.57 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784704232; cv=none; b=Ox9fhQ7u7qb5QzKETxLaIxTnTR4q0sicvjTARFwYryOaj6DjNjTjcs25zTrMCrpsII8gVkr0t7TDmTVkZw+uV0I7Yrvfa9Ssdt5en9amymyAVE5MI4C7OsHkx9WQ8OPML24nkMWuIqC60YuOp4AnIhQt9f73InYqT+ZRBUl1pe8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784704232; c=relaxed/simple; bh=ZDPRKAFgE+IRzFeZkPUvwvYxLF/gLPaLhWu9rWXXVYs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=sEL/QM7TToUw4qG2MQdLUaiI6FO4dRr5AJYR15rl+Mpv/KlegJ+CkXj807rI12zxMkmKLdCAdJgwQOFd+mujDd96ZfJ3H7bQWGoTruZdTpmDXIJ8ffTSq5z2osjDrVpomM+MtCuTrCekqC8dR42PeqsVPPcMf5RhP2ThwwE5l0w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=strace.io; spf=pass smtp.mailfrom=altlinux.org; arc=none smtp.client-ip=194.107.17.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=strace.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=altlinux.org Received: from mua.local.altlinux.org (mua.local.altlinux.org [192.168.1.14]) by vmicros1.altlinux.org (Postfix) with ESMTP id BCF1772C8CC; Wed, 22 Jul 2026 10:01:55 +0300 (MSK) Received: by mua.local.altlinux.org (Postfix, from userid 508) id AC7427CCB3A; Wed, 22 Jul 2026 10:01:55 +0300 (IDT) Date: Wed, 22 Jul 2026 10:01:55 +0300 From: "Dmitry V. Levin" To: Mukesh Kumar Chaurasiya Cc: maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com, chleroy@kernel.org, ryabinin.a.a@gmail.com, glider@google.com, andreyknvl@gmail.com, dvyukov@google.com, vincenzo.frascino@arm.com, oleg@redhat.com, kees@kernel.org, luto@amacapital.net, wad@chromium.org, mchauras@linux.ibm.com, thuth@redhat.com, ruanjinjie@huawei.com, sshegde@linux.ibm.com, akpm@linux-foundation.org, charlie@rivosinc.com, deller@gmx.de, macro@orcam.me.uk, segher@kernel.crashing.org, peterz@infradead.org, bigeasy@linutronix.de, namcao@linutronix.de, tglx@linutronix.de, mark.barnett@arm.com, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com Subject: Re: [PATCH v4 5/8] powerpc: add exit_flags field in pt_regs Message-ID: <20260722070155.GA11808@strace.io> References: <20260123073916.956498-1-mkchauras@linux.ibm.com> <20260123073916.956498-6-mkchauras@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260123073916.956498-6-mkchauras@linux.ibm.com> On Fri, Jan 23, 2026 at 01:09:13PM +0530, Mukesh Kumar Chaurasiya wrote: > From: Mukesh Kumar Chaurasiya > > Add a new field `exit_flags` in the pt_regs structure. This field will hold > the flags set during interrupt or syscall execution that are required during > exit to user mode. Apparently, this change breaks PTRACE_GETREGS as the latter has no means to communicate the size of struct pt_regs being written to userspace. As result, the kernel with this patch will write to userpsace 32 more bytes than before, and unless the userspace is re-compiled with the latest ptrace.h, 32 bytes of userspace memory after struct pt_regs will be overwritten. This issue was detected by strace test suite, specifically, the test that checks whether the actual number of bytes written by ptrace(PTRACE_GETREGS) matches sizeof(struct pt_regs), and that test failed with runtime version v7.1 and headers version v7.2-rc1. > diff --git a/arch/powerpc/include/uapi/asm/ptrace.h b/arch/powerpc/include/uapi/asm/ptrace.h > index 01e630149d48..a393b7f2760a 100644 > --- a/arch/powerpc/include/uapi/asm/ptrace.h > +++ b/arch/powerpc/include/uapi/asm/ptrace.h > @@ -55,6 +55,8 @@ struct pt_regs > unsigned long dar; /* Fault registers */ > unsigned long dsisr; /* on 4xx/Book-E used for ESR */ > unsigned long result; /* Result of a system call */ > + unsigned long exit_flags; /* System call exit flags */ > + unsigned long __pt_regs_pad[3]; /* Maintain 16 byte interrupt stack alignment */ > }; > > #endif /* __ASSEMBLER__ */ -- ldv