Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp344183ybg; Mon, 1 Jun 2020 02:54:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycFTmOQEhko0eRhvXDPTHRrw01267heuBuAASimGM0W1/+NXe4XS/oB1mRg0WV4N3msmwu X-Received: by 2002:aa7:c6d1:: with SMTP id b17mr21899197eds.39.1591005291935; Mon, 01 Jun 2020 02:54:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591005291; cv=none; d=google.com; s=arc-20160816; b=l/1bLGO7RvoYdPP6YvWmz8thdyRUsY3AR9EWM4+bzy5G7cv3r3npkNJGprUybEJLtF OR8gig5jsFA6XeIwISDeZLyB6dvNyuzQNUcas/7d4+CW6fNl7lc8+JgLuKxWtjXR9rfQ xNLx4Z4v3QLi4vlBAuTh9vrRz9te6HYVzYhi2gcflTA9gVbN3VGjoPz+lzRP8GNroB1a 2sIJNkRn8XlPP4nmnlXB4QMOtvSyg3Z2kr5DgiRUl5+bwHunPAMDcSZ6CXwino82hnLm zIgHnES2xRNu1tcCoBLWQdgdOwDE64rMLjI7HgCSXKX9Ai5cdTWOYBYpLEP051Ag4CR0 bVwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=phmF50TU4Bk8CZqdWIErRL+xQlnMMZV2YvvhqNb4158=; b=YkCr9vcwi+qCfDvM8GhG8GG2l/xLs2R5x1ehIOx/4VhOkM+YaJwjS4QY5UYP7oXISR rpYpQ7nJk97QbYIjiLbVRmXBzYuGGqbqZPn5Vp2xKRoLA95cIhplgPo0VcnfN/2F4BS7 WES5yw5Fzl3r8kRazDmjI/y0BjOWcrK0V0ULS0gFAH+UCLX/CGkGIWJ2g1nZf3Yxcg2m KvSeUTOmvce8SU8FRj4wcOx186jvlEYis4bGRK7b+nMVwaVeflB8c3bFMnoJs4JWrykE eixEnG8IjxXhHqHPFveMOIsfgmbdIm64tudHL4x23jtrtZ2xhqkh051unKc5Obl6mhIO LM2g== ARC-Authentication-Results: i=1; mx.google.com; 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 bf13si1769598edb.64.2020.06.01.02.54.29; Mon, 01 Jun 2020 02:54:51 -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; 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 S1726901AbgFAJwg (ORCPT + 99 others); Mon, 1 Jun 2020 05:52:36 -0400 Received: from foss.arm.com ([217.140.110.172]:35746 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726078AbgFAJw1 (ORCPT ); Mon, 1 Jun 2020 05:52:27 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6CD871FB; Mon, 1 Jun 2020 02:52:26 -0700 (PDT) Received: from arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 512B33F305; Mon, 1 Jun 2020 02:52:25 -0700 (PDT) Date: Mon, 1 Jun 2020 10:52:23 +0100 From: Dave Martin To: Keno Fischer Cc: Kyle Huey , Catalin Marinas , Linux Kernel Mailing List , Oleg Nesterov , Will Deacon , linux-arm-kernel@lists.infradead.org Subject: Re: arm64: Register modification during syscall entry/exit stop Message-ID: <20200601095222.GY5031@arm.com> References: <20200520174149.GB27629@willie-the-truck> <20200527095528.GC11111@willie-the-truck> <20200527101929.GT5031@arm.com> <20200531093320.GA30204@willie-the-truck> <20200601091441.GW5031@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 01, 2020 at 05:23:01AM -0400, Keno Fischer wrote: > On Mon, Jun 1, 2020 at 5:14 AM Dave Martin wrote: > > Can you explain why userspace would write a changed value for x7 > > but at the same time need that new to be thrown away? > > The discarding behavior is the primary reason things aren't completely > broken at the moment. If it read the wrong x7 value and didn't know about > the Aarch64 quirk, it's often just trying to write that same wrong > value back during the next stop, so if that's just ignored, > that's probably fine in 99% of cases, since the value in the > tracee will be undisturbed. I guess that's my question: when is x7 "disturbed". Other than sigreturn, I can't think of a case. I'm likely missing some aspect of what you're trying to do. > I don't think there's a sane way to change the aarch64 NT_PRSTATUS > semantics without just completely removing the x7 behavior, but of course > people may be relying on that (I think somebody said upthread that strace does?) Since rt_sigreturn emulation was always broken, can we just say that the effect of updating any reg other than x0 is unspecified in this case? Even fixing the x7 issue won't magically teach your tracer how to deal with unrecognised data in the signal frame, so new hardware or a new kernel could cause your tracer to become subtly broken. Would you be better off tweaking the real signal frame as desired and doing a real rt_sigreturn for example, instead of attempting to emulate it? I'm somewhat playing devil's advocate here... Cheers ---Dave