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: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-4.2 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 [IPv6:2620:52:3:1:0:246e:9693:128c]) (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 A7FAB1F8C6 for ; Tue, 17 Aug 2021 15:38:10 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A06D43938C3D for ; Tue, 17 Aug 2021 15:38:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A06D43938C3D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1629214689; bh=XAbCTV+IEdoqKOQVuPB2F1IKTAAiGcwc7mxAG6cg78k=; h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=u1J3v/ttueW5j1zsPjEwRgJ0HSKbfSbOqEGb3m3Y3+gNJxerlnEsXDfiuQcg4QVev C1bPgoCiWG1ebquQoLzZVNhsBJUJmjWnBvD1A0uhdvBeB36k2fipASTAxN1dy1X6tq lgvwDU7PI6jwagZynWyP249Ha1CNOlQCaD8xtpbQ= Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by sourceware.org (Postfix) with ESMTPS id 335363853C0A for ; Tue, 17 Aug 2021 15:37:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 335363853C0A Received: by mail-pj1-x102e.google.com with SMTP id n5so12168418pjt.4 for ; Tue, 17 Aug 2021 08:37:50 -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=XAbCTV+IEdoqKOQVuPB2F1IKTAAiGcwc7mxAG6cg78k=; b=lqmgG1WnKa91MtcwOgp7WH19wBFJkEYdtpu+EgYzU2JVZHi2SDd9j4zc7zUTTjDV6e JLVx6x7ZOZvVl0NF/WZXuTOKDmKvEmKllUM0kOHsubnGdQauLsZN/6wgYkwIdKuOki/r JmXzvoVubOfthWb+/OSnZ48W8zdbxfgz/vcq6Lim2iyv3qTd0VbcDmI2u6RTfeGE8XkS 0TNbfE9ZE+utZVymOTlvYHD5GawLc2lrNrbaI/e50xvZ1qb7YlS0w5wINIiCOCE8k8qh uki4W0X5FZIBKiTTOsZHlEr8ljPNbu0p7umEvU/SYmK1lTlfkzqubto3Q30wB+rHmK2H oK7g== X-Gm-Message-State: AOAM531e2LqBTjH2Y67g/zmIHRK8IWLViSSx3zkmNq00DCJMq47IU+lB XyeW1Jk+I4fbJXTxS827O9gcBsiAxhJ3UN3+b6E= X-Google-Smtp-Source: ABdhPJxcxjXsbS/isqjmPX7wOS5jPNL9IotXqRUfphp7TseLnujQHubi/VgD/N1FD05ggKhHnIbVcjrGysaQOqcgm74= X-Received: by 2002:a62:7e41:0:b029:3e0:9c3f:ab50 with SMTP id z62-20020a627e410000b02903e09c3fab50mr4209896pfc.57.1629214669166; Tue, 17 Aug 2021 08:37:49 -0700 (PDT) MIME-Version: 1.0 References: <20210805131358.300475-1-hjl.tools@gmail.com> <20210805131358.300475-2-hjl.tools@gmail.com> <87bl63giup.fsf@oldenburg.str.redhat.com> <20210812120115.GN20410@arm.com> <20210817123258.GF25257@arm.com> <20210817145946.GG25257@arm.com> In-Reply-To: <20210817145946.GG25257@arm.com> Date: Tue, 17 Aug 2021 08:37:13 -0700 Message-ID: Subject: Re: [PATCH v5 1/1] : An API for tagged address To: Szabolcs Nagy Content-Type: text/plain; charset="UTF-8" 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: , From: "H.J. Lu via Libc-alpha" Reply-To: "H.J. Lu" Cc: Florian Weimer , GNU C Library , Joseph Myers , "Kirill A . Shutemov" Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" On Tue, Aug 17, 2021 at 8:00 AM Szabolcs Nagy wrote: > > The 08/17/2021 05:53, H.J. Lu via Libc-alpha wrote: > > On Tue, Aug 17, 2021 at 5:33 AM Szabolcs Nagy via Libc-alpha > > wrote: > > > > > > The 08/12/2021 13:01, Szabolcs Nagy via Libc-alpha wrote: > > > > The 08/12/2021 10:36, Florian Weimer wrote: > > > > > I still don't see a way how we can split tag address bits used by the > > > > > implementation (glibc, sanitizers) and the application. > > > ... > > > > so one approach is to just disallow user tags, only sanitizer > > > > and similar tools can tag (and i think hwasan can coordinate > > > > with glibc via less formal api/abi that we can change later) > > > > > > to expand on this: i think we should just focus on the hwasan > > > use-case. there may be other use-cases for tagged addresses, > > > but we need more experience before we can design a generic api. > > > hwasan can just poke at implementation internals and have > > > target specific logic for now. > > > > Agreed. My motivation is hwasan. > > > > > allowing application code to use the tag bits can break c > > > semantics and compiler assumptions too easily. > > > > > > and we should not require hwasan to use libc apis to work > > > with tagged addresses, that would slow it down. > > > > There is no reason why a libc API should be slow. Currently, > > LAM enabled libsanitizer/hwasan has > > > > #include > > > > bool lam_failed = set_tagged_address_mask (TAGGED_ADDRESS_MASK (57)) > > > > We only need this function to enable LAM in libsanitizer/hwasan > > and inform glibc that LAM is enabled. The rest of functions in > > are used to make memmove and memmove > > tests LAM compatible. We can move them to internal header files. > > ok. > > libc internal api is a different story, i thought you > expect hwasan to use tag_address, get_tagged_address_mask > etc and that would affect hwasan code gen. They are not used in the current implementation of LAM-enabled hwasan. > if that's not the case then i don't think these apis should > be exposed. > > > > so i think we don't need the tagged address representation > > > related apis. we may need something __hwasan_init can call > > > to set up os support. on aarch64 that's a prctl now, but a > > > libc api would allow us to disable hwasan from glibc (e.g. > > > if there are elf markings for incompatible dsos), i don't > > > > set_tagged_address_mask can be used to enable and disable > > LAM/TBI. memmove needs to know if LAM/TBI is enabled or not > > to work correctly. > > i'm not convinced memmove needs to know. memmove may not need to know LAM bits for hwasn. But memmove needs to know if LAM is enabled in general. > if hwasan tags memory more fine grained than what is > passed to memmove as single object then there can be > issues in user code too with pointer diff calculations > within that object. > > > > know if that makes sense (does hwasan have a fall back if > > > there is no os support?). > > > > > > > It is a hard error for hwasan if LAM/TBI isn't available. > > > > Thanks. > > i see. -- H.J.