mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
arch: copy_thread: pass clone_flags as u64
With the introduction of clone3 in commit7f192e3cd3("fork: add clone3") the effective bit width of clone_flags on all architectures was increased from 32-bit to 64-bit, with a new type of u64 for the flags. However, for most consumers of clone_flags the interface was not changed from the previous type of unsigned long. While this works fine as long as none of the new 64-bit flag bits (CLONE_CLEAR_SIGHAND and CLONE_INTO_CGROUP) are evaluated, this is still undesirable in terms of the principle of least surprise. Thus, this commit fixes all relevant interfaces of the copy_thread function that is called from copy_process to consistently pass clone_flags as u64, so that no truncation to 32-bit integers occurs on 32-bit architectures. Signed-off-by: Simon Schuster <schuster.simon@siemens-energy.com> Link: https://lore.kernel.org/20250901-nios2-implement-clone3-v2-3-53fcf5577d57@siemens-energy.com Fixes:c5febea095("fork: Pass struct kernel_clone_args into copy_thread") Acked-by: Guo Ren (Alibaba Damo Academy) <guoren@kernel.org> Acked-by: Andreas Larsson <andreas@gaisler.com> # sparc Acked-by: David Hildenbrand <david@redhat.com> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> # m68k Reviewed-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
committed by
Christian Brauner
parent
edd3cb05c0
commit
bbc46b23af
@@ -231,7 +231,7 @@ flush_thread(void)
|
||||
*/
|
||||
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
u64 clone_flags = args->flags;
|
||||
unsigned long usp = args->stack;
|
||||
unsigned long tls = args->tls;
|
||||
extern void ret_from_fork(void);
|
||||
|
||||
@@ -166,7 +166,7 @@ asmlinkage void ret_from_fork(void);
|
||||
*/
|
||||
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
u64 clone_flags = args->flags;
|
||||
unsigned long usp = args->stack;
|
||||
unsigned long tls = args->tls;
|
||||
struct pt_regs *c_regs; /* child's pt_regs */
|
||||
|
||||
@@ -234,7 +234,7 @@ asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
|
||||
|
||||
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
u64 clone_flags = args->flags;
|
||||
unsigned long stack_start = args->stack;
|
||||
unsigned long tls = args->tls;
|
||||
struct thread_info *thread = task_thread_info(p);
|
||||
|
||||
@@ -409,7 +409,7 @@ asmlinkage void ret_from_fork(void) asm("ret_from_fork");
|
||||
|
||||
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
u64 clone_flags = args->flags;
|
||||
unsigned long stack_start = args->stack;
|
||||
unsigned long tls = args->tls;
|
||||
struct pt_regs *childregs = task_pt_regs(p);
|
||||
|
||||
@@ -32,7 +32,7 @@ void flush_thread(void){}
|
||||
|
||||
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
u64 clone_flags = args->flags;
|
||||
unsigned long usp = args->stack;
|
||||
unsigned long tls = args->tls;
|
||||
struct switch_stack *childstack;
|
||||
|
||||
@@ -52,7 +52,7 @@ void arch_cpu_idle(void)
|
||||
*/
|
||||
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
u64 clone_flags = args->flags;
|
||||
unsigned long usp = args->stack;
|
||||
unsigned long tls = args->tls;
|
||||
struct thread_info *ti = task_thread_info(p);
|
||||
|
||||
@@ -167,7 +167,7 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
unsigned long childksp;
|
||||
unsigned long tls = args->tls;
|
||||
unsigned long usp = args->stack;
|
||||
unsigned long clone_flags = args->flags;
|
||||
u64 clone_flags = args->flags;
|
||||
struct pt_regs *childregs, *regs = current_pt_regs();
|
||||
|
||||
childksp = (unsigned long)task_stack_page(p) + THREAD_SIZE;
|
||||
|
||||
@@ -141,7 +141,7 @@ asmlinkage int m68k_clone3(struct pt_regs *regs)
|
||||
|
||||
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
u64 clone_flags = args->flags;
|
||||
unsigned long usp = args->stack;
|
||||
unsigned long tls = args->tls;
|
||||
struct fork_frame {
|
||||
|
||||
@@ -54,7 +54,7 @@ void flush_thread(void)
|
||||
|
||||
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
u64 clone_flags = args->flags;
|
||||
unsigned long usp = args->stack;
|
||||
unsigned long tls = args->tls;
|
||||
struct pt_regs *childregs = task_pt_regs(p);
|
||||
|
||||
@@ -107,7 +107,7 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
|
||||
*/
|
||||
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
u64 clone_flags = args->flags;
|
||||
unsigned long usp = args->stack;
|
||||
unsigned long tls = args->tls;
|
||||
struct thread_info *ti = task_thread_info(p);
|
||||
|
||||
@@ -101,7 +101,7 @@ void flush_thread(void)
|
||||
|
||||
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
u64 clone_flags = args->flags;
|
||||
unsigned long usp = args->stack;
|
||||
unsigned long tls = args->tls;
|
||||
struct pt_regs *childregs = task_pt_regs(p);
|
||||
|
||||
@@ -165,7 +165,7 @@ extern asmlinkage void ret_from_fork(void);
|
||||
int
|
||||
copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
u64 clone_flags = args->flags;
|
||||
unsigned long usp = args->stack;
|
||||
unsigned long tls = args->tls;
|
||||
struct pt_regs *userregs;
|
||||
|
||||
@@ -201,7 +201,7 @@ arch_initcall(parisc_idle_init);
|
||||
int
|
||||
copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
u64 clone_flags = args->flags;
|
||||
unsigned long usp = args->stack;
|
||||
unsigned long tls = args->tls;
|
||||
struct pt_regs *cregs = &(p->thread.regs);
|
||||
|
||||
@@ -1805,7 +1805,7 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
f = ret_from_kernel_user_thread;
|
||||
} else {
|
||||
struct pt_regs *regs = current_pt_regs();
|
||||
unsigned long clone_flags = args->flags;
|
||||
u64 clone_flags = args->flags;
|
||||
unsigned long usp = args->stack;
|
||||
|
||||
/* Copy registers */
|
||||
|
||||
@@ -223,7 +223,7 @@ asmlinkage void ret_from_fork_user(struct pt_regs *regs)
|
||||
|
||||
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
u64 clone_flags = args->flags;
|
||||
unsigned long usp = args->stack;
|
||||
unsigned long tls = args->tls;
|
||||
struct pt_regs *childregs = task_pt_regs(p);
|
||||
|
||||
@@ -106,7 +106,7 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
|
||||
|
||||
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
u64 clone_flags = args->flags;
|
||||
unsigned long new_stackp = args->stack;
|
||||
unsigned long tls = args->tls;
|
||||
struct fake_frame
|
||||
|
||||
@@ -89,7 +89,7 @@ asmlinkage void ret_from_kernel_thread(void);
|
||||
|
||||
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
u64 clone_flags = args->flags;
|
||||
unsigned long usp = args->stack;
|
||||
unsigned long tls = args->tls;
|
||||
struct thread_info *ti = task_thread_info(p);
|
||||
|
||||
@@ -260,7 +260,7 @@ extern void ret_from_kernel_thread(void);
|
||||
|
||||
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
u64 clone_flags = args->flags;
|
||||
unsigned long sp = args->stack;
|
||||
unsigned long tls = args->tls;
|
||||
struct thread_info *ti = task_thread_info(p);
|
||||
|
||||
@@ -567,7 +567,7 @@ barf:
|
||||
*/
|
||||
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
u64 clone_flags = args->flags;
|
||||
unsigned long sp = args->stack;
|
||||
unsigned long tls = args->tls;
|
||||
struct thread_info *t = task_thread_info(p);
|
||||
|
||||
@@ -143,7 +143,7 @@ static void fork_handler(void)
|
||||
|
||||
int copy_thread(struct task_struct * p, const struct kernel_clone_args *args)
|
||||
{
|
||||
unsigned long clone_flags = args->flags;
|
||||
u64 clone_flags = args->flags;
|
||||
unsigned long sp = args->stack;
|
||||
unsigned long tls = args->tls;
|
||||
void (*handler)(void);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user