From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id bJxYIHB0xWJZJg0AWB0awg (envelope-from ) for ; Wed, 06 Jul 2022 07:39:28 -0400 Received: by simark.ca (Postfix, from userid 112) id 73BA21E22E; Wed, 6 Jul 2022 07:39:28 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=H6AW4kuO; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 2090B1E22C for ; Wed, 6 Jul 2022 07:39:28 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E121738582A9 for ; Wed, 6 Jul 2022 11:39:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E121738582A9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1657107565; bh=bJdkNtpNe21eZW6Y5Iey2E2bUlknG5snk1qsl/g4nGA=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=H6AW4kuOfL/cWv5s8+lC7Z2ONFStJpnZDKMyOcfo/s9H6jKySWs4QcN/IsHdY/ibt neAwZ9Uckvsb9n4/eLe/URHzQI2yFTQWHUcqK717gAxAtMEN/R+vS/YRe8pxukFp8v kEO/gCGEdE8d+EZEgDr9vEBhzJzx54Lprqm4IlJ4= Received: from lndn.lancelotsix.com (vps-42846194.vps.ovh.net [IPv6:2001:41d0:801:2000::2400]) by sourceware.org (Postfix) with ESMTPS id 7B7D23858D39 for ; Wed, 6 Jul 2022 11:39:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7B7D23858D39 Received: from ubuntu.lan (unknown [IPv6:2a02:390:9086::635]) by lndn.lancelotsix.com (Postfix) with ESMTPSA id 58C418905D; Wed, 6 Jul 2022 11:39:05 +0000 (UTC) Date: Wed, 6 Jul 2022 11:38:57 +0000 To: Luis Machado Subject: Re: [PATCH] [AArch64] Fix removal of non-address bits for PAuth Message-ID: <20220706113857.a6gfmmlaeprg5uyq@ubuntu.lan> References: <20220705140037.135012-1-luis.machado@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220705140037.135012-1-luis.machado@arm.com> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.11 (lndn.lancelotsix.com [0.0.0.0]); Wed, 06 Jul 2022 11:39:05 +0000 (UTC) X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Lancelot SIX via Gdb-patches Reply-To: Lancelot SIX Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" > + > +/* See arch/aarch64.h. */ > + > +CORE_ADDR > +aarch64_remove_top_bytes (CORE_ADDR pointer, CORE_ADDR mask) Hi, Shouldn't this function be called aarch64_remove_top_bits (note the s/bytes/bits)? This function does not work at the byte grain. > +{ > + /* The VA range select bit is 55. This bit tells us if we have a > + kernel-space address or a user-space address. */ > + bool kernel_address = (pointer & VA_RANGE_SELECT_BIT_MASK)? true : false; You could drop the ternary operator by using bool kernel_address = (pointer & VA_RANGE_SELECT_BIT_MASK) != 0; which I find a "more canonical" way to write it, but I guess it is mostly a matter of taste. Best, Lancelot. > +/* Given a pointer value POINTER and a MASK of non-address bits, remove the > + non-address bits from the pointer and sign-extend the result if required. > + The sign-extension is required so we can handle kernel addresses > + correctly. */ > +CORE_ADDR aarch64_remove_top_bytes (CORE_ADDR pointer, CORE_ADDR mask);