Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1180504pxb; Thu, 4 Feb 2021 06:59:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJw1XW4y5c3TdB3oN20oeHjY9rNfB/cmkuEHDS1fLE5mh7+wD4sZA1o00ow/Ib4wPBu6+WGn X-Received: by 2002:aa7:cd8c:: with SMTP id x12mr8490744edv.355.1612450760155; Thu, 04 Feb 2021 06:59:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612450760; cv=none; d=google.com; s=arc-20160816; b=lwL7EQsyTtUzvID6dTN89hSST6A1gB0R48SWNAoFEpBb+8DKCsVgKOp/mc7Aum3HwR I+FKZI56U49MgN5z0JsO1gaJeJi/RMzyA0Dz6agrRyzd7UumVbwdgYZjqR9aZ3Ez7wpR PyQ2TPvMF7ZYcg4H5JAh2+FScslR66XduBeDIIXBC/QXJv2gBFyXzTXA+d4UQHmvvSMF VYCYotG3cva9k9E2m8o3YfneOGTWlko07MJyzFKUONSTwOL386g1lpWlE8yD+qRBJgR6 ZV1+cdN2QlbLH7NcDU8WLLTzLoGlWBYjGKRgzpXcMjVxjqL6O94FE97i+del56pHOxJC BTRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=6g5uijoQ8JRW8umQltzDGUYZG6dLebu48oCeXx21L7k=; b=DGEfBR4wuOX15OJw4AIWqlW8gcEOvS87XIuUmofAWgU0Go6+2pRpB3bV3OWZXNGRyA hOextoCwTVD01LOW0/uI7aCREIIOTLkscYL1fKDb2Q0EERoSy7+sGqBCS585NIMjsWY1 nDbgixpoA2D7h5hfsIqbpz4LmT+xZ6UE315V/AgrnoCpz25s9uN6oKtRAubdJkocmI46 D+NMSN6TXbdbnIb2IAYgloFR0LRox7Izhe5Ijy2MfFVAUl2tWthw8Q+UMTJMxce+e3pb B8vr3TMZ8HuWlMnqykQHnjD12jVadMbZxT7R4TJLLNRbfNor+lzlQPZKW0A237TgoMbC zfNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Cl6/II/p"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r12si2388206edd.539.2021.02.04.06.58.51; Thu, 04 Feb 2021 06:59:20 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b="Cl6/II/p"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236991AbhBDO4l (ORCPT + 99 others); Thu, 4 Feb 2021 09:56:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:45354 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236891AbhBDOyc (ORCPT ); Thu, 4 Feb 2021 09:54:32 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4BCBD64E42; Thu, 4 Feb 2021 14:53:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1612450430; bh=scY1EUctLlHyJdhffM1YO119Qq4RStdexWZRn3yOoC8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Cl6/II/pP7hXlx/qGhE2nU/ur3bHmP4FoN8FWznMJEbivL2vDzrR/1+dJbe9yPtjy JoaJKEVaeldLKq340MjgGU1Qn7wkPMsCEgSy+zTTfF+xuiU3VqOUZlJtxWTZhjoll9 s4A6p807Ze/iZ/SyyXwJatQaokMvwhZFyYEOqO420FWUqI8jr+AZIwIvy2hShuSXjk e5FgjFedltdirbM4T0Y5ZChNuKMCijX/zdks/7zHls3ALivZV8t1EVU2cvfDY1co38 ygLm14xZi/neW7Wd++s/HJPWuXtPWYgMqbBc7cGKpELEPHp5GrILOk5YOmssdEdYYn JH1+37gXVp/1Q== Date: Thu, 4 Feb 2021 14:53:46 +0000 From: Will Deacon To: Andrei Vagin Cc: Catalin Marinas , Oleg Nesterov , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Anthony Steinhauser , Dave Martin , Keno Fischer Subject: Re: [PATCH 0/3 v2] arm64/ptrace: allow to get all registers on syscall traps Message-ID: <20210204145345.GC20815@willie-the-truck> References: <20210201194012.524831-1-avagin@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210201194012.524831-1-avagin@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andrei, On Mon, Feb 01, 2021 at 11:40:09AM -0800, Andrei Vagin wrote: > Right now, ip/r12 for AArch32 and x7 for AArch64 is used to indicate > whether or not the stop has been signalled from syscall entry or syscall > exit. This means that: > > - Any writes by the tracer to this register during the stop are > ignored/discarded. > > - The actual value of the register is not available during the stop, > so the tracer cannot save it and restore it later. > > For applications like the user-mode Linux or gVisor, it is critical to > have access to the full set of registers in any moment. For example, > they need to change values of all registers to emulate rt_sigreturn or > execve and they need to have the full set of registers to build a signal > frame. > > This series introduces the PTRACE_O_ARM64_RAW_REGS option. If it is set, > PTRACE_GETREGSET returns values of all registers, and PTRACE_SETREGSET > allows to change any of them. I haven't had a chance to go through this properly yet, but I spotted a couple of things worth mentioning off the bat: - Please drop all of the compat changes here. The compat layer is intended to be compatible with arch/arm/, so if you want to introduce new ptrace behaviours for 32-bit applications, you need to make the changes there and then update our compat layer accordingly. - When Keno mentioned this before [1,2], he also talked about making orig_x0 available. Since extending the ABI is a giant pain, I think this should be seriously considered. [1] https://lore.kernel.org/r/CABV8kRzkLiVuqxT3+8c1o8m_OuROtXgfowQcrMVnrxu=CiGB=w@mail.gmail.com [2] https://lore.kernel.org/r/CABV8kRzg1BaKdAhqXU3hONhfPAHj6Nbw0wLBC1Lo7PN1UA0CoA@mail.gmail.com Will