Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2174499imu; Thu, 24 Jan 2019 08:21:53 -0800 (PST) X-Google-Smtp-Source: ALg8bN52r8uY4vqdU8oK6c91OKCM4haifDqWQU5XWAIZqf0vzNdZI1gNvnwwKd9xs0wARlO+0cSg X-Received: by 2002:a17:902:2887:: with SMTP id f7mr7031530plb.176.1548346913650; Thu, 24 Jan 2019 08:21:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548346913; cv=none; d=google.com; s=arc-20160816; b=XVXbEyCVhlJn/vHAnrtD8439Y4/hJSd8jVjqeTlYP4YSLjd45jA4Wzhep6/VJzuV60 8Aj0hwQKeevW5Cjue1asgc+LG+nA3ppr+XFDLKsw5uSXf0zlchtSd3uYeDKlKLTkozn9 xGuuy1MPrwRWvnVPjHwI9rs3OWqfKTIQoXN1JwfdKgUGpxsU6A8zevP0H/pbEmVWqxFn IlwqmCbv2D+8E/CM3MipzEpkYYNL7CTKW4ozZEweAARjQz4uyo20nmOhh58hsGKXxJAW DLgJK5oQwaH1nSKpicWyjpWWTevb/ba6Prj+IiR2CWCOAH1ZY4tv8oAAJGmZYPnY3ys8 8uTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:message-id :dkim-signature; bh=retXMGoJf5+Snvw80CvH+Mt3LY2P4cdu1x5KvfxzCzY=; b=meVHGeuAYnAgHIfaX+ci6fFsy2miH69tSPRzhiWD0WgXGugJp2Kbu30vBW+APCYmi0 plIIMMkGHXTSOOmoJkBIDZKzXXZ6LLp2cvRdnsKZNo2bMFAPVexDPv+ycMOwXCm6fmdu bHnl25mgmvt/YVLdcKgWiNqyp+RteY9RXXkkrFbAba4VyzpcFrL1eYGoqpQGYG/cPgTX RL4Ua1dnG+KX1Om/QAgGjdQRVZVL/Yp5byNhpStCVsANdYc122oIUD4WHaaqDsil9bdu TWuqYEIAlz1MYX3fYZR+vGY+KiBBHM/uMs5ZLq+o11VTGj+S8WHuGawaA0Hqo6FN/Vz9 DUEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=EIVe1xMf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b7si23014789plk.206.2019.01.24.08.21.38; Thu, 24 Jan 2019 08:21:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=EIVe1xMf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727969AbfAXQTb (ORCPT + 99 others); Thu, 24 Jan 2019 11:19:31 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:19692 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727573AbfAXQTb (ORCPT ); Thu, 24 Jan 2019 11:19:31 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 43lnRN349Jz9v01b; Thu, 24 Jan 2019 17:19:28 +0100 (CET) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=EIVe1xMf; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id Kp8bzUNHSQgH; Thu, 24 Jan 2019 17:19:28 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 43lnRN201Lz9v01Z; Thu, 24 Jan 2019 17:19:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1548346768; bh=retXMGoJf5+Snvw80CvH+Mt3LY2P4cdu1x5KvfxzCzY=; h=From:Subject:To:Cc:Date:From; b=EIVe1xMfGDwg8lKzz5Se/lAsCCczbhXhys4PN+cvSdBOCE3rVzFuwQX/KkD4pp4zH 9awg8jITGgglrGgyQm4gH7rfTrlgEcd8x4UVfW8XRaQHxTgkN42y05wUBUcWzQ38ck ioBD8FCH7Fq6vFoqghdwCFduOKYKwmuuiNMmj9z8= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id C85BB8B850; Thu, 24 Jan 2019 17:19:29 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id jbVoNQcQvSZi; Thu, 24 Jan 2019 17:19:29 +0100 (CET) Received: from po16846vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 62A918B863; Thu, 24 Jan 2019 17:19:29 +0100 (CET) Received: by po16846vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 1206372D88; Thu, 24 Jan 2019 16:19:28 +0000 (UTC) Message-Id: From: Christophe Leroy Subject: [PATCH v14 00/12] powerpc: Switch to CONFIG_THREAD_INFO_IN_TASK To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Nicholas Piggin , Mike Rapoport Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Mark Rutland Date: Thu, 24 Jan 2019 16:19:28 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The purpose of this serie is to activate CONFIG_THREAD_INFO_IN_TASK which moves the thread_info into task_struct. Moving thread_info into task_struct has the following advantages: - It protects thread_info from corruption in the case of stack overflows. - Its address is harder to determine if stack addresses are leaked, making a number of attacks more difficult. Added Mark Rutland in copy as he did the work on arm64 and may have recommendations for us. Changes in v14 (ie since v13): - Added in front a fixup patch which conflicts with this serie - Added a patch for using try_get_task_stack()/put_task_stack() in stack walkers. - Fixed compilation failure in the preparation patch (by moving the modification of klp_init_thread_info() to the following patch) Changes since v12: - Patch 1: Taken comment from Mike (re-introduced the 'panic' in case memblock allocation fails in setup_64.c - Patch 1: Added alloc_stack() function in setup_32.c to also panic in case of allocation failure. Changes since v11: - Rebased on 81775f5563fa ("Automatic merge of branches 'master', 'next' and 'fixes' into merge") - Added a first patch to change memblock allocs to functions returning virtual addrs. This removes the memset() which were the only remaining stuff in irq_ctx_init() and exc_lvl_ctx_init() at the end. - dropping irq_ctx_init() and exc_lvl_ctx_init() in patch 5 (powerpc: Activate CONFIG_THREAD_INFO_IN_TASK) - A few cosmetic changes in commit log and code. Changes since v10: - Rebased on 21622a0d2023 ("Automatic merge of branches 'master', 'next' and 'fixes' into merge") ==> Fixed conflict in setup_32.S Changes since v9: - Rebased on 183cbf93be88 ("Automatic merge of branches 'master', 'next' and 'fixes' into merge") ==> Fixed conflict on xmon Changes since v8: - Rebased on e589b79e40d9 ("Automatic merge of branches 'master', 'next' and 'fixes' into merge") ==> Main impact was conflicts due to commit 9a8dd708d547 ("memblock: rename memblock_alloc{_nid,_try_nid} to memblock_phys_alloc*") Changes since v7: - Rebased on fb6c6ce7907d ("Automatic merge of branches 'master', 'next' and 'fixes' into merge") Changes since v6: - Fixed validate_sp() to exclude NULL sp in 'regain entire stack space' patch (early crash with CONFIG_KMEMLEAK) Changes since v5: - Fixed livepatch_sp setup by using end_of_stack() instead of hardcoding - Fixed PPC_BPF_LOAD_CPU() macro Changes since v4: - Fixed a build failure on 32bits SMP when include/generated/asm-offsets.h is not already existing, was due to spaces instead of a tab in the Makefile Changes since RFC v3: (based on Nick's review) - Renamed task_size.h to task_size_user64.h to better relate to what it contains. - Handling of the isolation of thread_info cpu field inside CONFIG_SMP #ifdefs moved to a separate patch. - Removed CURRENT_THREAD_INFO macro completely. - Added a guard in asm/smp.h to avoid build failure before _TASK_CPU is defined. - Added a patch at the end to rename 'tp' pointers to 'sp' pointers - Renamed 'tp' into 'sp' pointers in preparation patch when relevant - Fixed a few commit logs - Fixed checkpatch report. Changes since RFC v2: - Removed the modification of names in asm-offsets - Created a rule in arch/powerpc/Makefile to append the offset of current->cpu in CFLAGS - Modified asm/smp.h to use the offset set in CFLAGS - Squashed the renaming of THREAD_INFO to TASK_STACK in the preparation patch - Moved the modification of current_pt_regs in the patch activating CONFIG_THREAD_INFO_IN_TASK Changes since RFC v1: - Removed the first patch which was modifying header inclusion order in timer - Modified some names in asm-offsets to avoid conflicts when including asm-offsets in C files - Modified asm/smp.h to avoid having to include linux/sched.h (using asm-offsets instead) - Moved some changes from the activation patch to the preparation patch. Christophe Leroy (12): powerpc/32: Fix CONFIG_VIRT_CPU_ACCOUNTING_NATIVE for 40x/booke powerpc/irq: use memblock functions returning virtual address book3s/64: avoid circular header inclusion in mmu-hash.h powerpc: Only use task_struct 'cpu' field on SMP powerpc: prep stack walkers for THREAD_INFO_IN_TASK powerpc: Prepare for moving thread_info into task_struct powerpc: Activate CONFIG_THREAD_INFO_IN_TASK powerpc: regain entire stack space powerpc: 'current_set' is now a table of task_struct pointers powerpc/32: Remove CURRENT_THREAD_INFO and rename TI_CPU powerpc/64: Remove CURRENT_THREAD_INFO powerpc: clean stack pointers naming arch/powerpc/Kconfig | 1 + arch/powerpc/Makefile | 7 ++ arch/powerpc/include/asm/asm-prototypes.h | 4 +- arch/powerpc/include/asm/book3s/64/mmu-hash.h | 2 +- arch/powerpc/include/asm/exception-64s.h | 4 +- arch/powerpc/include/asm/irq.h | 18 ++-- arch/powerpc/include/asm/livepatch.h | 6 +- arch/powerpc/include/asm/processor.h | 39 +-------- arch/powerpc/include/asm/ptrace.h | 2 +- arch/powerpc/include/asm/reg.h | 2 +- arch/powerpc/include/asm/smp.h | 17 +++- arch/powerpc/include/asm/task_size_user64.h | 42 +++++++++ arch/powerpc/include/asm/thread_info.h | 19 ----- arch/powerpc/kernel/asm-offsets.c | 10 ++- arch/powerpc/kernel/entry_32.S | 75 ++++++---------- arch/powerpc/kernel/entry_64.S | 12 +-- arch/powerpc/kernel/epapr_hcalls.S | 5 +- arch/powerpc/kernel/exceptions-64e.S | 13 +-- arch/powerpc/kernel/exceptions-64s.S | 2 +- arch/powerpc/kernel/head_32.S | 14 +-- arch/powerpc/kernel/head_40x.S | 4 +- arch/powerpc/kernel/head_44x.S | 8 +- arch/powerpc/kernel/head_64.S | 1 + arch/powerpc/kernel/head_8xx.S | 2 +- arch/powerpc/kernel/head_booke.h | 12 +-- arch/powerpc/kernel/head_fsl_booke.S | 16 ++-- arch/powerpc/kernel/idle_6xx.S | 8 +- arch/powerpc/kernel/idle_book3e.S | 2 +- arch/powerpc/kernel/idle_e500.S | 8 +- arch/powerpc/kernel/idle_power4.S | 2 +- arch/powerpc/kernel/irq.c | 114 +++---------------------- arch/powerpc/kernel/kgdb.c | 28 ------ arch/powerpc/kernel/machine_kexec_64.c | 6 +- arch/powerpc/kernel/misc_32.S | 17 ++-- arch/powerpc/kernel/process.c | 63 ++++++++------ arch/powerpc/kernel/setup-common.c | 2 +- arch/powerpc/kernel/setup_32.c | 25 +++--- arch/powerpc/kernel/setup_64.c | 51 +++-------- arch/powerpc/kernel/smp.c | 16 ++-- arch/powerpc/kernel/stacktrace.c | 29 ++++++- arch/powerpc/kernel/trace/ftrace_64_mprofile.S | 6 +- arch/powerpc/kvm/book3s_hv_hmi.c | 1 + arch/powerpc/mm/hash_low_32.S | 14 ++- arch/powerpc/net/bpf_jit32.h | 5 +- arch/powerpc/sysdev/6xx-suspend.S | 5 +- arch/powerpc/xmon/xmon.c | 2 +- 46 files changed, 300 insertions(+), 441 deletions(-) create mode 100644 arch/powerpc/include/asm/task_size_user64.h -- 2.13.3