Skip to content

Commit e80d666

Browse files
author
Al Viro
committed
flagday: kill pt_regs argument of do_fork()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 18c26c2 commit e80d666

9 files changed

Lines changed: 19 additions & 26 deletions

File tree

‎arch/blackfin/kernel/process.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ asmlinkage int bfin_clone(unsigned long clone_flags, unsigned long newsp)
135135
#endif
136136
if (newsp)
137137
newsp -= 12;
138-
return do_fork(clone_flags, newsp, regs, 0, NULL, NULL);
138+
return do_fork(clone_flags, newsp, 0, NULL, NULL);
139139
}
140140

141141
int

‎arch/ia64/kernel/entry.S‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,12 @@ GLOBAL_ENTRY(sys_clone2)
116116
mov loc1=r16 // save ar.pfs across do_fork
117117
.body
118118
mov out1=in1
119-
mov out3=in2
119+
mov out2=in2
120120
tbit.nz p6,p0=in0,CLONE_SETTLS_BIT
121-
mov out4=in3 // parent_tidptr: valid only w/CLONE_PARENT_SETTID
121+
mov out3=in3 // parent_tidptr: valid only w/CLONE_PARENT_SETTID
122122
;;
123123
(p6) st8 [r2]=in5 // store TLS in r16 for copy_thread()
124-
mov out5=in4 // child_tidptr: valid only w/CLONE_CHILD_SETTID or CLONE_CHILD_CLEARTID
125-
adds out2=IA64_SWITCH_STACK_SIZE+16,sp // out2 = &regs
124+
mov out4=in4 // child_tidptr: valid only w/CLONE_CHILD_SETTID or CLONE_CHILD_CLEARTID
126125
mov out0=in0 // out0 = clone_flags
127126
br.call.sptk.many rp=do_fork
128127
.ret1: .restore sp
@@ -148,13 +147,12 @@ GLOBAL_ENTRY(sys_clone)
148147
mov loc1=r16 // save ar.pfs across do_fork
149148
.body
150149
mov out1=in1
151-
mov out3=16 // stacksize (compensates for 16-byte scratch area)
150+
mov out2=16 // stacksize (compensates for 16-byte scratch area)
152151
tbit.nz p6,p0=in0,CLONE_SETTLS_BIT
153-
mov out4=in2 // parent_tidptr: valid only w/CLONE_PARENT_SETTID
152+
mov out3=in2 // parent_tidptr: valid only w/CLONE_PARENT_SETTID
154153
;;
155154
(p6) st8 [r2]=in4 // store TLS in r13 (tp)
156-
mov out5=in3 // child_tidptr: valid only w/CLONE_CHILD_SETTID or CLONE_CHILD_CLEARTID
157-
adds out2=IA64_SWITCH_STACK_SIZE+16,sp // out2 = &regs
155+
mov out4=in3 // child_tidptr: valid only w/CLONE_CHILD_SETTID or CLONE_CHILD_CLEARTID
158156
mov out0=in0 // out0 = clone_flags
159157
br.call.sptk.many rp=do_fork
160158
.ret2: .restore sp

‎arch/m68k/kernel/process.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ void flush_thread(void)
149149
asmlinkage int m68k_clone(struct pt_regs *regs)
150150
{
151151
/* regs will be equal to current_pt_regs() */
152-
return do_fork(regs->d1, regs->d2, regs, 0,
152+
return do_fork(regs->d1, regs->d2, 0,
153153
(int __user *)regs->d3, (int __user *)regs->d4);
154154
}
155155

‎arch/mips/kernel/linux32.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ _sys32_clone(nabi_no_regargs struct pt_regs regs)
312312
/* Use __dummy4 instead of getting it off the stack, so that
313313
syscall() works. */
314314
child_tidptr = (int __user *) __dummy4;
315-
return do_fork(clone_flags, newsp, &regs, 0,
315+
return do_fork(clone_flags, newsp, 0,
316316
parent_tidptr, child_tidptr);
317317
}
318318

‎arch/mips/kernel/syscall.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ save_static_function(sys_fork);
9292
static int __used noinline
9393
_sys_fork(nabi_no_regargs struct pt_regs regs)
9494
{
95-
return do_fork(SIGCHLD, regs.regs[29], &regs, 0, NULL, NULL);
95+
return do_fork(SIGCHLD, regs.regs[29], 0, NULL, NULL);
9696
}
9797

9898
save_static_function(sys_clone);
@@ -123,7 +123,7 @@ _sys_clone(nabi_no_regargs struct pt_regs regs)
123123
#else
124124
child_tidptr = (int __user *) regs.regs[8];
125125
#endif
126-
return do_fork(clone_flags, newsp, &regs, 0,
126+
return do_fork(clone_flags, newsp, 0,
127127
parent_tidptr, child_tidptr);
128128
}
129129

‎arch/sparc/kernel/process_32.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,7 @@ asmlinkage int sparc_do_fork(unsigned long clone_flags,
286286
parent_tid_ptr = regs->u_regs[UREG_I2];
287287
child_tid_ptr = regs->u_regs[UREG_I4];
288288

289-
ret = do_fork(clone_flags, stack_start,
290-
regs, stack_size,
289+
ret = do_fork(clone_flags, stack_start, stack_size,
291290
(int __user *) parent_tid_ptr,
292291
(int __user *) child_tid_ptr);
293292

‎arch/sparc/kernel/process_64.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -601,8 +601,7 @@ asmlinkage long sparc_do_fork(unsigned long clone_flags,
601601
child_tid_ptr = (int __user *) regs->u_regs[UREG_I4];
602602
}
603603

604-
ret = do_fork(clone_flags, stack_start,
605-
regs, stack_size,
604+
ret = do_fork(clone_flags, stack_start, stack_size,
606605
parent_tid_ptr, child_tid_ptr);
607606

608607
/* If we get an error and potentially restart the system

‎include/linux/sched.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2289,7 +2289,7 @@ extern int disallow_signal(int);
22892289
extern int do_execve(const char *,
22902290
const char __user * const __user *,
22912291
const char __user * const __user *);
2292-
extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long, int __user *, int __user *);
2292+
extern long do_fork(unsigned long, unsigned long, unsigned long, int __user *, int __user *);
22932293
struct task_struct *fork_idle(int);
22942294
#ifdef CONFIG_GENERIC_KERNEL_THREAD
22952295
extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);

‎kernel/fork.c‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,8 +1527,6 @@ static inline void init_idle_pids(struct pid_link *links)
15271527
struct task_struct * __cpuinit fork_idle(int cpu)
15281528
{
15291529
struct task_struct *task;
1530-
struct pt_regs regs;
1531-
15321530
task = copy_process(CLONE_VM, 0, 0, NULL, &init_struct_pid, 0);
15331531
if (!IS_ERR(task)) {
15341532
init_idle_pids(task->pids);
@@ -1546,7 +1544,6 @@ struct task_struct * __cpuinit fork_idle(int cpu)
15461544
*/
15471545
long do_fork(unsigned long clone_flags,
15481546
unsigned long stack_start,
1549-
struct pt_regs *regs,
15501547
unsigned long stack_size,
15511548
int __user *parent_tidptr,
15521549
int __user *child_tidptr)
@@ -1576,7 +1573,7 @@ long do_fork(unsigned long clone_flags,
15761573
* requested, no event is reported; otherwise, report if the event
15771574
* for the type of forking is enabled.
15781575
*/
1579-
if (!(clone_flags & CLONE_UNTRACED) && likely(user_mode(regs))) {
1576+
if (!(clone_flags & CLONE_UNTRACED)) {
15801577
if (clone_flags & CLONE_VFORK)
15811578
trace = PTRACE_EVENT_VFORK;
15821579
else if ((clone_flags & CSIGNAL) != SIGCHLD)
@@ -1632,7 +1629,7 @@ long do_fork(unsigned long clone_flags,
16321629
*/
16331630
pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
16341631
{
1635-
return do_fork(flags|CLONE_VM|CLONE_UNTRACED, (unsigned long)fn, NULL,
1632+
return do_fork(flags|CLONE_VM|CLONE_UNTRACED, (unsigned long)fn,
16361633
(unsigned long)arg, NULL, NULL);
16371634
}
16381635
#endif
@@ -1641,7 +1638,7 @@ pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
16411638
SYSCALL_DEFINE0(fork)
16421639
{
16431640
#ifdef CONFIG_MMU
1644-
return do_fork(SIGCHLD, 0, current_pt_regs(), 0, NULL, NULL);
1641+
return do_fork(SIGCHLD, 0, 0, NULL, NULL);
16451642
#else
16461643
/* can not support in nommu mode */
16471644
return(-EINVAL);
@@ -1652,7 +1649,7 @@ SYSCALL_DEFINE0(fork)
16521649
#ifdef __ARCH_WANT_SYS_VFORK
16531650
SYSCALL_DEFINE0(vfork)
16541651
{
1655-
return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, 0, current_pt_regs(),
1652+
return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, 0,
16561653
0, NULL, NULL);
16571654
}
16581655
#endif
@@ -1675,7 +1672,7 @@ SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp,
16751672
int, tls_val)
16761673
#endif
16771674
{
1678-
return do_fork(clone_flags, newsp, current_pt_regs(), 0,
1675+
return do_fork(clone_flags, newsp, 0,
16791676
parent_tidptr, child_tidptr);
16801677
}
16811678
#endif

0 commit comments

Comments
 (0)