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=-10.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 3BF9BC433DB for ; Sat, 27 Mar 2021 13:03:42 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B58B161971 for ; Sat, 27 Mar 2021 13:03:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B58B161971 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ez8hNBQ2fxv3tZeHGfHyMlowuYBpzREKhMODZlCDR3s=; b=LC1SygRrXX16jhCcgAI68/885 ZmE02q1bRa1Jc8pn1FUkJkRl70uRw8ymppM6iu2syatCCMb1NnH/urvNuTqmBNrC/AFvyl5NpbMjq qryCieadOG1bYug1YskSHes0dzhYRIfu9/IqG4v/GGbh+r9VWajZdYYovvqW6kzH6fmODTHpgCtrG ydX6YjQxDdwTlC94TOG1L/GGDqvtU/+LbHPNPewy3MPfQZTJqLLc37UUxGoJzi2da+Y2msFnromT2 srkdFJOuMvqfh4lsIc5bM6mX67X1qY12oCzpgAqrUgRDIibgost4+3URG0ZKEDe1WvY5pFzUKVwWI wsO+dfrVA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lQ8Z2-0057ZN-BI; Sat, 27 Mar 2021 13:01:16 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lQ8Yv-0057Z3-Tu for linux-arm-kernel@lists.infradead.org; Sat, 27 Mar 2021 13:01:12 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 75A6561971; Sat, 27 Mar 2021 13:01:03 +0000 (UTC) Date: Sat, 27 Mar 2021 13:01:01 +0000 From: Catalin Marinas To: Andrei Vagin Cc: Will Deacon , Oleg Nesterov , linux-arm-kernel@lists.infradead.org, LKML , Dave Martin , Keno Fischer Subject: Re: [PATCH 1/4] arm64: expose orig_x0 in the user_pt_regs structure Message-ID: <20210327130100.GA31076@arm.com> References: <20210322225053.428615-1-avagin@gmail.com> <20210322225053.428615-2-avagin@gmail.com> <20210326182839.GE5126@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210327_130110_224224_D49D1C0F X-CRM114-Status: GOOD ( 16.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Mar 26, 2021 at 05:35:19PM -0700, Andrei Vagin wrote: > On Fri, Mar 26, 2021 at 11:28 AM Catalin Marinas > wrote: > > > > On Mon, Mar 22, 2021 at 03:50:50PM -0700, Andrei Vagin wrote: > > > diff --git a/arch/arm64/include/uapi/asm/ptrace.h b/arch/arm64/include/uapi/asm/ptrace.h > > > index 758ae984ff97..3c118c5b0893 100644 > > > --- a/arch/arm64/include/uapi/asm/ptrace.h > > > +++ b/arch/arm64/include/uapi/asm/ptrace.h > > > @@ -90,6 +90,7 @@ struct user_pt_regs { > > > __u64 sp; > > > __u64 pc; > > > __u64 pstate; > > > + __u64 orig_x0; > > > }; > > > > That's a UAPI change, likely to go wrong. For example, a > > ptrace(PTRACE_GETREGSET, pid, REGSET_GPR, data) would write past the end > > of an old struct user_pt_regs in the debugger. > > ptrace(PTRACE_GETREGSET, ...) receives iovec: > ptrace(PTRACE_GETREGSET, pid, NT_PRSTATUS, &iov) > > iov contains a pointer to a buffer and its size and the kernel fills > only the part that fits the buffer. > I think this interface was invented to allow extending structures > without breaking backward compatibility. You are right here, it doesn't write past the end of the iov buffer. However, it's still an ABI change. An unaware program using a newer user_pt_regs but running on an older kernel may be surprised that the updated iov.len is smaller than sizeof (struct user_pt_regs). Changing this structure also changes the core dump format, see ELF_NGREG and ELF_CORE_COPY_REGS. Maybe this doesn't matter much either since the ELF note would have size information but I'd prefer if we didn't modify this structure. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel