From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 36300 invoked by alias); 19 Oct 2017 13:17:25 -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 36248 invoked by uid 89); 19 Oct 2017 13:17:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=Hx-languages-length:922, H*r:sk:static. X-HELO: mail-wr0-f196.google.com Received: from mail-wr0-f196.google.com (HELO mail-wr0-f196.google.com) (209.85.128.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 19 Oct 2017 13:17:23 +0000 Received: by mail-wr0-f196.google.com with SMTP id j14so8307229wre.8 for ; Thu, 19 Oct 2017 06:17:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=/bOWc+cIdAXj82jYjcivLUt8V0DlC1VmDPn3dQIV4Hg=; b=oGZSV8y5blo9MAGfWIkPr6E7XHNnxW8fFV+SK4rRBC4jFkfMzqZmw7SU1DDEwUOEHe 4tAjdtZEKgO/nXI/dV7rrINOi9bKv7ZZ0m4DsEHeSdYB7GWQ3p45ylQbgw3WcNdGuqgB Bii+ConfbqFl0tOATqY6yrBapL785QTBDfXN6YRXrH8ZDsP3LvNtVoY7IccF3vWzFdbU +c8jl+SBmNohb8NWdCmDc9hI+qAH8v4lG2UP3xztX11lGmlqkvCj8wmK4Z8d+vkKI9kD Pl0j31HsqPCTKmd1Iq5PXJEEvpc1MGwBJgt8Ln/1ymcU/bW7yIMZ5wtCoUxeOpzKH9mx FTfA== X-Gm-Message-State: AMCzsaXF1lYEFzcfPH0v0dSBp7TuthXelrfu16Q6rdehTLuCnzLCcrWE WBZ6rO4lBBmEdmPsXHGu1RwqfQ== X-Google-Smtp-Source: ABhQp+QKN002Op3pfX/SI6WsqZt4i5ZcG20yMxB80cDhKj4Lc1ZtKNdL3pUupIX9MCLgnZVWIQ0IMw== X-Received: by 10.223.183.1 with SMTP id l1mr1508916wre.139.1508419041245; Thu, 19 Oct 2017 06:17:21 -0700 (PDT) Received: from E107787-LIN (static.42.136.251.148.clients.your-server.de. [148.251.136.42]) by smtp.gmail.com with ESMTPSA id c4sm8416941wre.57.2017.10.19.06.17.20 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Thu, 19 Oct 2017 06:17:20 -0700 (PDT) From: Yao Qi To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] [AArch64 Linux] Get rid of top byte from tagged address References: <1508400527-20718-1-git-send-email-yao.qi@linaro.org> <561ea277-4b4c-ae82-01e1-1cde96cb54f2@redhat.com> <86po9jv29n.fsf@gmail.com> <98b855a4-77df-1bd6-d20d-5b2611cc8f83@redhat.com> Date: Thu, 19 Oct 2017 13:17:00 -0000 In-Reply-To: <98b855a4-77df-1bd6-d20d-5b2611cc8f83@redhat.com> (Pedro Alves's message of "Thu, 19 Oct 2017 12:08:59 +0100") Message-ID: <86h8uvuvj8.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2017-10/txt/msg00605.txt.bz2 Pedro Alves writes: > This means with something like: > > #define tagptr(PTR) \ > ((typeof (PTR)) ((uintptr_t) (PTR) | 0xf000000000000000ULL)) > > strcat (buf, "hello\n"); > > char *ptr =3D tagptr(buf); // assume this is hidden from view. > > write (1, ptr, 6); // kernel rejects this. > Right, it returns -1, and errno is EFAULT. > and then the user might be puzzled because stepping through > that code: > > (gdb) print ptr > (gdb) print ptr[0] > > etc. works without error. That is right/expected to me, because in the c code, we can still access ptr[0] without any error, like "char c =3D ptr[0]", so it is reasonable that we can access them in GDB. Kernel rejects that address, doesn't mean we can't access that address. > > Same with iovec/readv, ioctl, etc., any system call that takes > a pointer argument. --=20 Yao (=E9=BD=90=E5=B0=A7)