Skip to content

ARM: support THREAD_INFO_IN_TASK (v7 only) (v2)

Keith Packard linux-arm-kernel linux-hardening linux-mm lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest0 of 2 patches 0 repliesNew

Patches in v1 No applies recorded yet

None of the 2 patches the cover letter announces are in this archive.

Reviews trailers per patch

PatchArd Biesheuvel
SeriesR-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/2] ARM: support THREAD_INFO_IN_TASK (v7 only) (v2)

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 second version of this series, in this version the changes are restricted to v7 hardware which offers a way to identify each cpu in the system without reference to the stack it is using.

The series is broken into three pieces:

1) Change the secondary_start_kernel API to pass the cpu number to this function. This is required for the following patch because the raw_smp_processor_id() macro will use the per_cpu_offset value which needs to have the cpu number to get the right value.

2) Enable THREAD_INFO_IN_TASK by creating a new per-cpu variable, current_task, just like the x86 architecture. The largest changes are in the assembly code where fetching the current_task value requires a temporary register. Fortunately, each location in the code performing this had a reasonably obvious register to use.

3) Optimize access to the cpu number using another new per-cpu variable. This is not functionally necessary, but avoids de-referencing through two pointers at modest memory cost.