Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3224330rwb; Fri, 16 Dec 2022 11:47:05 -0800 (PST) X-Google-Smtp-Source: AA0mqf6fingHlw/nqgBdfX6sWY7zuZVq45/S9AAASkRMQEczGh4fucem4t2znljVV2EWPzC7g52m X-Received: by 2002:a05:6402:d65:b0:46d:afb4:ef16 with SMTP id ec37-20020a0564020d6500b0046dafb4ef16mr28218022edb.42.1671220025776; Fri, 16 Dec 2022 11:47:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671220025; cv=none; d=google.com; s=arc-20160816; b=k3BGIjHV0HIE/MCqYHIP4SKpjfYw2orQlVFJ/hbdueLfExTWXxqyfASIN8T9T3SM29 glY/zKgeEHOOeYUezkrTU58ov07j5AxlqreLm89IVJkANxkuTOskL5XxmjjFgJDJxqhP ydmgejDrtGeLNqMRHpVs0WESRhZO4GRtGr3M98hYgXj1f8wwTHLB96AOfxdg9WVvG4ll pKsWzBSMn/xHRxG+GMXT8+JR02PnU5dRiQEJ/rclbQ6F477aJQE1gYbpM9lnCvgKIwbf FOHX07pp2UpJnkI7yEi3hLC585OxYlIiTo1ZethSX4E9Gt7V33I4dadrk5A8S9+GapwB ZdmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=uUmvjGYhDJMOGFj/fkGct3SdTnjx6Rbqpwp53VDHB5Q=; b=0XFsr5muMYVG1K8OWyo52EgTYFGcozxFrVVZTlYrTSkF/YhunUHKrvFDoIZs4L0c77 ufHSXW88x7+Kfdpqeyvf4biGcOVP3pOyyUsEM9nnn0Hxb7vA5P4I84NP0PmTvB8bz7tf JWdJqShIEuaETC0lnMmHI8+bPvEUm7dcFUcAJtQ9hL0I29XrTB1DLnvJIaNFzWJc+QDB /6KV5kkW4Imf7ZD1dczJJyCgu6mHqj3rkb8DlQ29ALlXCzWxOL1jRxXvd1sVsLzyq9oA P8Hydh7uDaBVrVdOY6k2qqKtkKvtgclitKV8/lxNj/o8uuByrlwuVq8wZQt8zhdfM7ua o/6w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b14-20020a056402084e00b004700047ef96si3974095edz.289.2022.12.16.11.46.49; Fri, 16 Dec 2022 11:47:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231590AbiLPT12 convert rfc822-to-8bit (ORCPT + 68 others); Fri, 16 Dec 2022 14:27:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231485AbiLPT1M (ORCPT ); Fri, 16 Dec 2022 14:27:12 -0500 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.85.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BC0B20BEC for ; Fri, 16 Dec 2022 11:27:11 -0800 (PST) Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-232-f6oopNjgN3u_Fg6iRUy8Sg-1; Fri, 16 Dec 2022 19:27:08 +0000 X-MC-Unique: f6oopNjgN3u_Fg6iRUy8Sg-1 Received: from AcuMS.Aculab.com (10.202.163.6) by AcuMS.aculab.com (10.202.163.6) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 16 Dec 2022 19:27:06 +0000 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.044; Fri, 16 Dec 2022 19:27:06 +0000 From: David Laight To: 'Steven Rostedt' CC: 'Andreas Schwab' , "'Leizhen (ThunderTown)'" , Geert Uytterhoeven , Josh Poimboeuf , Jiri Kosina , Miroslav Benes , Petr Mladek , "Joe Lawrence" , "live-patching@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Masahiro Yamada , Alexei Starovoitov , Jiri Olsa , Kees Cook , Andrew Morton , "Luis Chamberlain" , "linux-modules@vger.kernel.org" , Ingo Molnar , linux-m68k , "Jason A. Donenfeld" Subject: RE: [PATCH v9] kallsyms: Add self-test facility Thread-Topic: [PATCH v9] kallsyms: Add self-test facility Thread-Index: AQHZEWkbzV5WljPUpEGVjsixemOWL65wtOBggAAGFACAAAApIIAADHsSgAAbgaA= Date: Fri, 16 Dec 2022 19:27:06 +0000 Message-ID: <83701d57c0064c709669c03cecc38356@AcuMS.aculab.com> References: <20221115083349.1662-1-thunder.leizhen@huawei.com> <49070ac3-02bb-a3b3-b929-ede07e3b2c95@huawei.com> <4aaede14-8bd3-6071-f17b-7efcb5f0de42@huawei.com> <66ec4021-b633-09ba-73ee-b24cdb3fa25a@huawei.com> <06345dca-0afb-00a5-c9e9-5ba830d8ad05@huawei.com> <52450ec1da164d6d87587063c3b3d3d2@AcuMS.aculab.com> <592dce7a0de24c62bd31c29f86ce6c1b@AcuMS.aculab.com> <87pmcjidfe.fsf@igel.home> <1ba1fadb39994a4d91edabdfd9d69fa6@AcuMS.aculab.com> <87len7ibtt.fsf@igel.home> <87fsdfib07.fsf@igel.home> <819801284eb745d9a4189759bad297f5@AcuMS.aculab.com> <20221216115314.6120beb7@gandalf.local.home> <20221216121947.7d03b651@gandalf.local.home> <20221216123805.6eba002c@gandalf.local.home> In-Reply-To: <20221216123805.6eba002c@gandalf.local.home> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,PDS_BAD_THREAD_QP_64, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Steven Rostedt > Sent: 16 December 2022 17:38 > > On Fri, 16 Dec 2022 12:19:47 -0500 > Steven Rostedt wrote: > > > I assumed that "memory" was for memory unrelated to the input constraints. > > Well, it looks like you do need a "memory" barrier. > > https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html > > "memory" > > The "memory" clobber tells the compiler that the assembly code > performs memory reads or writes to items other than those listed in > the input and output operands (for example, accessing the memory > pointed to by one of the input parameters). To ensure memory contains > correct values, GCC may need to flush specific register values to > memory before executing the asm. Further, the compiler does not > assume that any values read from memory before an asm remain > unchanged after that asm; it reloads them as needed. Using the > "memory" clobber effectively forms a read/write memory barrier for > the compiler. > > As the "(for example, accessing the memory pointed to by one of the input > parameters)" is exactly this case. Without the memory clobber code like: int f(const char *s) { char c[4] = "abc"; return strcmp(s, c); } is very like to get optimised so that c[] is never written. However, in this case, the strings have all existed for ages. So that won't be the problem. It might be obvious what is wrong from the asm output. Although the binary-chop lookup is suspect I'd also check that the sorted index is plausible - just tracing the first 20 entries might be enough. No point peering at the search code if the setup is wrong. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)