From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 126545 invoked by alias); 19 Oct 2017 09:55:42 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 126535 invoked by uid 89); 19 Oct 2017 09:55:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=H*UA:56.0 X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 19 Oct 2017 09:55:40 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A2C08F; Thu, 19 Oct 2017 02:55:39 -0700 (PDT) Received: from [10.2.206.255] (armadillo.cambridge.arm.com [10.2.206.255]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 065893F3E1; Thu, 19 Oct 2017 02:55:38 -0700 (PDT) Subject: Re: [PATCH] [AArch64 Linux] Get rid of top byte from tagged address To: Pedro Alves , Yao Qi , gdb-patches@sourceware.org References: <1508400527-20718-1-git-send-email-yao.qi@linaro.org> <561ea277-4b4c-ae82-01e1-1cde96cb54f2@redhat.com> From: Ramana Radhakrishnan Message-ID: Date: Thu, 19 Oct 2017 09:55:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:56.0) Gecko/20100101 Thunderbird/56.0 MIME-Version: 1.0 In-Reply-To: <561ea277-4b4c-ae82-01e1-1cde96cb54f2@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2017-10/txt/msg00597.txt.bz2 On 10/19/17 10:52 AM, Pedro Alves wrote: > On 10/19/2017 09:08 AM, Yao Qi wrote: >> ARMv8 supports tagged address, that is, the top one byte in address >> is ignored. It is always enabled on aarch64-linux. > > In that case, why isn't the kernel itself stripping the top byte? > > OK, looking around, I found: > > https://www.kernel.org/doc/Documentation/arm64/tagged-pointers.txt > > where it's documented that the top byte must be 0 when calling > into the kernel. > > Having this reference in the log is helpful. > >> The patch clear >> the top byte of the virtual address, at the point before GDB/GDBserver >> pass the address to /proc or ptrace syscall. The top byte of address is >> still retained in the rest of GDB, because these bits can be used by >> different applications in different ways. That is reason I didn't >> implement gdbarch method addr_bits_remove to get rid of them. > > I'm fine with doing this if it's what arm/linaro folks want, > though personally (with absolutely no experience in this) I have > reservations about whether stripping the top byte in the special > case of memory accesses is a good idea, since it may puzzle folks > when they pass such pointers/addresses in registers/structures and > things don't magically work then (and then gdb masks the problem when > folks try to diagnose it, as in "but I can access the object > via "p *s->ptr", why isn't this working??? bad gdb."). Yeah that thought crossed my mind too whether it makes a better debug experience keeping the top byte in the debug view but only stripping it off in the ptrace interface or wherever you have to respect the kernel interface. regards Ramana