All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v16 00/21] powerpc: Switch to CONFIG_THREAD_INFO_IN_TASK
@ 2019-02-05 11:31 Michael Ellerman
  2019-02-05 11:31 ` [PATCH v16 01/21] powerpc/irq: use memblock functions returning virtual address Michael Ellerman
                   ` (20 more replies)
  0 siblings, 21 replies; 34+ messages in thread
From: Michael Ellerman @ 2019-02-05 11:31 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: npiggin

The purpose of this series 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.

Changes in v16 (mpe):
 - split the prepartion patches out into smaller pieces.
 - move all TASK_SIZE related contents out of processor.h
 - fix build failures with livepatching enabled (include sched/task_stack.h)
 - Use PACA_CURRENT_TI for the offset of the thread info in paca->current.

Changes in v15:
 - switched patch 1 and 2.
 - resync patch 1 with linux/next. As memblock modifications are now fully merged in
 linux-mm tree, this patch voids as soon as linux-mm gets merged into powerpc/merge branch
 - Fixed build failure on 64le due to call to __save_stack_trace_tsk_reliable() (patch 5)
 - Taken the renaming of THREAD_INFO to TASK_STACK out of the preparation patch to ease review (hence new patch 6)
 - Fixed one place where r11 (physical address of stack) was used instead of r1 to locate
 thread_info, inducing a bug when switching to r2 which is virtual address of current (patch 7)
 - Keeping physical address of current in r2 until MMU translation is reactivated (patch 11)

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 (21):
  powerpc/irq: use memblock functions returning virtual address
  powerpc/32: Fix CONFIG_VIRT_CPU_ACCOUNTING_NATIVE for 40x/booke
  powerpc: 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: Rename THREAD_INFO to TASK_STACK
  powerpc: call_do_[soft]irq() takes a pointer to the stack
  powerpc: Don't use CURRENT_THREAD_INFO to find the stack
  powerpc: Replace current_thread_info()->task with current
  powerpc: Update comments in preparation for THREAD_INFO_IN_TASK
  powerpc/64: Use task_stack_page() to initialise paca->kstack
  powerpc: Use sizeof(struct thread_info) in INIT_SP_LIMIT
  powerpc: Use linux/thread_info.h in processor.h
  powerpc: Use task_stack_page() in current_pt_regs()
  powerpc/idle/6xx: Use r1 with CURRENT_THREAD_INFO()
  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: Replace CURRENT_THREAD_INFO with PACA_CURRENT_TI
  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          |   7 +-
 arch/powerpc/include/asm/processor.h          | 105 ++--------------
 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_32.h       |  21 ++++
 arch/powerpc/include/asm/task_size_64.h       |  79 ++++++++++++
 arch/powerpc/include/asm/thread_info.h        |  19 ---
 arch/powerpc/kernel/asm-offsets.c             |  12 +-
 arch/powerpc/kernel/entry_32.S                |  80 +++++-------
 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                |  26 ++--
 arch/powerpc/kernel/setup_64.c                |  51 ++------
 arch/powerpc/kernel/smp.c                     |  16 +--
 arch/powerpc/kernel/stacktrace.c              |  29 ++++-
 .../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 +-
 47 files changed, 367 insertions(+), 507 deletions(-)
 create mode 100644 arch/powerpc/include/asm/task_size_32.h
 create mode 100644 arch/powerpc/include/asm/task_size_64.h

-- 
2.20.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2019-02-26  3:31 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-05 11:31 [PATCH v16 00/21] powerpc: Switch to CONFIG_THREAD_INFO_IN_TASK Michael Ellerman
2019-02-05 11:31 ` [PATCH v16 01/21] powerpc/irq: use memblock functions returning virtual address Michael Ellerman
2019-02-07  3:54   ` Nicholas Piggin
2019-02-26  3:27   ` [v16, " Michael Ellerman
2019-02-05 11:32 ` [PATCH v16 02/21] powerpc/32: Fix CONFIG_VIRT_CPU_ACCOUNTING_NATIVE for 40x/booke Michael Ellerman
2019-02-05 11:32 ` [PATCH v16 03/21] powerpc: Avoid circular header inclusion in mmu-hash.h Michael Ellerman
2019-02-05 11:32 ` [PATCH v16 04/21] powerpc: Only use task_struct 'cpu' field on SMP Michael Ellerman
2019-02-05 11:32 ` [PATCH v16 05/21] powerpc: prep stack walkers for THREAD_INFO_IN_TASK Michael Ellerman
2019-02-07  4:05   ` Nicholas Piggin
2019-02-23 11:31   ` Michael Ellerman
2019-02-05 11:32 ` [PATCH v16 06/21] powerpc: Rename THREAD_INFO to TASK_STACK Michael Ellerman
2019-02-05 11:32 ` [PATCH v16 07/21] powerpc: call_do_[soft]irq() takes a pointer to the stack Michael Ellerman
2019-02-05 11:32 ` [PATCH v16 08/21] powerpc: Don't use CURRENT_THREAD_INFO to find " Michael Ellerman
2019-02-05 11:32 ` [PATCH v16 09/21] powerpc: Replace current_thread_info()->task with current Michael Ellerman
2019-02-05 11:32 ` [PATCH v16 10/21] powerpc: Update comments in preparation for THREAD_INFO_IN_TASK Michael Ellerman
2019-02-05 11:32 ` [PATCH v16 11/21] powerpc/64: Use task_stack_page() to initialise paca->kstack Michael Ellerman
2019-02-05 11:32 ` [PATCH v16 12/21] powerpc: Use sizeof(struct thread_info) in INIT_SP_LIMIT Michael Ellerman
2019-02-05 11:32 ` [PATCH v16 13/21] powerpc: Use linux/thread_info.h in processor.h Michael Ellerman
2019-02-05 11:32 ` [PATCH v16 14/21] powerpc: Use task_stack_page() in current_pt_regs() Michael Ellerman
2019-02-07  4:13   ` Nicholas Piggin
2019-02-05 11:32 ` [PATCH v16 15/21] powerpc/idle/6xx: Use r1 with CURRENT_THREAD_INFO() Michael Ellerman
2019-02-05 11:32 ` [PATCH v16 16/21] powerpc: Activate CONFIG_THREAD_INFO_IN_TASK Michael Ellerman
2019-02-07  4:44   ` Nicholas Piggin
2019-02-07  4:53   ` Nicholas Piggin
2019-02-07  6:07     ` Christophe Leroy
2019-02-05 11:32 ` [PATCH v16 17/21] powerpc: regain entire stack space Michael Ellerman
2019-02-05 11:32 ` [PATCH v16 18/21] powerpc: 'current_set' is now a table of task_struct pointers Michael Ellerman
2019-02-05 11:32 ` [PATCH v16 19/21] powerpc/32: Remove CURRENT_THREAD_INFO and rename TI_CPU Michael Ellerman
2019-02-07  0:10   ` Michael Ellerman
2019-02-07  4:27   ` Nicholas Piggin
2019-02-07  4:41     ` Nicholas Piggin
2019-02-05 11:32 ` [PATCH v16 20/21] powerpc/64: Replace CURRENT_THREAD_INFO with PACA_CURRENT_TI Michael Ellerman
2019-02-07  4:24   ` Nicholas Piggin
2019-02-05 11:32 ` [PATCH v16 21/21] powerpc: clean stack pointers naming Michael Ellerman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.