From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by sourceware.org (Postfix) with ESMTP id 6F5FE3861C54 for ; Sat, 31 Jul 2021 19:34:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6F5FE3861C54 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=kernel.crashing.org Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 16VJWLR6008593; Sat, 31 Jul 2021 14:32:21 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 16VJWK74008592; Sat, 31 Jul 2021 14:32:20 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Sat, 31 Jul 2021 14:32:20 -0500 From: Segher Boessenkool To: Joseph Myers Cc: Florian Weimer , gcc@gcc.gnu.org, libc-alpha@sourceware.org Subject: Re: Named address spaces on x86 GNU/Linux Message-ID: <20210731193219.GL1583@gate.crashing.org> References: <87czr12u3t.fsf@oldenburg.str.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, TXREP, T_SPF_HELO_PERMERROR, T_SPF_PERMERROR autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jul 2021 19:34:31 -0000 On Thu, Jul 29, 2021 at 04:08:36PM +0000, Joseph Myers wrote: > On Thu, 29 Jul 2021, Florian Weimer via Gcc wrote: > > On GNU/Linux, SEGFS is used to implement the thread pointer, to avoid > > dedicating a general-purpose register to it. At address zero with the > > SEGFS prefix, the offset itself is stored so that userspace can read it > > without having to call into the kernel. So the SEGFS null pointer is a > > valid address, and so are some bytes after it (depending on TCB layout, > > some of which is specified by the ABI or is part of the de-facto ABI > > used by GCC). > > That suggests that we need a target hook to describe null pointer > properties for a given address space. In an address space where null > pointers are valid to dereference, there should be no diagnostics for > arithmetic on / dereferencing them - and more generally, > -fno-delete-null-pointer-checks should be in effect for pointers to such > an address space (so I don't think this is just a warning issue, you can > probably get wrong code from null pointer check deletion in such an > address space). There already is TARGET_ADDR_SPACE_ZERO_ADDRESS_VALID? So this just isn't used everywhere it should? Segher