Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1663324rwl; Fri, 7 Apr 2023 22:33:44 -0700 (PDT) X-Google-Smtp-Source: AKy350aHJ19ZY1wXoy5cSmg4sV0jQQfJbTVp8pDZ7vImdp0NAXCR5wZYtSUmW8PRtjQlxsd0nMo8 X-Received: by 2002:a17:903:2445:b0:1a2:8c7e:f310 with SMTP id l5-20020a170903244500b001a28c7ef310mr1149668pls.35.1680932023784; Fri, 07 Apr 2023 22:33:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680932023; cv=none; d=google.com; s=arc-20160816; b=fNqtH6GTFsWIpt8sL2DvX0lY3Jl1SQz88GU82kQxKkyenISX48UQNq3c+CyXDvT/df oO8PHHfwqhj/tj/P5FOIh0rwLsNExxJadc3bhRePazZFxQ1MQ+d/qdxERZyh7aMbevrU oY13yRfmL2NBBgtpmK2NW86th5gfkx+RhdvrSpCbbJt2Nwrp78iWi8BX458buiy+lp6e k2XCtbhrtQiIXjVQybh8ROWO2/E0i3wd8kpWoPolzpdM3CzW/lbpzRqdO3rWTjevGfuA MKtzzQSdt6/lxYxfJOyjUXALbiypmIgyAlDr+BOX6opRsW4qq8k0nC9wvrVCBpBRq3lh Z8kA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=l9Ug1/tPy8825Ij6g3Q1xr/XLB0Q00SXY0Q+3fkJ87I=; b=B7wFWWHV4nc4oDffVBc9A7FYA3Rkq6fjXbdDnWYzekwdtyUR8DG6ZJ6iIdSSB1w2+v XRsWPbsmkML6a1KRobN+PA61XuMTWZ7647Bz+QPHikATsE3Nj1AJqymlmsK8zIM/o/EJ qDdC42DO9L6lWrmUxbKHlew+YD4MDqiuS67bM+EnPUFrrz1yoftdkAAnXS6zhHP42nAi rrgGNTrfcqCKzGJ5MGAUz+qYrbmzFXzUXVT1RpDC5/NlHBEyEauV84dgcanVZd5w9mIw rcylD3Fx8E1g9V2BTmm9jjDMg+YlkDVoN8hVXlhm7U7vs7gDLBQm7GcOIvQHgCQ3KhSL N5mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=Yb3hSRf2; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bm18-20020a656e92000000b0050fad5c9f36si4716245pgb.354.2023.04.07.22.33.30; Fri, 07 Apr 2023 22:33:43 -0700 (PDT) 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; dkim=pass header.i=@bytedance.com header.s=google header.b=Yb3hSRf2; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229583AbjDHF1A (ORCPT + 99 others); Sat, 8 Apr 2023 01:27:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229457AbjDHF07 (ORCPT ); Sat, 8 Apr 2023 01:26:59 -0400 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FC994C31 for ; Fri, 7 Apr 2023 22:26:33 -0700 (PDT) Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1a4f8e5d190so1905445ad.1 for ; Fri, 07 Apr 2023 22:26:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1680931593; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=l9Ug1/tPy8825Ij6g3Q1xr/XLB0Q00SXY0Q+3fkJ87I=; b=Yb3hSRf2FsUFXMLYYdY9LMwFMyWb8qrW/uxnioGRwu+ZnGIYTc8KU1p8nH4W5OTqbM BOJf2IueXnELAbFsVGUxTJ2nvJLbionN6t0/S6kDlLw1tsaAcpSY4nTeHwXcYwF2Xqa4 A4oeAHjLyOD5q7faetdPAjnXuqoiriwCFIDv0skoViXZCv4coseA4zh4D4yN8+EEMBrq CNJMgm4SPaKqQT1eY18lt8w8Y15kjsW88cClXT23pEgzGgJlcFecZ2JT4tizdxTAArpl mCHHViiS3ujfnW19hJ5p1wlTtNHRjEaNmXjJPulxvPHjTnKc2ZpvjABhG/nsST6E7/R/ 3Kow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680931593; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=l9Ug1/tPy8825Ij6g3Q1xr/XLB0Q00SXY0Q+3fkJ87I=; b=XvesW8pSKeO2okyn8w8mu3IF+9S2Nu/j+JPyAV1BwVv/iDY6wDuTixDsTaIjIHVc1c bXrKbnxXLIHiU+9jN8sPxUxb1QrozdC5TngoB2EI7jotlHEYwlAR2kPNcw1WnYMlP8XF F7j23h8FeVFezhcwGifY41Stc92QzIULXneNbNlPdv1Oe2SfMbmQBSMkmjorzneWOUdA qp+F96LbVcCZMz1OpELbESSQYqSd/R6roGeB0tio8xOUgZgIgQh9TYlAulHS3O0nWQwh MCAJPLno0tdhVtiueCUylQrSIRHnivJ2YM+ATWcb3oOht/0hO95WKpLkp/a6dQsHwM9t GG8A== X-Gm-Message-State: AAQBX9fUyUWGrQ6JaUyfaGDFu+CNFIg37iQ0ROiPk6ybAHf8+N8kLjUE hcJnSMIy/0c5D2Xo2YTupuFp+A== X-Received: by 2002:a17:90a:2c0c:b0:244:a41a:f658 with SMTP id m12-20020a17090a2c0c00b00244a41af658mr1430858pjd.4.1680931592790; Fri, 07 Apr 2023 22:26:32 -0700 (PDT) Received: from [10.200.9.10] ([139.177.225.254]) by smtp.gmail.com with ESMTPSA id cm24-20020a17090afa1800b0023af4eb597csm5459137pjb.52.2023.04.07.22.26.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 07 Apr 2023 22:26:32 -0700 (PDT) Message-ID: <9bd50ce2-0ac8-a5dc-a584-0610891c7805@bytedance.com> Date: Sat, 8 Apr 2023 13:26:25 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [PATCH 1/2] x86: make profile_pc() use arch_stack_walk() Content-Language: en-US To: Josh Poimboeuf Cc: peterz@infradead.org, keescook@chromium.org, dave.hansen@linux.intel.com, bp@alien8.de, mingo@redhat.com, tglx@linutronix.de, rostedt@goodmis.org, x86@kernel.org, linux-kernel@vger.kernel.org, Chen Zhongjin , Andi Kleen References: <20230330081552.54178-1-zhengqi.arch@bytedance.com> <20230330081552.54178-2-zhengqi.arch@bytedance.com> <20230408045619.m5zfbispodf4zjvz@treble> From: Qi Zheng In-Reply-To: <20230408045619.m5zfbispodf4zjvz@treble> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 On 2023/4/8 12:56, Josh Poimboeuf wrote: > On Thu, Mar 30, 2023 at 04:15:51PM +0800, Qi Zheng wrote: >> The profile_pc() try to get pc by doing a trick to read >> the contents of the stack. This may cause false positives >> for KASAN, like the following: >> >> BUG: KASAN: stack-out-of-bounds in profile_pc+0x5b/0x90 >> Read of size 8 at addr ffff8881062a7a00 by task id/130040 > > I don't think this was actually a false positive. The !FRAME_POINTER > code in profile_pc() has been badly broken for many years. > > BTW, there was a similar patch here: > > https://lore.kernel.org/lkml/20230224021858.120078-1-chenzhongjin@huawei.com/ Ah. > > I thought CONFIG_PROFILING was obsolete but Andi said previously he > wants to keep it for at least boot-time profiling. > > Andi did suggest removing the lock profiling hacks, which means all the > profile_pc() implementations can just be removed in favor of the generic > instruction_pointer(). That's great, and I see Chen Zhongjin will send a new patch for this, let him continue this work. :) > -- Thanks, Qi