Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp4115915pxb; Mon, 4 Oct 2021 17:56:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJykCUIcJaTe7yaqK08bdFCoNAWN2MH00X7t8S5ZqZpxFljv46sGC8JK2T0213e0AdFyZX3m X-Received: by 2002:a17:906:e4b:: with SMTP id q11mr20687557eji.234.1633395392170; Mon, 04 Oct 2021 17:56:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633395392; cv=none; d=google.com; s=arc-20160816; b=kyL4e3T+kVO82yy9Wqpq+jU9Evko+uE9gsOwOC1j52miIDQ/got7woT6lp9YeFTpoG GtBuq7yG8yeg2yn6xy7YUKUgme3UmdEvyykJJf34jSmIJql/KogBu0UPERWpQzF1d2/t /tSo3gfrtZWOSkrTPr+asEi2rw15plPj42NvCgDetg34zz15SzqZ1criAV2lhVgYhKZ/ pm/3y0Lf4MR/+tBX7nHbr41FfVotxdMGzNSte2jolGt0C+yHyWReHlkI6s3LW779o1n6 lITpRsFaxsCSRGORuI00YyBuXy8bT50puKnhR4UDfRAZAmkcQepwU+z+UEwJiWmOrBWD pUaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:references:in-reply-to :message-id:mime-version:user-agent:dkim-signature; bh=z1XWZFId95Q+xN5rpLMbRZtBPtotfMCp+4EvM1/86so=; b=I68ZI6Vih2b2l0ptlyxj4tDZBiasyhWOGDosCLzjpCqDXkRpRUIoD2V608TovGtFNy AA6/Xh1hWszAJc112rqUfITqiKnh5HsB7XaRdkx+vCe+YSSN5VgGdsmWCoTDmp9dzRgg csYsa7HW3RJkjsIwIQq/7403lGUrOfVzsnUCXsT9vyEt56U1iuQjmHpyEXZn9W22/Ew3 kVi0nwmgHAwYz2/ZQn0vDgvG1JMezWgVC7EDZZo0a9QB9TbKKKyos8aJDAXkHnN4Fs2V be0Yp2x30P5IT/96AeETT/LlzBLVrXS9RyUkgfrAHmoRi5vK0tDnYwPwSsRsnLNBa1Bi M/vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MJPOv6ix; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j7si19148048edt.387.2021.10.04.17.56.08; Mon, 04 Oct 2021 17:56:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MJPOv6ix; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229744AbhJEAx1 (ORCPT + 99 others); Mon, 4 Oct 2021 20:53:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:44762 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229549AbhJEAx0 (ORCPT ); Mon, 4 Oct 2021 20:53:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 69FD460F6E; Tue, 5 Oct 2021 00:51:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1633395097; bh=QrIIJoWY9BAxpyYAsUv/GufuYaX5OfLNAqqeNZ+sLvk=; h=In-Reply-To:References:Date:From:To:Cc:Subject:From; b=MJPOv6ix/VXW9+JiizAh45MfVBPCnP/1mmFsEjUAUchkzXmLzaSK+vuYUQ/8oa7Ht 81VR4xIpPHWIvu6aqLiBCUpzR5oMXF9wEWs9jOeKys3vzu2hcR1l+W83OFyH9mVb5c WnETJNJrAVv8Q9GCxFvFFPdjPlwlRq2Yp9M2N9T+1rzJ9yr6CatRA2LRgQ7zqT2bog TnAZfeWA/ZRwCv1vtNTmtO8B/88Z8gE+jbvAkuDv45aOn7c8PGxzT0sjEuQB3Bsncu iAQ2x8UPQdWwfDDVFIx3bdc6Il+1QX5gF+GcmQ2IOX1qODiv+ZoV/7D47soH6/bjFm tiUYcoREok+QQ== Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailauth.nyi.internal (Postfix) with ESMTP id 85E0527C0054; Mon, 4 Oct 2021 20:51:35 -0400 (EDT) Received: from imap48 ([10.202.2.98]) by compute6.internal (MEProxy); Mon, 04 Oct 2021 20:51:35 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudelfedgfeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdetnhgu hicunfhuthhomhhirhhskhhifdcuoehluhhtoheskhgvrhhnvghlrdhorhhgqeenucggtf frrghtthgvrhhnpefhlefhudegtedvhfefueevvedtgeeukefhffehtefftdelvedthedt iedvueevudenucffohhmrghinhepkhgvrhhnvghlrdhorhhgnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghnugihodhmvghsmhhtphgruhht hhhpvghrshhonhgrlhhithihqdduudeiudekheeifedvqddvieefudeiiedtkedqlhhuth hopeepkhgvrhhnvghlrdhorhhgsehlihhnuhigrdhluhhtohdruhhs X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id E86C521E0063; Mon, 4 Oct 2021 20:51:34 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-1322-g921842b88a-fm-20210929.001-g921842b8 Mime-Version: 1.0 Message-Id: In-Reply-To: <930f0c5e-0fd4-aae7-334f-ec9cc42998a4@bytedance.com> References: <20210921193249.el476vlhg5k6lfcq@shells.gnugeneration.com> <20210922001537.4ktg3r2ky3b3r6yp@treble> <930f0c5e-0fd4-aae7-334f-ec9cc42998a4@bytedance.com> Date: Mon, 04 Oct 2021 17:51:14 -0700 From: "Andy Lutomirski" To: "Qi Zheng" , "Josh Poimboeuf" , "Vito Caputo" Cc: "Linux Kernel Mailing List" , "the arch/x86 maintainers" , "Peter Zijlstra (Intel)" , "Jann Horn" , "Kees Cook" Subject: Re: CONFIG_ORC_UNWINDER=y breaks get_wchan()? Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 21, 2021, at 8:30 PM, Qi Zheng wrote: > On 9/22/21 8:15 AM, Josh Poimboeuf wrote: >> On Tue, Sep 21, 2021 at 12:32:49PM -0700, Vito Caputo wrote: >>> Is this an oversight of the ORC_UNWINDER implementation? It's >>> arguably a regression to completely break wchans for tools like `ps -o >>> wchan` and `top`, or my window manager and its separate monitoring >>> utility. Presumably there are other tools out there sampling wchans >>> for monitoring as well, there's also an internal use of get_chan() in >>> kernel/sched/fair.c for sleep profiling. >>> >>> I've occasionally seen when monitoring at a high sample rate (60hz) on >>> something churny like a parallel kernel or systemd build, there's a >>> spurious non-zero sample coming out of /proc/[pid]/wchan containing a >>> hexadecimal address like 0xffffa9ebc181bcf8. This all smells broken, >>> is get_wchan() occasionally spitting out random junk here kallsyms >>> can't resolve, because get_chan() is completely ignorant of >>> ORC_UNWINDER's effects? >> >> Hi Vito, >> >> Thanks for reporting this. Does this patch fix your issue? >> >> https://lkml.kernel.org/r/20210831083625.59554-1-zhengqi.arch@bytedance.com >> >> Though, considering wchan has been silently broken for four years, I do >> wonder what the impact would be if we were to just continue to show "0" >> (and change frame pointers to do the same). > > Agree, Or remove get_wchan() directly. I agree. wchan is a hack that may or may not do anything useful. We certainly should not be reporting things derived from the stack trace to unprivileged tasks. And it's probably just as racy as /proc/.../stack.