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=-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 [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 CBC371F8C6 for ; Mon, 16 Aug 2021 22:09:34 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CB7333844051 for ; Mon, 16 Aug 2021 22:09:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CB7333844051 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1629151773; bh=XH5xNyX09U4Y2ruDyB6/Sp6gvz51ymQprST82HatgPY=; 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=ZATdugkxjHliHJPy5/MQaynVERtg+4qJH1lsp+4hs2dyAy/QpHJMc0uLy7mFUEzm+ 6i0qpf8D/ueK+Y/DqlaFjg9Q2d68U/R3QIdR+mGXDxga0Xd5W87P1GCl/EA1uQwLkq HuQx5Jopbloe7uWwsfNwiM5JCAjn7cTi+9PZ284E= Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by sourceware.org (Postfix) with ESMTPS id 911A63959E5D; Mon, 16 Aug 2021 22:09:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 911A63959E5D Received: by mail-pl1-x62b.google.com with SMTP id a5so22279054plh.5; Mon, 16 Aug 2021 15:09:05 -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=XH5xNyX09U4Y2ruDyB6/Sp6gvz51ymQprST82HatgPY=; b=q3Vlkr8iBr3SCMO1+YuKy7I8SiV9F78SNYi5xcoqBl3FLAZuBRH4aOkPBekW+UA0VY MBFv0YcpqiruIA/o+92qrDt7MNECEVz9IcjpDDoHRJbyNVGCb0gVnGAxaXki/UbDOm2T OgDwVzTH4HylVEX6QfHk8+o+8DApDm7ER4KaSjmSDO4yvRb6g9uBKHLKXz6XquoDeYB4 pv8PElNOaXy3eC2VYjBXrI5u/D7lMWgdA3ixaw3GtMxJRqE+OudbcDmVUL+EaVBR2x2Y k273VEQd04uxH+3f1JNZFMy3mPoY30D1yhuJuf34MAgUdB5qOqtzEsOr3wSFoOeCtFxJ 0kUg== X-Gm-Message-State: AOAM531f4o4qN1+CN+bWlnJLzeSP/d8bxr6FDrZMGfkOFPuSP7eqhH7A HT8JKmUlnj2tEitJ3W45G9MwIiDWiQNmVsJ+f8fsr+sx5l0= X-Google-Smtp-Source: ABdhPJzyayTIphU10DjDXVAkb/va8aXjgew0dgqCWRQQ0kOsIGMJPGOee4lkQ5wSw8OzGMdzQ9rTURsHDHtcWGBigfQ= X-Received: by 2002:a62:87c5:0:b029:3b5:f90f:c2eb with SMTP id i188-20020a6287c50000b02903b5f90fc2ebmr320446pfe.28.1629151744575; Mon, 16 Aug 2021 15:09:04 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 16 Aug 2021 15:08:28 -0700 Message-ID: Subject: Re: [PATCH v2] gdbserver: Check r_version < 1 for Linux debugger interface To: GNU C Library , GDB 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: Simon Marchi Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" On Mon, Aug 16, 2021 at 3:02 PM H.J. Lu wrote: > > On Mon, Aug 16, 2021 at 1:30 PM H.J. Lu wrote: > > > > Update gdbserver to check r_version < 1 instead of r_version != 1 so > > that r_version can be bumped for a new field in the glibc debugger > > interface to support multiple namespaces. Since so far, the gdbserver > > only reads fields defined for r_version == 1, it is compatible with > > r_version >= 1. > > > > All future glibc debugger interface changes will be backward compatible. > > If there is ever the need for backward incompatible change to the glibc > > debugger interface, a new DT_XXX element will be provided to access the > > new incompatible interface. > > > > PR gdb/11839 > > * linux-low.cc (linux_process_target::qxfer_libraries_svr4): > > Check r_version < 1 instead of r_version != 1. > > --- > > gdbserver/linux-low.cc | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc > > index 5c6191d941c..fc7a995351d 100644 > > --- a/gdbserver/linux-low.cc > > +++ b/gdbserver/linux-low.cc > > @@ -6845,7 +6845,7 @@ linux_process_target::qxfer_libraries_svr4 (const char *annex, > > if (linux_read_memory (priv->r_debug + lmo->r_version_offset, > > (unsigned char *) &r_version, > > sizeof (r_version)) != 0 > > - || r_version != 1) > > + || r_version < 1) > > { > > warning ("unexpected r_debug version %d", r_version); > > } > > -- > > 2.31.1 > > > > Set r_version == 2 breaks GDB due to > > static CORE_ADDR > solib_svr4_r_ldsomap (struct svr4_info *info) > { > struct link_map_offsets *lmo = svr4_fetch_link_map_offsets (); > struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr; > enum bfd_endian byte_order = type_byte_order (ptr_type); > ULONGEST version = 0; > > try > { > /* Check version, and return zero if `struct r_debug' doesn't have > the r_ldsomap member. */ > version > = read_memory_unsigned_integer (info->debug_base + > lmo->r_version_offset, > lmo->r_version_size, byte_order); > } > catch (const gdb_exception_error &ex) > { > exception_print (gdb_stderr, ex); > } > > if (version < 2 || lmo->r_ldsomap_offset == -1) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > glibc doesn't have r_ldsomap. But r_ldsomap_offset is set > unconditionally. Shouldn't it be set only if the target debugger > interface has it? > > return 0; > > return read_memory_typed_address (info->debug_base + lmo->r_ldsomap_offset, > ptr_type); > } > I opened: https://sourceware.org/bugzilla/show_bug.cgi?id=28236 -- H.J.