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 0CFA71F8C6 for ; Mon, 6 Sep 2021 14:33:45 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 14D16385AC30 for ; Mon, 6 Sep 2021 14:33:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 14D16385AC30 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1630938824; bh=/FO5SvNKomUeTdARbl+gsc3Mtwnpe0twYvvmu2UhM7U=; 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=bQJ6Wuj5B0CAl3Zpj+287BzhGSE9EVVXy0ZV/LYCN6zHmusNwX+Sr+nvBczX5Ncb6 13gGYhQ0mUJ7vLj7Mv63tY+WOd2uFHc+Z2dvwWUcDyaaYEd+Attcnz55KXJjwwhsdc z31MQ8glESF0t7P/TbzZGGsRrQUFwLrvkmtG0M18= Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by sourceware.org (Postfix) with ESMTPS id E457D385701B; Mon, 6 Sep 2021 14:32:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E457D385701B Received: by mail-pg1-x52e.google.com with SMTP id k24so6978723pgh.8; Mon, 06 Sep 2021 07:32:15 -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=/FO5SvNKomUeTdARbl+gsc3Mtwnpe0twYvvmu2UhM7U=; b=n6jb6oUyO6C5kJihhr2VL4qAtqsgWsTHHY1ZV5GJ0EsxQuUDa/004fua/o/jDC9ysU 1AWCysO4ceV0CnbP1qPyaY8VGUBLg26LeRtKyDReK94TeBYmWqefRZUDivfUhkgBsISw 1SJdjrNopG7FHqDiVITCpP+NIKmXsZzOKbdKkatcWYULqVE+haBRIp60OhKFyTPJGlqD OCSCyKxff/GQsdXCovk1RuwrcbVfA8pX3exdnA2ZK+txONKs/apkQQjhjdRsN77MJ1Rr EABoS1VcsbgatieaDn3JZQX5EhHGnb7061A00wXIq7kIp4wMTCuUacv+yd80qy5IUWDY jWAQ== X-Gm-Message-State: AOAM532i7qkQS2empAHrbh0XVFRptNOMQ2zo2rPhpst764pQzKhSkQAG lamPv1JsBFok0vFTKQJ/k6xB+e2lj/VKs81BsZU= X-Google-Smtp-Source: ABdhPJz6heIRvPONYClsO40vC3KX66qlatCnuenRPyoL7NeGOcYokCe2EIw3Fbp1CLfmPOWV2dNwwAuY/hCTxYSUdxk= X-Received: by 2002:a63:1656:: with SMTP id 22mr12613146pgw.20.1630938735002; Mon, 06 Sep 2021 07:32:15 -0700 (PDT) MIME-Version: 1.0 References: <20210830173844.458727-1-hjl.tools@gmail.com> <20210830173844.458727-3-hjl.tools@gmail.com> <874kay11s3.fsf@oldenburg.str.redhat.com> <87o895ye7k.fsf@oldenburg.str.redhat.com> In-Reply-To: <87o895ye7k.fsf@oldenburg.str.redhat.com> Date: Mon, 6 Sep 2021 07:31:39 -0700 Message-ID: Subject: Re: [PATCH v6 2/2] Extend struct r_debug to support multiple namespaces To: Florian Weimer 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: GDB , GNU C Library , libc-coord@lists.openwall.com Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" On Mon, Sep 6, 2021 at 7:24 AM Florian Weimer wrote: > > * H. J. Lu: > > > On Mon, Sep 6, 2021 at 2:39 AM Florian Weimer wrote: > >> > >> * H. J. Lu: > >> > >> > +* The r_version update in the debugger interface makes the glibc binary > >> > + incompatible with GDB binaries built without the following commits: > >> > + > >> > + c0154a4a21a gdb: Don't assume r_ldsomap when r_version > 1 on Linux > >> > + 4eb629d50d4 gdbserver: Check r_version < 1 for Linux debugger interface > >> > >> Does this incompatibility happen even if audit modules and dlmopen are > >> not used? > > > > Yes. > > Why? Can't we keep r_version at 1 in this case? r_version is checked in GDB whenever DT_DEBUG is used to access the rtld debug interface, independent of audit modules and dlmopen. We can bump r_version only if a non-default namespace is used. > >> This puts the assember output from the compiler through the > >> preprocessor. That seems to be brittle. I think you would have to > >> preprocess the manually written fragment separately. > >> > >> However, I think we are overdesigning things here. The following in > >> dl-debug-symbols-gen.c should work (and the file should have a different > >> name then): > >> > >> /* Alias _r_debug to a prefix of _r_debug_extended. */ > >> asm (".set _r_debug, _r_debug_extended\n\t" > >> ".type _r_debug, %object\n\t" > >> ".symver _r_debug_extended, _r_debug@@" FIRST_VERSION_ld__r_debug_STRING); > >> #if __WORDSIZE == 64 > >> _Static_assert (sizeof (struct r_debug) == 40, "sizeof (struct r_debug)"); > >> asm (".size _r_debug, 40"); > >> #else > >> _Static_assert (sizeof (struct r_debug) == 20, "sizeof (struct r_debug)"); > >> asm (".size _r_debug, 20"); > >> #endif > >> > >> It's not exactly pretty, but at least it's obvious what is going on. > >> (Extended asm with input operands is not supported outside of functions.) > > > > This was the first thing I tried and it didn't work: > > > > [hjl@gnu-cfl-2 tmp]$ cat foo.s > > .set _r_debug, _r_debug_extended > > .globl _r_debug > > .type _r_debug, %object > > .size _r_debug, 40 > > .data > > .type _r_debug_extended, %object > > .size _r_debug_extended, 48 > > .globl _r_debug_extended > > _r_debug_extended: > > .zero 48 > > [hjl@gnu-cfl-2 tmp]$ gcc -c foo.s > > [hjl@gnu-cfl-2 tmp]$ readelf -sW foo.o | grep _r_debug > > 1: 0000000000000000 48 OBJECT GLOBAL DEFAULT 2 _r_debug > > 2: 0000000000000000 48 OBJECT GLOBAL DEFAULT 2 _r_debug_extended > > [hjl@gnu-cfl-2 tmp]$ > > Huh. Does this mean this depends on the symbol definition order in the > assembler file? > > I really hate the post-processing of compiler output. This isn't GHC. 8-> > > Can we write a portable assembler file instead? > > Nick Clifton has written down some guidelines: > > Tips for writing portable assembler with GNU Assembler (GAS) > > > There's no initializer, so all we need to know is size and alignment. Yes, I can do that. > >> Is this necessary? It makes concurrent access to the list harder and > > > > When _dl_close_worker is called, it holds GL(dl_load_lock). Why does > > this change make concurrent access harder? > > Something else might want to read the list directly, by starting with > DT_DEBUG. I can add _dl_debug_get and use _dl_debug_initialize only for initialization. Will it work? -- H.J.