Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp113403pxb; Tue, 21 Sep 2021 20:31:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMe7z04X1wuzpCXhj9np3aK7ZEttOIEAOMnvB/v+rtUf9OdOdsKaCIiSwB7Zx9F+gzjcIc X-Received: by 2002:a05:6e02:1caa:: with SMTP id x10mr23602308ill.280.1632281468644; Tue, 21 Sep 2021 20:31:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632281468; cv=none; d=google.com; s=arc-20160816; b=OKDYmiuXD/KyNgt+jdeCugr+ALFajrMyLwtxU7tONk/Ik4kK7RkdlUcJ6l9Y1y9NDj 7CDnnKJ3H2ciZYqkrGwdIDNIfn2JjwLiJO2u9sH2SK/lkGnTFCbRva9C4sjJ3GcaJ94J tyMmYe8zLSMg2fFrMFserKTkkCuIz1RMMZUfA2V/U6ZJ2y1r+BwpT86iLmuy3jMumbiL 0bR4jvOlS5T0ad6AwUUl5tCq29pAjb/JEirgv7mvIodDDDzMO1uZeIEMn4NyUpCVSxmR OeWJHNJh4LbaTv/YHF9z+yksV6YgtDZq7zhoFGWEZmAs+1DC2O/fwi/TAJau26KdfV4/ p7tw== 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 :mime-version:user-agent:date:message-id:from:references:cc:to :subject:dkim-signature; bh=p3Afjb9SH1bKicKYKOh4KrtaQEM6g/6mD1pI9nF9WC0=; b=kAb2SvWAlA+KSkUji5hW5yDxtUoVujiYiHgIXfthbJiBVPdeSM3ox8mbfZNv8DDUZn LEhcRuLQWoV9w+XelnrUo73QhirJvCV+gud427mSvm2Pjgxqpz4v9Ta67K9H/PthjBl8 zVhCsL4XBN8b/9O6zyifyZnm98T9+rDzuK5erqaFxlksJyIj2WgSxkvPHH/khfZ9Csa9 wxwnPoZCQWcYCw66B3OqepQXcc3lrr+f8QW90i1Eue+sKUDxZ+eA9wW/SKgLDXnIFBII 3JVOjOnAibhfVDp8zV+m0xmzJ15k3A99vIrOGvPO7TMRr2HlCRBCtGlbpSO2GjJk1kZO Xrtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b="cbxtgRR/"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d10si1128767ilu.50.2021.09.21.20.30.49; Tue, 21 Sep 2021 20:31:08 -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=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b="cbxtgRR/"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231154AbhIVDbk (ORCPT + 99 others); Tue, 21 Sep 2021 23:31:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230054AbhIVDbj (ORCPT ); Tue, 21 Sep 2021 23:31:39 -0400 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34F8CC061574 for ; Tue, 21 Sep 2021 20:30:10 -0700 (PDT) Received: by mail-pf1-x42b.google.com with SMTP id q23so1474276pfs.9 for ; Tue, 21 Sep 2021 20:30:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=p3Afjb9SH1bKicKYKOh4KrtaQEM6g/6mD1pI9nF9WC0=; b=cbxtgRR/t2MdrPtKmSUYSAfi2a/Vgmxy02JtKodeTYaG3SLpK7ZBMI7MjGa5pP+aJo hihiwCcVI4V2CvaHj5CWhWH9UMjGVvoN9SHc1e+tFQTNZm7TecJw7KUXeG6ERJ1/6hud JNqHBtlzuTvoRXAkO1OWG9pfcHSa9kjVVmAzKd/s+fraAMUMxbkI4W7DO5VFXG1R81hT ynhDPI2XJRSHXqNhDJazKybvKA9tV+mebXiDiIjmKOfsua8QRCIGbP0JkzL63zEoGkRK R8givsnGxJL42krSwQhLpubs8ftsp7w3z/MjvYNSnzxOtOX6Ie7Wq+VldOCqi1GDJiw+ RfCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=p3Afjb9SH1bKicKYKOh4KrtaQEM6g/6mD1pI9nF9WC0=; b=pPCxQAFw9Uw5JMnpBkorWb7LmxV6Md5k3F3/XQcH8F8aH1rPQxql82vs7PuAkgYlU5 6xjUJcrWoNcBoTcofrJ11rh05BDBE77LXaEa0oDMFrPJvXdHwOK8qD6w3nurp2iJ2zL9 tQfxnusLIKZeGlr/aG395DQhs9xKpybaECVTC79htodL2XSBPWPc76IPRcDfY7YP+Ell D+RTTdoFUCGCgCg3I403vbEIILg1PEFSIwK8y+sejXmdJSqGCe8kzFa79nY606zjvxvV xXzSQb2CGz0298aViyGsVYbIYZg6Ro5fAZklKrlHdVmfsx37hP9mtBxOPDySlqhgFxm4 0eCQ== X-Gm-Message-State: AOAM53380LrW7HxmZyJLnHXg/ag2CXmzayHWIc1krMRk7MciGST/9IAR oPNDsYSemGGTeNc+IvKDkxthiw== X-Received: by 2002:a63:d017:: with SMTP id z23mr31183583pgf.108.1632281409740; Tue, 21 Sep 2021 20:30:09 -0700 (PDT) Received: from [10.255.73.99] ([139.177.225.230]) by smtp.gmail.com with ESMTPSA id g22sm486882pfb.191.2021.09.21.20.30.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 21 Sep 2021 20:30:09 -0700 (PDT) Subject: Re: CONFIG_ORC_UNWINDER=y breaks get_wchan()? To: Josh Poimboeuf , Vito Caputo Cc: linux-kernel , x86@kernel.org, peterz@infradead.org, luto@kernel.org, jannh@google.com, Kees Cook References: <20210921193249.el476vlhg5k6lfcq@shells.gnugeneration.com> <20210922001537.4ktg3r2ky3b3r6yp@treble> From: Qi Zheng Message-ID: <930f0c5e-0fd4-aae7-334f-ec9cc42998a4@bytedance.com> Date: Wed, 22 Sep 2021 11:30:01 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20210922001537.4ktg3r2ky3b3r6yp@treble> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > > The kernel is much more cautious than it used to be about exposing this > type of thing. Can you elaborate on your use case? > > If we do keep it, we might want to require CAP_SYS_ADMIN anyway, for > similar reasons as > > f8a00cef1720 ("proc: restrict kernel stack dumps to root") > > ... since presumably proc_pid_wchan()'s use of '%ps' can result in an > actual address getting printed if the unwind gets confused, thanks to > __sprint_symbol()'s backup option if kallsyms_lookup_buildid() doesn't > find a name. > > Though, instead of requiring CAP_SYS_ADMIN, maybe we can just fix > __sprint_symbol() to not expose addresses? > > Or is there some other reason for needing CAP_SYS_ADMIN? Jann? >