From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32852C433EF for ; Wed, 8 Sep 2021 07:47:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C388461168 for ; Wed, 8 Sep 2021 07:47:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C388461168 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 5B55E900002; Wed, 8 Sep 2021 03:47:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 565016B0071; Wed, 8 Sep 2021 03:47:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 42CAE900002; Wed, 8 Sep 2021 03:47:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0026.hostedemail.com [216.40.44.26]) by kanga.kvack.org (Postfix) with ESMTP id 2FF856B006C for ; Wed, 8 Sep 2021 03:47:50 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id DFFE918264840 for ; Wed, 8 Sep 2021 07:47:49 +0000 (UTC) X-FDA: 78563627058.17.125768B Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf03.hostedemail.com (Postfix) with ESMTP id 817F33000096 for ; Wed, 8 Sep 2021 07:47:49 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id A46A6611BD for ; Wed, 8 Sep 2021 07:47:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631087268; bh=g+KPm8DVe7Iqx7fs4fJUSuXyAmNC6ljwYldCl8uZcPY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=J0ah/Gbc6BEStYii3MQu7/yiQ+zrxiYuTepLreOq5Sbmtp1p2kc5fGlT2ni2SJPg9 LLEupvji7CZ95xmDVR2tkCxqDV4f4hOVvlcoTXWL5C798wqE3JurN6Q2Z4XGmGtY7X 1sXay84RqOToCvPCw3rjpilYZyc0sIiOg0SRyGcTHEccFJXn2GkfJyo1HWkmSacRiz mEc+wnCDo8I7FZZApUkc7a2ZjXCtbFinHbPhxuPEAKFdRx1JlaAUKjFzpj8rxgEIcJ 13gru/HpGhRf1NU6pWNs43WQVIjQa1SIwygAva87ggeu2Zkoe2WioiVHbIU5fpUeHi sR7VC3EKkxh3Q== Received: by mail-oi1-f171.google.com with SMTP id w144so1990787oie.13 for ; Wed, 08 Sep 2021 00:47:48 -0700 (PDT) X-Gm-Message-State: AOAM533s+O+McZC0lGg79/mlkv9Fg+X3qdT8Rsw3aacxDCqHW01tXuEc P8QIsZA6Ydl6/ICalhs/dCvOeB5cvFB1lyL24sk= X-Google-Smtp-Source: ABdhPJyS9VA1EqDPnto6QI61xcnEBBARNumEGt1UOSEs+dAjZ4s2lGUjjMxxKPshi0co05+lSMvEZgfDiEASfHERUHY= X-Received: by 2002:a54:418e:: with SMTP id 14mr1463170oiy.174.1631087267929; Wed, 08 Sep 2021 00:47:47 -0700 (PDT) MIME-Version: 1.0 References: <20210904060908.1310204-1-keithp@keithp.com> <20210907220038.91021-1-keithpac@amazon.com> <2d5e3f95-77ce-cd26-9020-3c1a8a65e799@canonical.com> In-Reply-To: <2d5e3f95-77ce-cd26-9020-3c1a8a65e799@canonical.com> From: Ard Biesheuvel Date: Wed, 8 Sep 2021 09:47:36 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 0/7] ARM: support THREAD_INFO_IN_TASK (v3) To: Krzysztof Kozlowski Cc: Keith Packard , Linux Kernel Mailing List , Abbott Liu , Andrew Morton , Andrey Ryabinin , Anshuman Khandual , Arnd Bergmann , Bjorn Andersson , Christoph Lameter , Dennis Zhou , Geert Uytterhoeven , Jens Axboe , Joe Perches , Kees Cook , Linus Walleij , Linux ARM , Linux Memory Management List , Manivannan Sadhasivam , Marc Zyngier , Masahiro Yamada , Mike Rapoport , Nathan Chancellor , Nick Desaulniers , Nick Desaulniers , Nicolas Pitre , Russell King , Tejun Heo , Thomas Gleixner , =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= , Valentin Schneider , Viresh Kumar , "Wolfram Sang (Renesas)" , YiFei Zhu Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 817F33000096 Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="J0ah/Gbc"; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf03.hostedemail.com: domain of ardb@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=ardb@kernel.org X-Rspamd-Server: rspam01 X-Stat-Signature: bbq547y5atwnqspt741a3i9szs86ijeq X-HE-Tag: 1631087269-153802 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, 8 Sept 2021 at 09:01, Krzysztof Kozlowski wrote: > > On 08/09/2021 00:00, Keith Packard wrote: > > Placing thread_info in the kernel stack leaves it vulnerable to stack > > overflow attacks. This short series addresses that by using the > > existing THREAD_INFO_IN_TASK infrastructure. > > > > This is the third version of this series, in this version the changes > > are restricted to hardware which provides the TPIDRPRW register. This > > register is repurposed from holding the per_cpu_offset value to > > holding the 'current' value as that allows fetching this value > > atomically so that it can be used in a preemptable context. > > > > The series is broken into seven pieces: > > > > 1) Change the secondary_start_kernel API to receive the cpu > > number. This avoids needing to be able to find this value independently in > > future patches. > > > > 2) Change the secondary_start_kernel API to also receive the 'task' > > value. Passing the value to this function also avoids needing to > > be able to discover it independently. > > > > 3) A cleanup which avoids assuming that THREAD_INFO_IN_TASK is not set. > > > > 4) A hack, borrowed from the powerpc arch, which allows locating the 'cpu' > > field in either thread_info or task_struct, without requiring linux/sched.h > > to be included in asm/smp.h > > > > 5) Disable the optimization storing per_cpu_offset in TPIDRPRW. This leaves > > the register free to hold 'current' instead. > > > > 6) Use TPIDRPRW for 'current'. This is enabled for either CPU_V6K or CPU_V7, > > but not if CPU_V6 is also enabled. > > > > 7) Enable THREAD_INFO_IN_TASK whenever TPIDRPRW is used to hold 'current'. > > Hi, > > Thanks for your patches. This seems to be a v3 but the patches are not > marked with it. Use "-v3" in format-patch to get it right. > > The email here also lacks diffstat which is useful, for example to check > whether any maintainer's relevant files are touched here. You can get it > with "--cover-letter". > > In total the command should look like: > git format-patch --cover-letter -v3 -7 HEAD > > Of course you can use any other tools to achieve the same result but as > of now - result is not the same. > Also, this ended up in my GMail spam folder, likely due to some antispam ID header being set incorrectly?