Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1571759pxb; Fri, 24 Sep 2021 07:28:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywjEjNEW2laAfIeEkFbR+cdryqT1PfvUhb07kpSbKv0D6AzZe7MQ/kZpvC6IIaKJPg+wTS X-Received: by 2002:a50:d8c7:: with SMTP id y7mr1919898edj.133.1632493708719; Fri, 24 Sep 2021 07:28:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632493708; cv=none; d=google.com; s=arc-20160816; b=pBeMrpP9BBuL3SLpjqJTPi7CwXu8NjiRzQDYu45XPGjOyETR2rZoK3bf1QpqZWgnB4 54CETzeqEQdqVf0iwKl4K8XfIF13ooNXr3N3fR1ANF9K7a0OXmHZNq3+H8wySLZF5QAv +mj+cFw1GbPHjpqS2gBCROtnsvte1mZL8hLda9bcnmJ70cjhnhjMguOEUmohdjNpkjWP uv/PeEgWgIHJMreL1l4TJ0IHikNWRLxH6RxDNXbxwXi9tn+oQj32cw7ofSJbn85VHEnt CZPtNWcLewotAJNijSl62WigY0sM0o7KNA7xuqX465TyQ2KtmwbGQ8h75zirHAKkCRHY busA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=oGzzGbeOeLEORaxwOD7BLDmEH+a0amSJ/nYoDh8OWO0=; b=phLs6EeQbuCmq/KKaJTcPWdYVY1OhigJ3V5LVmH4krMDsszleFc3IMZGeu9krnXnjY yd2TAlP5zzZJZ+bV95nHFzJ+4q39mmtZ3ky0IxqVDChuMjba0kIBPt4yAaviv86HwHj4 luXsyUNifHoJO0+dhgLAgPRZHOzXkU4oPg13kFF6kyAbg2TzNikde4zQxKl9xxppS3BN qyl0woBpi4yMEFctQCR26jonTLQDYlmWDBjlTGVh06ig71ZNGn/K9ENuTnLBuALzPG60 Q+dkVrU1zQ13RqUr2rzellaWlux6DllvowMJeBdypr3KvvXdieQwF3e+AZC2K/wNttrc DIGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=FGOqdb8W; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b7si12793603edm.76.2021.09.24.07.28.02; Fri, 24 Sep 2021 07:28:28 -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=@chromium.org header.s=google header.b=FGOqdb8W; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345603AbhIXO16 (ORCPT + 99 others); Fri, 24 Sep 2021 10:27:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233427AbhIXO15 (ORCPT ); Fri, 24 Sep 2021 10:27:57 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4280C061613 for ; Fri, 24 Sep 2021 07:26:24 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id y5so4136206pll.3 for ; Fri, 24 Sep 2021 07:26:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=oGzzGbeOeLEORaxwOD7BLDmEH+a0amSJ/nYoDh8OWO0=; b=FGOqdb8Wc6HM1sjK/2fbXMNHDvLwKPUuowC529hVtm8I6s3/4QxQ1YBVBPiENwD5cf MLK8nggL/D+kCwp/GZZaFYbBbBGuqWUwxJeHpm+2nwMZzck6aP11onhvZEBmpcVEVK8c YOS4HwQtsAu3rZGTzfjU2+fJz4DuOZxiWFrE0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=oGzzGbeOeLEORaxwOD7BLDmEH+a0amSJ/nYoDh8OWO0=; b=x6+yt2sYFwWA+pq054A4wfZWEmS43ZK4OeGTc1PUNKVsVYev3TywpsLmtmsxO4RpA3 MU09IAi2pIUPE3gNb11qfixHu2urFMcEQWbWbnBkPP0Dd8cvj6DvYldW8fIqE3yncuZS fRfCXaJq3SMPxT1W7K0wwHxmxkVpoWraA2liWsT8/+WiTJzhPQktba3fk9rhTwMhzUTT gctjb1amsLU+mOdPwXus68DNTuZgaut4qwXDzK/aWNNYwizWrm5rXZUP93l6ghS8u6r0 NoozJkNGMx0p0+s4+LJ46sEj+RyhMV5K0R0H8R8nwfdbinOYu6qzhfEPu3AOn1cCVigb QevA== X-Gm-Message-State: AOAM533Ti/KoPQphd/DBc9qspR4UVWAMJdDIduytZpJDbvDhrhAhKZx9 76g8sJmk6pkzKHL+7F1lDmpMAw== X-Received: by 2002:a17:902:c948:b0:13a:345c:917c with SMTP id i8-20020a170902c94800b0013a345c917cmr9245252pla.61.1632493584372; Fri, 24 Sep 2021 07:26:24 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id k15sm8893038pfh.213.2021.09.24.07.26.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Sep 2021 07:26:23 -0700 (PDT) Date: Fri, 24 Sep 2021 07:26:22 -0700 From: Kees Cook To: Mark Rutland Cc: Vito Caputo , Jann Horn , Thomas Gleixner , Josh Poimboeuf , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Jens Axboe , Peter Zijlstra , Stefan Metzmacher , Andy Lutomirski , Lai Jiangshan , Christian Brauner , Andrew Morton , "Kenta.Tada@sony.com" , Daniel Bristot de Oliveira , Michael =?iso-8859-1?Q?Wei=DF?= , Anand K Mistry , Alexey Gladkov , Michal Hocko , Helge Deller , Dave Hansen , Andrea Righi , Ohhoon Kwon , Kalesh Singh , YiFei Zhu , "Eric W. Biederman" , linux-kernel@vger.kernel.org, x86@kernel.org, linux-fsdevel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] proc: Disable /proc/$pid/wchan Message-ID: <202109240716.A0792BE46@keescook> References: <20210923233105.4045080-1-keescook@chromium.org> <20210923234917.pqrxwoq7yqnvfpwu@shells.gnugeneration.com> <20210924002230.sijoedia65hf5bj7@shells.gnugeneration.com> <202109231814.FD09DBAD3@keescook> <20210924135424.GA33573@C02TD0UTHF1T.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210924135424.GA33573@C02TD0UTHF1T.local> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 24, 2021 at 02:54:24PM +0100, Mark Rutland wrote: > On Thu, Sep 23, 2021 at 06:16:16PM -0700, Kees Cook wrote: > > On Thu, Sep 23, 2021 at 05:22:30PM -0700, Vito Caputo wrote: > > > Instead of unwinding stacks maybe the kernel should be sticking an > > > entrypoint address in the current task struct for get_wchan() to > > > access, whenever userspace enters the kernel? > > > > wchan is supposed to show where the kernel is at the instant the > > get_wchan() happens. (i.e. recording it at syscall entry would just > > always show syscall entry.) > > It's supposed to show where a blocked task is blocked; the "wait > channel". > > I'd wanted to remove get_wchan since it requires cross-task stack > walking, which is generally painful. Right -- this is the "fragile" part I'm worried about. > We could instead have the scheduler entrypoints snapshot their caller > into a field in task_struct. If there are sufficiently few callers, that > could be an inline wrapper that passes a __func__ string. Otherwise, we > still need to symbolize. Hmm. Does PREEMPT break this? Can we actually use __builtin_return_address(0) in __schedule? -- Kees Cook