Re: [Y2038] [PATCH v4 02/10] include: Move compat_timespec/ timeval to compat_time.h
On Thu, Mar 15, 2018 at 09:04:04AM +0100, Arnd Bergmann wrote: On Thu, Mar 15, 2018 at 3:51 AM, Deepa Dinamani wrote: On Wed, Mar 14, 2018 at 1:52 PM, Arnd Bergmann wrote: On Wed, Mar 14, 2018 at 4:50 AM, Deepa Dinamani wrote: The file arch/arm64/kernel/process.c needs asm/compat.h also to be included directly since this is included conditionally from include/compat.h. This does seem to be typical of arm64 as I was not completely able to get rid of asm/compat.h includes for arm64 in this series. My plan is to have separate patches to get rid of asm/compat.h includes for the architectures that are not straight forward to keep this series simple. I will fix this and update the series. I ran across the same thing in two more files during randconfig testing on arm64 now, adding this fixup on top for the moment, but maybe there is a better way: I was looking at how Al tested his uaccess patches: https://www.spinics.net/lists/linux-fsdevel/msg108752.html He seems to be running the kbuild bot tests on his own git. Is it possible to verify it this way on the 2038 tree? Or, I could host a tree also. The kbuild bot should generally pick up any branch on git.kernel.org, and the patches sent to the mailing list. It tests a lot of things configurations, but I tend to find some things that it doesn't find by doing lots of randconfig builds on fewer target architectures (I only build arm, arm64 and x86 regularly). I remember that there was some discussion about a method to get the bot to test other branches (besides asking Fengguang to add it manually), but I don't remember what came out of that. People can send email to me or l...@intel.com for adding new git URLs to 0day tests. Such requests are very welcome. Server load is not a problem -- don't worry about your git pushes adding our test load. By default all branches in a git tree will be tested, unless there are explicit blacklist/whitelist. We also have scripts to scan git.kernel.org/github/LKML looking for possible new git URLs to add to 0day kbuild tests. However depending on the team's maintenance pressure they may or may not run frequently. Thanks, Fengguang ___ Y2038 mailing list Y2038@lists.linaro.org https://lists.linaro.org/mailman/listinfo/y2038
Re: [Y2038] [PATCH v4 02/10] include: Move compat_timespec/ timeval to compat_time.h
On Thu, Mar 15, 2018 at 3:51 AM, Deepa Dinamani wrote: > On Wed, Mar 14, 2018 at 1:52 PM, Arnd Bergmann wrote: >> On Wed, Mar 14, 2018 at 4:50 AM, Deepa Dinamani >> wrote: >>> The file arch/arm64/kernel/process.c needs asm/compat.h also to be >>> included directly since this is included conditionally from >>> include/compat.h. This does seem to be typical of arm64 as I was not >>> completely able to get rid of asm/compat.h includes for arm64 in this >>> series. My plan is to have separate patches to get rid of asm/compat.h >>> includes for the architectures that are not straight forward to keep >>> this series simple. >>> I will fix this and update the series. >>> >> >> I ran across the same thing in two more files during randconfig testing on >> arm64 now, adding this fixup on top for the moment, but maybe there >> is a better way: > > I was looking at how Al tested his uaccess patches: > https://www.spinics.net/lists/linux-fsdevel/msg108752.html > > He seems to be running the kbuild bot tests on his own git. > Is it possible to verify it this way on the 2038 tree? Or, I could > host a tree also. The kbuild bot should generally pick up any branch on git.kernel.org, and the patches sent to the mailing list. It tests a lot of things configurations, but I tend to find some things that it doesn't find by doing lots of randconfig builds on fewer target architectures (I only build arm, arm64 and x86 regularly). I remember that there was some discussion about a method to get the bot to test other branches (besides asking Fengguang to add it manually), but I don't remember what came out of that. Arnd ___ Y2038 mailing list Y2038@lists.linaro.org https://lists.linaro.org/mailman/listinfo/y2038
Re: [Y2038] [PATCH v4 02/10] include: Move compat_timespec/ timeval to compat_time.h
On Wed, Mar 14, 2018 at 1:52 PM, Arnd Bergmann wrote: > On Wed, Mar 14, 2018 at 4:50 AM, Deepa Dinamani > wrote: >> The file arch/arm64/kernel/process.c needs asm/compat.h also to be >> included directly since this is included conditionally from >> include/compat.h. This does seem to be typical of arm64 as I was not >> completely able to get rid of asm/compat.h includes for arm64 in this >> series. My plan is to have separate patches to get rid of asm/compat.h >> includes for the architectures that are not straight forward to keep >> this series simple. >> I will fix this and update the series. >> > > I ran across the same thing in two more files during randconfig testing on > arm64 now, adding this fixup on top for the moment, but maybe there > is a better way: I was looking at how Al tested his uaccess patches: https://www.spinics.net/lists/linux-fsdevel/msg108752.html He seems to be running the kbuild bot tests on his own git. Is it possible to verify it this way on the 2038 tree? Or, I could host a tree also. Thanks, Deepa ___ Y2038 mailing list Y2038@lists.linaro.org https://lists.linaro.org/mailman/listinfo/y2038
Re: [Y2038] [PATCH v4 02/10] include: Move compat_timespec/ timeval to compat_time.h
On Wed, Mar 14, 2018 at 4:50 AM, Deepa Dinamani wrote: > The file arch/arm64/kernel/process.c needs asm/compat.h also to be > included directly since this is included conditionally from > include/compat.h. This does seem to be typical of arm64 as I was not > completely able to get rid of asm/compat.h includes for arm64 in this > series. My plan is to have separate patches to get rid of asm/compat.h > includes for the architectures that are not straight forward to keep > this series simple. > I will fix this and update the series. > I ran across the same thing in two more files during randconfig testing on arm64 now, adding this fixup on top for the moment, but maybe there is a better way: commit 4f3e9e1211799a79b201a1af309a1ec3864147ec Author: Arnd Bergmann Date: Wed Mar 14 18:23:16 2018 +0100 arm64: fix perf_regs.c arch/arm64/kernel/perf_regs.c: In function 'perf_reg_abi': arch/arm64/kernel/perf_regs.c:50:6: error: implicit declaration of function 'is_compat_thread'; did you mean 'is_compat_task'? [-Werror=implicit-function-declaration] arch/arm64/kernel/hw_breakpoint.c: In function 'is_compat_bp': arch/arm64/kernel/hw_breakpoint.c:182:16: error: implicit declaration of function 'is_compat_thread'; did you mean 'is_compat_task'? [-Werror=implicit-function-declaration] Signed-off-by: Arnd Bergmann diff --git a/arch/arm64/kernel/hw_breakpoint.c b/arch/arm64/kernel/hw_breakpoint.c index 413dbe530da8..74bb56f656ef 100644 --- a/arch/arm64/kernel/hw_breakpoint.c +++ b/arch/arm64/kernel/hw_breakpoint.c @@ -30,6 +30,7 @@ #include #include +#include #include #include #include diff --git a/arch/arm64/kernel/perf_regs.c b/arch/arm64/kernel/perf_regs.c index 0bbac612146e..1b463a4efe49 100644 --- a/arch/arm64/kernel/perf_regs.c +++ b/arch/arm64/kernel/perf_regs.c @@ -6,6 +6,7 @@ #include #include +#include #include #include ___ Y2038 mailing list Y2038@lists.linaro.org https://lists.linaro.org/mailman/listinfo/y2038
Re: [Y2038] [PATCH v4 02/10] include: Move compat_timespec/ timeval to compat_time.h
This is again a tricky include file ordering when linux/compat.h is included instead of asm/compat.h. is_compat_task() is unconditionally defined in linux/compat.h as a macro which conflicts with inline function define in asm/compat.h for this arch. As before, I will do the simple thing here and leave the asm/compat.h to keep this series simple. I will submit follow up patches to eliminate direct inclusion asm/compat.h. I will include this also in the update. -Deepa On Tue, Mar 13, 2018 at 8:30 AM, kbuild test robot wrote: > Hi Deepa, > > Thank you for the patch! Yet something to improve: > > [auto build test ERROR on ] > > url: > https://github.com/0day-ci/linux/commits/Deepa-Dinamani/posix_clocks-Prepare-syscalls-for-64-bit-time_t-conversion/20180313-203305 > base: > config: powerpc-iss476-smp_defconfig (attached as .config) > compiler: powerpc-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0 > reproduce: > wget > https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O > ~/bin/make.cross > chmod +x ~/bin/make.cross > # save the attached .config to linux build tree > make.cross ARCH=powerpc > > All errors (new ones prefixed by >>): > >arch/powerpc/oprofile/backtrace.c: In function 'user_getsp32': >>> arch/powerpc/oprofile/backtrace.c:31:19: error: implicit declaration of >>> function 'compat_ptr'; did you mean 'complete'? >>> [-Werror=implicit-function-declaration] > void __user *p = compat_ptr(sp); > ^~ > complete >>> arch/powerpc/oprofile/backtrace.c:31:19: error: initialization makes >>> pointer from integer without a cast [-Werror=int-conversion] >cc1: all warnings being treated as errors > > vim +31 arch/powerpc/oprofile/backtrace.c > > 6c6bd754 Brian Rogan 2006-03-27 27 > 6c6bd754 Brian Rogan 2006-03-27 28 static unsigned int > user_getsp32(unsigned int sp, int is_first) > 6c6bd754 Brian Rogan 2006-03-27 29 { > 6c6bd754 Brian Rogan 2006-03-27 30 unsigned int stack_frame[2]; > 62034f03 Al Viro 2006-09-23 @31 void __user *p = compat_ptr(sp); > 6c6bd754 Brian Rogan 2006-03-27 32 > 62034f03 Al Viro 2006-09-23 33 if (!access_ok(VERIFY_READ, p, > sizeof(stack_frame))) > 6c6bd754 Brian Rogan 2006-03-27 34 return 0; > 6c6bd754 Brian Rogan 2006-03-27 35 > 6c6bd754 Brian Rogan 2006-03-27 36 /* > 6c6bd754 Brian Rogan 2006-03-27 37 * The most likely reason for this is > that we returned -EFAULT, > 6c6bd754 Brian Rogan 2006-03-27 38 * which means that we've done all > that we can do from > 6c6bd754 Brian Rogan 2006-03-27 39 * interrupt context. > 6c6bd754 Brian Rogan 2006-03-27 40 */ > 62034f03 Al Viro 2006-09-23 41 if > (__copy_from_user_inatomic(stack_frame, p, sizeof(stack_frame))) > 6c6bd754 Brian Rogan 2006-03-27 42 return 0; > 6c6bd754 Brian Rogan 2006-03-27 43 > 6c6bd754 Brian Rogan 2006-03-27 44 if (!is_first) > 6c6bd754 Brian Rogan 2006-03-27 45 > oprofile_add_trace(STACK_LR32(stack_frame)); > 6c6bd754 Brian Rogan 2006-03-27 46 > 6c6bd754 Brian Rogan 2006-03-27 47 /* > 6c6bd754 Brian Rogan 2006-03-27 48 * We do not enforce increasing stack > addresses here because > 6c6bd754 Brian Rogan 2006-03-27 49 * we may transition to a different > stack, eg a signal handler. > 6c6bd754 Brian Rogan 2006-03-27 50 */ > 6c6bd754 Brian Rogan 2006-03-27 51 return STACK_SP(stack_frame); > 6c6bd754 Brian Rogan 2006-03-27 52 } > 6c6bd754 Brian Rogan 2006-03-27 53 > > :: The code at line 31 was first introduced by commit > :: 62034f03380a64c0144b6721f4a2aa55d65346c1 [POWERPC] powerpc oprofile > __user annotations > > :: TO: Al Viro > :: CC: Paul Mackerras > > --- > 0-DAY kernel test infrastructureOpen Source Technology Center > https://lists.01.org/pipermail/kbuild-all Intel Corporation ___ Y2038 mailing list Y2038@lists.linaro.org https://lists.linaro.org/mailman/listinfo/y2038
Re: [Y2038] [PATCH v4 02/10] include: Move compat_timespec/ timeval to compat_time.h
The file arch/arm64/kernel/process.c needs asm/compat.h also to be included directly since this is included conditionally from include/compat.h. This does seem to be typical of arm64 as I was not completely able to get rid of asm/compat.h includes for arm64 in this series. My plan is to have separate patches to get rid of asm/compat.h includes for the architectures that are not straight forward to keep this series simple. I will fix this and update the series. -Deepa On Tue, Mar 13, 2018 at 8:22 AM, kbuild test robot wrote: > Hi Deepa, > > Thank you for the patch! Yet something to improve: > > [auto build test ERROR on ] > > url: > https://github.com/0day-ci/linux/commits/Deepa-Dinamani/posix_clocks-Prepare-syscalls-for-64-bit-time_t-conversion/20180313-203305 > base: > config: arm64-allnoconfig (attached as .config) > compiler: aarch64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0 > reproduce: > wget > https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O > ~/bin/make.cross > chmod +x ~/bin/make.cross > # save the attached .config to linux build tree > make.cross ARCH=arm64 > > All errors (new ones prefixed by >>): > >arch/arm64/kernel/process.c: In function 'copy_thread': >>> arch/arm64/kernel/process.c:342:8: error: implicit declaration of function >>> 'is_compat_thread'; did you mean 'is_compat_task'? >>> [-Werror=implicit-function-declaration] >if (is_compat_thread(task_thread_info(p))) >^~~~ >is_compat_task >cc1: some warnings being treated as errors > > vim +342 arch/arm64/kernel/process.c > > b3901d54d Catalin Marinas 2012-03-05 307 > b3901d54d Catalin Marinas 2012-03-05 308 int copy_thread(unsigned long > clone_flags, unsigned long stack_start, > afa86fc42 Al Viro 2012-10-22 309 unsigned long stk_sz, > struct task_struct *p) > b3901d54d Catalin Marinas 2012-03-05 310 { > b3901d54d Catalin Marinas 2012-03-05 311 struct pt_regs *childregs = > task_pt_regs(p); > b3901d54d Catalin Marinas 2012-03-05 312 > c34501d21 Catalin Marinas 2012-10-05 313 > memset(&p->thread.cpu_context, 0, sizeof(struct cpu_context)); > c34501d21 Catalin Marinas 2012-10-05 314 > bc0ee4760 Dave Martin 2017-10-31 315 /* > bc0ee4760 Dave Martin 2017-10-31 316 * Unalias > p->thread.sve_state (if any) from the parent task > bc0ee4760 Dave Martin 2017-10-31 317 * and disable discard SVE > state for p: > bc0ee4760 Dave Martin 2017-10-31 318 */ > bc0ee4760 Dave Martin 2017-10-31 319 clear_tsk_thread_flag(p, > TIF_SVE); > bc0ee4760 Dave Martin 2017-10-31 320 p->thread.sve_state = NULL; > bc0ee4760 Dave Martin 2017-10-31 321 > 071b6d4a5 Dave Martin 2017-12-05 322 /* > 071b6d4a5 Dave Martin 2017-12-05 323 * In case p was allocated > the same task_struct pointer as some > 071b6d4a5 Dave Martin 2017-12-05 324 * other recently-exited > task, make sure p is disassociated from > 071b6d4a5 Dave Martin 2017-12-05 325 * any cpu that may have run > that now-exited task recently. > 071b6d4a5 Dave Martin 2017-12-05 326 * Otherwise we could > erroneously skip reloading the FPSIMD > 071b6d4a5 Dave Martin 2017-12-05 327 * registers for p. > 071b6d4a5 Dave Martin 2017-12-05 328 */ > 071b6d4a5 Dave Martin 2017-12-05 329 fpsimd_flush_task_state(p); > 071b6d4a5 Dave Martin 2017-12-05 330 > 9ac080021 Al Viro 2012-10-21 331 if (likely(!(p->flags & > PF_KTHREAD))) { > 9ac080021 Al Viro 2012-10-21 332 *childregs = > *current_pt_regs(); > b3901d54d Catalin Marinas 2012-03-05 333 childregs->regs[0] = > 0; > d00a3810c Will Deacon 2015-05-27 334 > b3901d54d Catalin Marinas 2012-03-05 335 /* > b3901d54d Catalin Marinas 2012-03-05 336 * Read the current > TLS pointer from tpidr_el0 as it may be > b3901d54d Catalin Marinas 2012-03-05 337 * out-of-sync with > the saved value. > b3901d54d Catalin Marinas 2012-03-05 338 */ > adf758999 Mark Rutland 2016-09-08 339 *task_user_tls(p) = > read_sysreg(tpidr_el0); > d00a3810c Will Deacon 2015-05-27 340 > e0fd18ce1 Al Viro 2012-10-18 341 if (stack_start) { > d00a3810c Will Deacon 2015-05-27 @342 if > (is_compat_thread(task_thread_info(p))) > d00a3810c Will Deacon 2015-05-27 343 > childregs->compat_sp = stack_start; > d00a3810c Will Deacon 2015-05-27 344 else > b3901d54d Catalin Marinas 2012-03-05 345 > childregs->sp = stack_start; > b3901d54d Catalin Marinas 2012-03-05 346 } > d00a3810c Will Deacon 2015-05-27 347 > c34501d21 Catalin Marinas 2012-10-05 348 /* > c
Re: [Y2038] [PATCH v4 02/10] include: Move compat_timespec/ timeval to compat_time.h
Hi Deepa, Thank you for the patch! Yet something to improve: [auto build test ERROR on ] url: https://github.com/0day-ci/linux/commits/Deepa-Dinamani/posix_clocks-Prepare-syscalls-for-64-bit-time_t-conversion/20180313-203305 base: config: powerpc-iss476-smp_defconfig (attached as .config) compiler: powerpc-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=powerpc All errors (new ones prefixed by >>): arch/powerpc/oprofile/backtrace.c: In function 'user_getsp32': >> arch/powerpc/oprofile/backtrace.c:31:19: error: implicit declaration of >> function 'compat_ptr'; did you mean 'complete'? >> [-Werror=implicit-function-declaration] void __user *p = compat_ptr(sp); ^~ complete >> arch/powerpc/oprofile/backtrace.c:31:19: error: initialization makes pointer >> from integer without a cast [-Werror=int-conversion] cc1: all warnings being treated as errors vim +31 arch/powerpc/oprofile/backtrace.c 6c6bd754 Brian Rogan 2006-03-27 27 6c6bd754 Brian Rogan 2006-03-27 28 static unsigned int user_getsp32(unsigned int sp, int is_first) 6c6bd754 Brian Rogan 2006-03-27 29 { 6c6bd754 Brian Rogan 2006-03-27 30 unsigned int stack_frame[2]; 62034f03 Al Viro 2006-09-23 @31 void __user *p = compat_ptr(sp); 6c6bd754 Brian Rogan 2006-03-27 32 62034f03 Al Viro 2006-09-23 33 if (!access_ok(VERIFY_READ, p, sizeof(stack_frame))) 6c6bd754 Brian Rogan 2006-03-27 34 return 0; 6c6bd754 Brian Rogan 2006-03-27 35 6c6bd754 Brian Rogan 2006-03-27 36 /* 6c6bd754 Brian Rogan 2006-03-27 37 * The most likely reason for this is that we returned -EFAULT, 6c6bd754 Brian Rogan 2006-03-27 38 * which means that we've done all that we can do from 6c6bd754 Brian Rogan 2006-03-27 39 * interrupt context. 6c6bd754 Brian Rogan 2006-03-27 40 */ 62034f03 Al Viro 2006-09-23 41 if (__copy_from_user_inatomic(stack_frame, p, sizeof(stack_frame))) 6c6bd754 Brian Rogan 2006-03-27 42 return 0; 6c6bd754 Brian Rogan 2006-03-27 43 6c6bd754 Brian Rogan 2006-03-27 44 if (!is_first) 6c6bd754 Brian Rogan 2006-03-27 45 oprofile_add_trace(STACK_LR32(stack_frame)); 6c6bd754 Brian Rogan 2006-03-27 46 6c6bd754 Brian Rogan 2006-03-27 47 /* 6c6bd754 Brian Rogan 2006-03-27 48 * We do not enforce increasing stack addresses here because 6c6bd754 Brian Rogan 2006-03-27 49 * we may transition to a different stack, eg a signal handler. 6c6bd754 Brian Rogan 2006-03-27 50 */ 6c6bd754 Brian Rogan 2006-03-27 51 return STACK_SP(stack_frame); 6c6bd754 Brian Rogan 2006-03-27 52 } 6c6bd754 Brian Rogan 2006-03-27 53 :: The code at line 31 was first introduced by commit :: 62034f03380a64c0144b6721f4a2aa55d65346c1 [POWERPC] powerpc oprofile __user annotations :: TO: Al Viro :: CC: Paul Mackerras --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation ___ Y2038 mailing list Y2038@lists.linaro.org https://lists.linaro.org/mailman/listinfo/y2038
Re: [Y2038] [PATCH v4 02/10] include: Move compat_timespec/ timeval to compat_time.h
Hi Deepa, Thank you for the patch! Yet something to improve: [auto build test ERROR on ] url: https://github.com/0day-ci/linux/commits/Deepa-Dinamani/posix_clocks-Prepare-syscalls-for-64-bit-time_t-conversion/20180313-203305 base: config: arm64-allnoconfig (attached as .config) compiler: aarch64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=arm64 All errors (new ones prefixed by >>): arch/arm64/kernel/process.c: In function 'copy_thread': >> arch/arm64/kernel/process.c:342:8: error: implicit declaration of function >> 'is_compat_thread'; did you mean 'is_compat_task'? >> [-Werror=implicit-function-declaration] if (is_compat_thread(task_thread_info(p))) ^~~~ is_compat_task cc1: some warnings being treated as errors vim +342 arch/arm64/kernel/process.c b3901d54d Catalin Marinas 2012-03-05 307 b3901d54d Catalin Marinas 2012-03-05 308 int copy_thread(unsigned long clone_flags, unsigned long stack_start, afa86fc42 Al Viro 2012-10-22 309 unsigned long stk_sz, struct task_struct *p) b3901d54d Catalin Marinas 2012-03-05 310 { b3901d54d Catalin Marinas 2012-03-05 311 struct pt_regs *childregs = task_pt_regs(p); b3901d54d Catalin Marinas 2012-03-05 312 c34501d21 Catalin Marinas 2012-10-05 313 memset(&p->thread.cpu_context, 0, sizeof(struct cpu_context)); c34501d21 Catalin Marinas 2012-10-05 314 bc0ee4760 Dave Martin 2017-10-31 315 /* bc0ee4760 Dave Martin 2017-10-31 316 * Unalias p->thread.sve_state (if any) from the parent task bc0ee4760 Dave Martin 2017-10-31 317 * and disable discard SVE state for p: bc0ee4760 Dave Martin 2017-10-31 318 */ bc0ee4760 Dave Martin 2017-10-31 319 clear_tsk_thread_flag(p, TIF_SVE); bc0ee4760 Dave Martin 2017-10-31 320 p->thread.sve_state = NULL; bc0ee4760 Dave Martin 2017-10-31 321 071b6d4a5 Dave Martin 2017-12-05 322 /* 071b6d4a5 Dave Martin 2017-12-05 323 * In case p was allocated the same task_struct pointer as some 071b6d4a5 Dave Martin 2017-12-05 324 * other recently-exited task, make sure p is disassociated from 071b6d4a5 Dave Martin 2017-12-05 325 * any cpu that may have run that now-exited task recently. 071b6d4a5 Dave Martin 2017-12-05 326 * Otherwise we could erroneously skip reloading the FPSIMD 071b6d4a5 Dave Martin 2017-12-05 327 * registers for p. 071b6d4a5 Dave Martin 2017-12-05 328 */ 071b6d4a5 Dave Martin 2017-12-05 329 fpsimd_flush_task_state(p); 071b6d4a5 Dave Martin 2017-12-05 330 9ac080021 Al Viro 2012-10-21 331 if (likely(!(p->flags & PF_KTHREAD))) { 9ac080021 Al Viro 2012-10-21 332 *childregs = *current_pt_regs(); b3901d54d Catalin Marinas 2012-03-05 333 childregs->regs[0] = 0; d00a3810c Will Deacon 2015-05-27 334 b3901d54d Catalin Marinas 2012-03-05 335 /* b3901d54d Catalin Marinas 2012-03-05 336 * Read the current TLS pointer from tpidr_el0 as it may be b3901d54d Catalin Marinas 2012-03-05 337 * out-of-sync with the saved value. b3901d54d Catalin Marinas 2012-03-05 338 */ adf758999 Mark Rutland 2016-09-08 339 *task_user_tls(p) = read_sysreg(tpidr_el0); d00a3810c Will Deacon 2015-05-27 340 e0fd18ce1 Al Viro 2012-10-18 341 if (stack_start) { d00a3810c Will Deacon 2015-05-27 @342 if (is_compat_thread(task_thread_info(p))) d00a3810c Will Deacon 2015-05-27 343 childregs->compat_sp = stack_start; d00a3810c Will Deacon 2015-05-27 344 else b3901d54d Catalin Marinas 2012-03-05 345 childregs->sp = stack_start; b3901d54d Catalin Marinas 2012-03-05 346 } d00a3810c Will Deacon 2015-05-27 347 c34501d21 Catalin Marinas 2012-10-05 348 /* c34501d21 Catalin Marinas 2012-10-05 349 * If a TLS pointer was passed to clone (4th argument), use it c34501d21 Catalin Marinas 2012-10-05 350 * for the new thread. c34501d21 Catalin Marinas 2012-10-05 351 */ b3901d54d Catalin Marinas 2012-03-05 352 if (clone_flags & CLONE_SETTLS) d00a3810c Will Deacon 2015-05-27 353 p->thread.tp_value = childregs->regs[3]; c34501d21 Catalin Marinas 2012-10-05 354 } else { c34501d21 Catalin Marinas 2012-10-05 355 memset(childregs, 0, sizeof(struct pt_regs)); c34501d21 Catalin Marinas 2012-10-05 356 childregs->pstate = PSR_