From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by sourceware.org (Postfix) with ESMTPS id 392F0385842F for ; Fri, 30 Jul 2021 07:00:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 392F0385842F Received: by mail-ed1-x52a.google.com with SMTP id ec13so11178399edb.0 for ; Fri, 30 Jul 2021 00:00:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vyupCUj9+detD0qC37VLkrRXOsbDixL7R6qziRyj4U4=; b=HVIf+EqjZo9RYJ3fIYmXbtuaeDTztjh79iND75GfrRm+3CNCP1mncIrrHmQKIj+7ZX BXqxNPFDYVIelEL+k7MOpWpuQWptO8bDliFBq/dooJ5Uwk11mscKvCCEIQ5dd4cTLfZY IBPkYqLGIBu5mddYKJdB0qlYOyXclG//qV1ppKp7jWcNegh8rgrmbF9DyJpZoe+3ShOZ N862JTOKoE0FNJu1IMPcw4EfPNZFAFa1k+1892phDdcp1whYc+jM9mtEn/dcF3Tok+F7 MP0NpIZE/JvmF2tjvBP0VVD348f1B3lZh9iDG+qDdVE8YFXhes2zF31uiRUBqZoHTfwE MI3A== X-Gm-Message-State: AOAM5314FWS7y1q1p/5NgVqYwZgHDoELPgjYE0j1wGsW1o6qltmXxKIl WHemDLb2d2UcrPo8QNUB9oIafebryh20qBd+4LLHaqf7 X-Google-Smtp-Source: ABdhPJzWwmb7IMOpk2LqCx4dqlAMJdLawaKMASKraZqgEJuD9mP44i8MD6NZ+FyKxvnfOfEzpf8WUVnv582JlDPI3ok= X-Received: by 2002:a50:ab1c:: with SMTP id s28mr1232613edc.214.1627628417297; Fri, 30 Jul 2021 00:00:17 -0700 (PDT) MIME-Version: 1.0 References: <87czr12u3t.fsf@oldenburg.str.redhat.com> In-Reply-To: From: Richard Biener Date: Fri, 30 Jul 2021 09:00:06 +0200 Message-ID: Subject: Re: Named address spaces on x86 GNU/Linux To: Joseph Myers Cc: Florian Weimer , GCC Development , GNU C Library Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham 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: Fri, 30 Jul 2021 07:00:19 -0000 On Thu, Jul 29, 2021 at 6:09 PM 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). Thus flag_no_delete_null_pointer_checks checks should be replaced with sth that takes the address-space as argument. A good default implementation would be to only have the default address space covered by NULL pointer rules. Richard. > -- > Joseph S. Myers > joseph@codesourcery.com