Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1028837pxb; Wed, 29 Sep 2021 15:18:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6DSxwjBnSSFIhENa+uu74lHWJM54VYhWNsWyUUJVCYHMLjoSpVl0krud0F96KkL1YZlba X-Received: by 2002:a63:4610:: with SMTP id t16mr1987221pga.176.1632953902446; Wed, 29 Sep 2021 15:18:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632953902; cv=none; d=google.com; s=arc-20160816; b=fueD/uC0ic9sp5tennJqagrRPIbtYF61Ai7jzJxiSapsvjKgJTmpis6VSwFzCfofj8 xAV4K2oNT3hIipAlA14rhv5bX1WEo9bDxaaoVNJJ8I9ku+iOVUINq93QB+64kHK56NnO xpGAzDth+DdyZq5Cgui8PadMLKs1xqMJdelbOsMIf2Q6yNHksg0Gg8Ycc5HYBb7sT+b9 VyOCMGp7qIFpEdv07ZuukUCaLQBaWr1dOWV9PJHAGoEDKd7bXDtTIywfMBF/BlAlxj/o Pt99zxJ89Cr1Bho4xkxbj7azktSQ/7/nG1sXqtsgVWACAWWlD1sH332RZEc6hGFE6HQy HdZw== 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=qyIj0uuuYD2n22GzyP1Tp1qkKngJHlSoFNMFwTLRsyo=; b=YyO/ltWXQXyf8YR4Zr2t5bzhG6yY/prqv4btfyZhPK0T0N4WuDh/wEkCvNH46MotQt yJ3w/o4K0UbE2460kUTq7gxzQBO5TRC2PuXl1uXRHF/nV4WYhhnkJzzXdX4cE/jWzu5h 1ipJFT9WBXTwYJXj/6MQWgDXoKjBdB9GiDCL/GtCN8BilAqp0DN7TrdquMviXqCN+6JT 1XusCJN6fDKI/4dIbCGInFOiYBv+6UdXdiUMVM1nRrMIFOAWyo+HIgVTG+IPTHo9Adw/ 9INxMn/UdG3QzeZCSUs0rBqy8mJ+g/hlJzUMicvB+vvbAf/GxgoH7eT8Z88CMr2KvnFo K/Yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=IvkOeEHV; 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 j6si1182779pgq.187.2021.09.29.15.18.03; Wed, 29 Sep 2021 15:18:22 -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=IvkOeEHV; 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 S1346603AbhI2T2P (ORCPT + 99 others); Wed, 29 Sep 2021 15:28:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346597AbhI2T2O (ORCPT ); Wed, 29 Sep 2021 15:28:14 -0400 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2242C06161C for ; Wed, 29 Sep 2021 12:26:32 -0700 (PDT) Received: by mail-pg1-x52d.google.com with SMTP id a73so815424pge.0 for ; Wed, 29 Sep 2021 12:26:32 -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=qyIj0uuuYD2n22GzyP1Tp1qkKngJHlSoFNMFwTLRsyo=; b=IvkOeEHVGJn8g4QIoGZC5vJvMkA5is7yCkwEyLBjjfmXJVSDFA8w0vX4YiJxFjA7i4 klUZfu4GPqbcWaHx1Dtb7yBc/ZL6pq2CwDTZmCAslYr4EzPvMFGYDGnNSeU0eGyM5Yv3 7SXpxQbn3QwzsGeAaJoMYXHsmtw9YlKOLdthA= 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=qyIj0uuuYD2n22GzyP1Tp1qkKngJHlSoFNMFwTLRsyo=; b=XHS/F6WQ99FZTbiZadxFLUoaE0KlcwJlonBK4nSCP8GOlf05FKJ3MfCzIK9q8kLmFa FpHmutcZX2aEfpZlVhNdL1T1nEqBQKSrsCklv8SvZXxDY6vtkDTiWtNxYDezNfOazF/p RfXD7nSYG/l2XIrgou+BcxUHts9j5rM1vVIpGgKDoqkQ1bdCKgndIsSsTNOmnZMh1V7M IooAK1rkwquGKJ9hp7cAPkFtH8wiZWVYzCneWJNjPTAsZpMRy059fUdZmlvZX1RZ1KHq gTQYXIweQ1A8AqXSs0meHUyDC2/ty/uxIPNpM/zluDGnVg7S/8IOLZTaIaGcpiJc7mcn pFJg== X-Gm-Message-State: AOAM5332jf43iqtUnyxOQd3Kv1dCt7k7atnVi4hEtEfDYAMAzgs9P9dK x4xlwOb1FeQ2wPA5t0xHHyO3rQ== X-Received: by 2002:a62:5297:0:b0:3f4:263a:b078 with SMTP id g145-20020a625297000000b003f4263ab078mr397109pfb.20.1632943592305; Wed, 29 Sep 2021 12:26:32 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id h3sm415376pju.33.2021.09.29.12.26.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 12:26:31 -0700 (PDT) Date: Wed, 29 Sep 2021 12:26:30 -0700 From: Kees Cook To: Mark Brown Cc: Josh Poimboeuf , Mark Rutland , Vito Caputo , Jann Horn , Thomas Gleixner , 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" , Qi Zheng , 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: <202109291224.8C538667@keescook> References: <20210924002230.sijoedia65hf5bj7@shells.gnugeneration.com> <202109231814.FD09DBAD3@keescook> <20210924135424.GA33573@C02TD0UTHF1T.local> <202109240716.A0792BE46@keescook> <20210927090337.GB1131@C02TD0UTHF1T.local> <202109271103.4E15FC0@keescook> <20210927205056.jjdlkof5w6fs5wzw@treble> <202109291152.681444A135@keescook> <20210929190042.GU4199@sirena.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210929190042.GU4199@sirena.org.uk> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 29, 2021 at 08:00:42PM +0100, Mark Brown wrote: > On Wed, Sep 29, 2021 at 11:54:55AM -0700, Kees Cook wrote: > > On Mon, Sep 27, 2021 at 01:50:56PM -0700, Josh Poimboeuf wrote: > > > > Even with that patch, it doesn't lock the task's runqueue before reading > > > the stack, so there's still the possibility of the task running on > > > another CPU and the unwinder going off the rails a bit, which might be > > > used by an attacker in creative ways similar to the /proc//stack > > > vulnerability Jann mentioned earlier. > > > Since I think we're considering get_wchan() to be slow-path, can we just > > lock the runqueue and use arch_stack_walk_reliable()? > > Unfortunately arch_stack_walk_reliable() is only available for powerpc, > s390 and x86 currently - work is in progress to implement it for arm64 > as well but it's not there yet. Strictly speaking, we're only trying to fix this for x86+ORC. The other architectures (or non-ORC x86) already have their own non-ORC unwinders behind get_wchan(). They may have similar weaknesses (which should certainly be fixed), I think the first step here is to restore wchan under x86+ORC. -- Kees Cook