From patchwork Wed Sep 29 22:02:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 12537965 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2AB04C433EF for ; Wed, 29 Sep 2021 22:02:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1146861501 for ; Wed, 29 Sep 2021 22:02:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346355AbhI2WEF (ORCPT ); Wed, 29 Sep 2021 18:04:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346794AbhI2WEE (ORCPT ); Wed, 29 Sep 2021 18:04:04 -0400 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 366FBC06176D for ; Wed, 29 Sep 2021 15:02:22 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id y1so2503172plk.10 for ; Wed, 29 Sep 2021 15:02:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=OxkIE1dbu6FoNq0lx2wamoNyrHmjGGBioMknIpC/Pfk=; b=V+arDGBSMCYnOlJ9cGqWq7uJwBxhZ/0YQnZokdnUjRkbI1HlwQcNlU7Kmm5w+GsfmZ y+g5aGDNyzIJqq+syuJesVShiCe43oS0TQBSwPyoqkAQzuTEY0nvF4QU8tEURa9Ug6Dh 1dV3JzZ2LQdrRHv0SnZq+FvnPChmDpkbt+gfk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=OxkIE1dbu6FoNq0lx2wamoNyrHmjGGBioMknIpC/Pfk=; b=ZjjenDC3185wH11JBaAT8S3Lmde6xT2RgllDWfL31wTNCm697BK2s8WobvcQa7AdPq dwpc8ALo0ZWlavQReP1S58UFBOOv/fF3Ogxmue1oMm9c9Niy3Pb3dGkwQ8ggUh1fhnP0 +B0lINCiwvljb61Hq2TFWrvKss/gQLABiX+1YPPXujb+Zwr5OdbWq9UhudV1mm+EcS4c IyVO5TOtf/0aRdrfsJGC7ChA7+2Ij+ma8KLHjBv6dOfoM46qsFdQMqcvLD79emylldNf gGCyA6//IGuaNvAGGXtuO7GLF9tHpiHGzfJ1OAzQT5hb+I71uS41lzNTf7dxGITHohml syfQ== X-Gm-Message-State: AOAM530FhJJzzsKI3TRY2G835/wUSnvu9qW4i5VD/ul1rZscWsr1GZqo tOKjpKya7a3E2Us+mnqM2L0RMA== X-Google-Smtp-Source: ABdhPJx6xx4h5SqMrKVFRjG28rHb+fGL260+7K8N196bFcr4W0jkT5QBchA3MbvlkGVh8gUH8330IQ== X-Received: by 2002:a17:903:1247:b0:139:f1af:c044 with SMTP id u7-20020a170903124700b00139f1afc044mr901411plh.23.1632952941659; Wed, 29 Sep 2021 15:02:21 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id n66sm691562pfd.21.2021.09.29.15.02.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 15:02:20 -0700 (PDT) From: Kees Cook To: Peter Zijlstra Cc: Kees Cook , kernel test robot , Vito Caputo , Jann Horn , Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Andrew Morton , Christian Brauner , Anand K Mistry , "Kenta.Tada@sony.com" , Alexey Gladkov , =?utf-8?q?Michael_Wei=C3=9F?= , Michal Hocko , Helge Deller , Qi Zheng , "Tobin C. Harding" , Tycho Andersen , Thomas Gleixner , Borislav Petkov , "H. Peter Anvin" , Mark Rutland , Jens Axboe , Stefan Metzmacher , Lai Jiangshan , Andy Lutomirski , Dave Hansen , "Eric W. Biederman" , Ohhoon Kwon , Kalesh Singh , YiFei Zhu , Josh Poimboeuf , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-hardening@vger.kernel.org, x86@kernel.org Subject: [PATCH v2 0/6] wchan: Fix ORC support and leaky fallback Date: Wed, 29 Sep 2021 15:02:12 -0700 Message-Id: <20210929220218.691419-1-keescook@chromium.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1594; h=from:subject; bh=ZGofaDaQvv5swu66diz0HTx6vEYZe6JmeIR1+gjHjAE=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBhVOJo1GLdlU2wxkAyCO58Imlf3QXU2yR9lYPTGObd B1gwkK2JAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCYVTiaAAKCRCJcvTf3G3AJkleEA C0CHxTyWL3o4ju8S4mS9f2AUVg0IGoeGrnoCfHhQRxAxIW1aguw87G6ss3RL56+eH9u4UWUxvnvxrp a8dN51L2JlYGFFU5m4QKwSEDqT0pwh+qhQUXA6vaqv2oisGZPls0qTbR6bHgsolBGj2eaFz0Gt4uGz UE/6clm4Hk01DWh/gAlZ91rnHsQT9Usv1vfD2Bhf7Lj+HC3aPk3b+WqrcxlYtBsHTr3moWKa3KnPa2 JigHBaawSMxjPz55TZBhQzEzMy6JwmnS2hOC8k4tsHGcW0htmLtghiUlWj7iSIJzrZFJwDygh/V7pX 2G3g2MZXghopkJiWsgrXdQBvMRi0/ukQHAlmI/Z6itjuPzInhOPwreJPF3wbUJQdi9pPy2rXUs3g3k XNFHXk9vlS2Xusv+s86tDIPkS5d+KeGKMQrdhTJp86TPOB224lqi/o2AMBUgA0iWiUNxjv+ncJL172 ktkh/fb4iOxZ3LRikVcAcIT8q+N13AkmGUzEtl+58FCxVJcMoOtz8hbWSTv1C1QRxFh7J1d2YJFfhf 4ATybEIql+XRoZIvUhDoz1v/eAnPMGS6sDIQIe9Ut4nOa5tQsdfF+J80Amvb6CvXTvx6Rf3UiZn7An +NKUct15CkPL9HTjmln4ayi4ElZQBaXNMHuNfbOFNPTOUtqnPThcyxgqIKCA== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Precedence: bulk List-ID: X-Mailing-List: linux-hardening@vger.kernel.org Hi, This attempts to solve the issues from the discussion here[1]. Specifically: 1) wchan leaking raw addresses since 152c432b128c (v5.12). patch 1 fixes this with a revert. 2) wchan has been broken under ORC, seen as a failure to stack walk resulting in _usually_ a 0 value, since ee9f8fce9964 (v4.14). patches 2-5 fixes this with Qi Zheng's new get_wchan() and changes to the /proc code to use the new helper suggested by Peter to do the stack walk only if the process can be kept blocked: https://lore.kernel.org/lkml/20210929194026.GA4323@worktop.programming.kicks-ass.net/ Peter, can you take this via -tip? Thanks! -Kees [1] https://lore.kernel.org/lkml/20210924054647.v6x6risoa4jhuu6s@shells.gnugeneration.com/ v1: https://lore.kernel.org/lkml/20210924062006.231699-3-keescook@chromium.org/ Kees Cook (5): Revert "proc/wchan: use printk format instead of lookup_symbol_name()" sched: Add wrapper for get_wchan() to keep task blocked proc: Use task_is_running() for wchan in /proc/$pid/stat proc: Only report /proc/$pid/wchan when process is blocked leaking_addresses: Always print a trailing newline Qi Zheng (1): x86: Fix get_wchan() to support the ORC unwinder arch/x86/kernel/process.c | 51 +++--------------------------------- fs/proc/array.c | 7 ++--- fs/proc/base.c | 20 ++++++++------ include/linux/sched.h | 1 + kernel/sched/core.c | 16 +++++++++++ scripts/leaking_addresses.pl | 3 ++- 6 files changed, 36 insertions(+), 62 deletions(-) Acked-by: Josh Poimboeuf