Skip to content

KASAN fix for arch_dup_task_struct (x86, um)

Benjamin Berg linux-arch linux-um lkml 1 version Applied

Status from this message: The following commit has been merged into the x86/fpu branch of tip:

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 4 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/3vmlinux.lds.h: remove entry to place init_task onto init_stackinclude/asm-generic/vmlinux.lds.h+0 -10 replies
2/3um: avoid copying FP state from init_taskarch/um/kernel/process.c+9 -11 reply
3/3x86: avoid copying dynamic FP state from init_taskarch/x86/kernel/process.c+9 -13 replies

Reviews trailers per patch

None of the 3 patches has a Reviewed-by or Acked-by.

PatchThomas Weißschuh
1/3
2/3T-b
3/3

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/3] KASAN fix for arch_dup_task_struct (x86, um)

From: Benjamin Berg <[email protected]>

On the x86 and um architectures struct task_struct is dynamically sized depending on the size required to store the floating point registers. After adding this feature to UML it sometimes triggered KASAN errors as the memcpy in arch_dup_task_struct read past init_task.

In my own testing, the reported KASAN error was for a read into the redzone of the next global variable (init_sighand). Due to padding, the reported area was already far past the size of init_task.

Note that on x86 the dynamically allocated area of struct task_struct is quite a bit smaller and may not even exist. This might explain why this error has not been noticed before.

This problem was reported by Brian Norris <[email protected]>.

Benjamin

Benjamin Berg (3):
vmlinux.lds.h: remove entry to place init_task onto init_stack
um: avoid copying FP state from init_task
x86: avoid copying dynamic FP state from init_task

 arch/um/kernel/process.c          | 10 +++++++++-
 arch/x86/kernel/process.c         | 10 +++++++++-
 include/asm-generic/vmlinux.lds.h |  1 -
 3 files changed, 18 insertions(+), 3 deletions(-)
Signature · 1 line
2.47.1