Message ID | 20250325121624.523258-26-guoren@kernel.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | rv64ilp32_abi: Build CONFIG_64BIT kernel-self with ILP32 ABI | expand |
On 3/25/25 3:16 PM, guoren@kernel.org wrote: > From: "Guo Ren (Alibaba DAMO Academy)" <guoren@kernel.org> > > The rv64ilp32 abi reuses the env and argv memory layout of the > lp64 abi, so leave the space to fit the lp64 struct layout. > > Signed-off-by: Guo Ren (Alibaba DAMO Academy) <guoren@kernel.org> > --- > fs/exec.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/fs/exec.c b/fs/exec.c > index 506cd411f4ac..548d18b7ae92 100644 > --- a/fs/exec.c > +++ b/fs/exec.c > @@ -424,6 +424,10 @@ static const char __user *get_user_arg_ptr(struct user_arg_ptr argv, int nr) > } > #endif > > +#if defined(CONFIG_64BIT) && (BITS_PER_LONG == 32) Parens don't seem necessary... > + nr = nr * 2; Why not nr *= 2? [...] MBR, Sergey
On Wed, Mar 26, 2025 at 1:19 AM Sergey Shtylyov <s.shtylyov@omp.ru> wrote: > > On 3/25/25 3:16 PM, guoren@kernel.org wrote: > > > From: "Guo Ren (Alibaba DAMO Academy)" <guoren@kernel.org> > > > > The rv64ilp32 abi reuses the env and argv memory layout of the > > lp64 abi, so leave the space to fit the lp64 struct layout. > > > > Signed-off-by: Guo Ren (Alibaba DAMO Academy) <guoren@kernel.org> > > --- > > fs/exec.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/fs/exec.c b/fs/exec.c > > index 506cd411f4ac..548d18b7ae92 100644 > > --- a/fs/exec.c > > +++ b/fs/exec.c > > @@ -424,6 +424,10 @@ static const char __user *get_user_arg_ptr(struct user_arg_ptr argv, int nr) > > } > > #endif > > > > +#if defined(CONFIG_64BIT) && (BITS_PER_LONG == 32) okay, #if defined(CONFIG_64BIT) && BITS_PER_LONG == 32 > > Parens don't seem necessary... > > > + nr = nr * 2; > > Why not nr *= 2? okay, nr *= 2;
diff --git a/fs/exec.c b/fs/exec.c index 506cd411f4ac..548d18b7ae92 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -424,6 +424,10 @@ static const char __user *get_user_arg_ptr(struct user_arg_ptr argv, int nr) } #endif +#if defined(CONFIG_64BIT) && (BITS_PER_LONG == 32) + nr = nr * 2; +#endif + if (get_user(native, argv.ptr.native + nr)) return ERR_PTR(-EFAULT);