From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS17314 8.43.84.0/22 X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 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 (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 55A971F8C6 for ; Sat, 31 Jul 2021 19:34:50 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3D5663861936 for ; Sat, 31 Jul 2021 19:34:49 +0000 (GMT) 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 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-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: , Cc: Florian Weimer , gcc@gcc.gnu.org, libc-alpha@sourceware.org Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" 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