lkml.org 
[lkml]   [2021]   [Sep]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Subject[PATCH 0/2] ARM: support THREAD_INFO_IN_TASK (v7 only) (v2)
    Date
    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.

    Signed-off-by: Keith Packard <keithpac@amazon.com>


    \
     
     \ /
      Last update: 2021-09-04 08:10    [W:3.034 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site