Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp876728ybm; Wed, 27 May 2020 10:06:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwwPe2uQvKNwRMezJbmDH9CBHlh65zP88Wn/RMKnUB3tX3gVhwoTZkkQOMU17Ern5KIz6g X-Received: by 2002:a17:906:2503:: with SMTP id i3mr7245279ejb.293.1590599166294; Wed, 27 May 2020 10:06:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590599166; cv=none; d=google.com; s=arc-20160816; b=nV355qbbZyp64yufAJWkSFZkmOKF962oJgJoyADK30PGXA9rTmF63GC2kOlKaccpVX Is/rO1uNpDlwz3HaD8ATTVxZP4Ri82AT0mYncg3Yb/mom9AzMKXFmPMrgWU1UoWockii BBAysq3tXi1qAEtb5mxRzFqR2Hh1WR1DWj7OmHbCfZ9/0UmEkxcGOmr+blD+kYCEZqna 6J/YJRFP7agQY6Rz0mFWaWFBIBlpW8NCXNKrAP7Hg2ToHOxbNhkgjT1PUoQ12bF6iz/K TC2GfV1N86jTj55on5tGIXOzBOmtZqFlGxu3Gc6eX59ef7Or3IpYzzGRHm9YmA0B+WiJ PL/Q== 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=/5bdwKWvPghlXj5CROpFuEUVp0lLgVa3WJ1O5jEmKxc=; b=npihbisOjEnIv3qGwF9bVy6+3YkeA/Enrk3eLId2j02XyQ28bnSGTu0EQaRj/SHnFI 2oNLQSb5D8yc0ayzQb9iWlZXEQc8moNiVpB2pHcGkBEXP0+oi3+jIRHsfv6aNLKFwtGs TpMmfb+gLq6wgluewdZrHTUs3QVPvoSZRCaMz5WfDvgcmtsf9BGlt2SpYvCRgTDH01sP UOV46vCKUgwG9KGA1p72lq2iLHveyQ3WZLqLzI2A7ooyMYC4Fi2Fd8zhmEssmiAnxrEc cUyQJXQi9VJXxE5t9TFMHDwwD2oMMu5gYm9ADnU9Z5sZSzOsO1JomskRUQkqKEUUkQ+V vvoQ== 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 w15si2180279ede.241.2020.05.27.10.05.40; Wed, 27 May 2020 10:06:06 -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 S1728019AbgE0KTg (ORCPT + 99 others); Wed, 27 May 2020 06:19:36 -0400 Received: from foss.arm.com ([217.140.110.172]:35684 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725294AbgE0KTd (ORCPT ); Wed, 27 May 2020 06:19:33 -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 1118B55D; Wed, 27 May 2020 03:19:33 -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 E8FEB3F6C4; Wed, 27 May 2020 03:19:31 -0700 (PDT) Date: Wed, 27 May 2020 11:19:29 +0100 From: Dave Martin To: Will Deacon Cc: Keno Fischer , Catalin Marinas , Kyle Huey , Oleg Nesterov , linux-arm-kernel@lists.infradead.org, Linux Kernel Mailing List Subject: Re: arm64: Register modification during syscall entry/exit stop Message-ID: <20200527101929.GT5031@arm.com> References: <20200519081551.GA9980@willie-the-truck> <20200520174149.GB27629@willie-the-truck> <20200527095528.GC11111@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200527095528.GC11111@willie-the-truck> 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 Wed, May 27, 2020 at 10:55:29AM +0100, Will Deacon wrote: > On Sun, May 24, 2020 at 02:56:35AM -0400, Keno Fischer wrote: > > Just ran into this issue again, with what I think may be most compelling > > example yet why this is problematic: > > > > The tracee incurred a signal, we PTRACE_SYSEMU'd to the rt_sigreturn, > > which the tracer tried to emulate by applying the state from the signal frame. > > However, the PTRACE_SYSEMU stop is a syscall-stop, so the tracer's write > > to x7 was ignored and x7 retained the value it had in the signal handler, > > which broke the tracee. > > Yeah, that sounds like a good justification to add a way to stop this. Could > you send a patch, please? > > Interestingly, I *thought* the current behaviour was needed by strace, but I > can't find anything there that seems to require it. Oh well, we're stuck > with it anyway. The fact that PTRACE_SYSEMU is only implemented for a few arches makes we wonder whether it was a misguided addition that should not be ported to new arches... i.e., why does hardly anyone need it? But I haven't attempted to understand the history. Can't PTRACE_SYSEMU be emulated by using PTRACE_SYSCALL, cancelling the syscall at the syscall enter stop, then modifying the regs at the syscall exit stop? If SYSEMU was obviously always broken, perhaps we can withdraw support for it. Assuming nobody is crazy enough to try to emulate execve() I can't see anything other than sigreturn that would be affected by this issue though. So maybe SYSEMU isn't broken enough to justify withdrawal. Cheers ---Dave