All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guo Ren <guoren@kernel.org>
To: Palmer Dabbelt <palmer@dabbelt.com>
Cc: "Guenter Roeck" <linux@roeck-us.net>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"Heiko Stübner" <heiko@sntech.de>,
	linux-riscv <linux-riscv@lists.infradead.org>,
	linux-arch <linux-arch@vger.kernel.org>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"Guo Ren" <guoren@linux.alibaba.com>
Subject: Re: [PATCH] riscv: compat: Using seperated vdso_maps for compat_vdso_info
Date: Thu, 26 May 2022 09:25:51 +0800	[thread overview]
Message-ID: <CAJF2gTQQEYKz7EG9=bdSC6E4_ds5D9FmAK1TBZgmsB3T-nrGiw@mail.gmail.com> (raw)
In-Reply-To: <mhng-54a3577b-2ae9-4ca0-a27d-f75f13807a29@palmer-ri-x1c9>

On Thu, May 26, 2022 at 8:43 AM Palmer Dabbelt <palmer@dabbelt.com> wrote:
>
> On Wed, 25 May 2022 17:39:39 PDT (-0700), Palmer Dabbelt wrote:
> > On Wed, 25 May 2022 15:56:07 PDT (-0700), linux@roeck-us.net wrote:
> >> On 5/25/22 14:34, Palmer Dabbelt wrote:
> >>> On Wed, 25 May 2022 14:15:03 PDT (-0700), linux@roeck-us.net wrote:
> >>>> On 5/25/22 09:04, guoren@kernel.org wrote:
> >>>>> From: Guo Ren <guoren@linux.alibaba.com>
> >>>>>
> >>>>> This is a fixup for vdso implementation which caused musl to
> >>>>> fail.
> >>>>>
> >>>>> [   11.600082] Run /sbin/init as init process
> >>>>> [   11.628561] init[1]: unhandled signal 11 code 0x1 at
> >>>>> 0x0000000000000000 in libc.so[ffffff8ad39000+a4000]
> >>>>> [   11.629398] CPU: 0 PID: 1 Comm: init Not tainted
> >>>>> 5.18.0-rc7-next-20220520 #1
> >>>>> [   11.629462] Hardware name: riscv-virtio,qemu (DT)
> >>>>> [   11.629546] epc : 00ffffff8ada1100 ra : 00ffffff8ada13c8 sp :
> >>>>> 00ffffffc58199f0
> >>>>> [   11.629586]  gp : 00ffffff8ad39000 tp : 00ffffff8ade0998 t0 :
> >>>>> ffffffffffffffff
> >>>>> [   11.629598]  t1 : 00ffffffc5819fd0 t2 : 0000000000000000 s0 :
> >>>>> 00ffffff8ade0cc0
> >>>>> [   11.629610]  s1 : 00ffffff8ade0cc0 a0 : 0000000000000000 a1 :
> >>>>> 00ffffffc5819a00
> >>>>> [   11.629622]  a2 : 0000000000000001 a3 : 000000000000001e a4 :
> >>>>> 00ffffffc5819b00
> >>>>> [   11.629634]  a5 : 00ffffffc5819b00 a6 : 0000000000000000 a7 :
> >>>>> 0000000000000000
> >>>>> [   11.629645]  s2 : 00ffffff8ade0ac8 s3 : 00ffffff8ade0ec8 s4 :
> >>>>> 00ffffff8ade0728
> >>>>> [   11.629656]  s5 : 00ffffff8ade0a90 s6 : 0000000000000000 s7 :
> >>>>> 00ffffffc5819e40
> >>>>> [   11.629667]  s8 : 00ffffff8ade0ca0 s9 : 00ffffff8addba50 s10:
> >>>>> 0000000000000000
> >>>>> [   11.629678]  s11: 0000000000000000 t3 : 0000000000000002 t4 :
> >>>>> 0000000000000001
> >>>>> [   11.629688]  t5 : 0000000000020000 t6 : ffffffffffffffff
> >>>>> [   11.629699] status: 0000000000004020 badaddr: 0000000000000000
> >>>>> cause: 000000000000000d
> >>>>>
> >>>>> The last __vdso_init(&compat_vdso_info) replaces the data in normal
> >>>>> vdso_info. This is an obvious bug.
> >>>>>
> >>>>> Reported-by: Guenter Roeck <linux@roeck-us.net>
> >>>>> Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
> >>>>> Signed-off-by: Guo Ren <guoren@kernel.org>
> >>>>> Cc: Palmer Dabbelt <palmer@dabbelt.com>
> >>>>> Cc: Heiko Stübner <heiko@sntech.de>
> >>>>
> >>>> Tested-by: Guenter Roeck <linux@roeck-us.net>
> >>>
> >>> Sorry I'm a bit buried right now, this is fixing the issue you pointed out earlier?
> >>>
> >> Yes.
> >
> > Awosome, I think that was the only big blocker so far.
> >
> > I added a musl-based userspace to my test setup, which is rv64-only
> > (buildroot doesn't have rv32 musl, I thought upstream had it but maybe
> > i'm misremembering).  This patch fixes the bug, so I've added it to
> > for-next with
>
> Just saw the v2, so I'm using that instead.
Sorry, v2 should be abandoned. Just adding Tested-by is enough.

>
> >
> > Fixes: 3092eb456375 ("riscv: compat: vdso: Add setup additional pages implementation")
> >
> > which I think is correct, but LMK if there's an issue.
> >
> > Thanks!
> >
> > (and also sorry I poked Geert instead of you about this one, oops ;))
> >
> >>
> >> Thanks,
> >> Guenter
> >>
> >>>>
> >>>>> ---
> >>>>>   arch/riscv/kernel/vdso.c | 15 +++++++++++++--
> >>>>>   1 file changed, 13 insertions(+), 2 deletions(-)
> >>>>>
> >>>>> diff --git a/arch/riscv/kernel/vdso.c b/arch/riscv/kernel/vdso.c
> >>>>> index 50fe4c877603..69b05b6c181b 100644
> >>>>> --- a/arch/riscv/kernel/vdso.c
> >>>>> +++ b/arch/riscv/kernel/vdso.c
> >>>>> @@ -206,12 +206,23 @@ static struct __vdso_info vdso_info __ro_after_init = {
> >>>>>   };
> >>>>>
> >>>>>   #ifdef CONFIG_COMPAT
> >>>>> +static struct vm_special_mapping rv_compat_vdso_maps[] __ro_after_init = {
> >>>>> +    [RV_VDSO_MAP_VVAR] = {
> >>>>> +        .name   = "[vvar]",
> >>>>> +        .fault = vvar_fault,
> >>>>> +    },
> >>>>> +    [RV_VDSO_MAP_VDSO] = {
> >>>>> +        .name   = "[vdso]",
> >>>>> +        .mremap = vdso_mremap,
> >>>>> +    },
> >>>>> +};
> >>>>> +
> >>>>>   static struct __vdso_info compat_vdso_info __ro_after_init = {
> >>>>>       .name = "compat_vdso",
> >>>>>       .vdso_code_start = compat_vdso_start,
> >>>>>       .vdso_code_end = compat_vdso_end,
> >>>>> -    .dm = &rv_vdso_maps[RV_VDSO_MAP_VVAR],
> >>>>> -    .cm = &rv_vdso_maps[RV_VDSO_MAP_VDSO],
> >>>>> +    .dm = &rv_compat_vdso_maps[RV_VDSO_MAP_VVAR],
> >>>>> +    .cm = &rv_compat_vdso_maps[RV_VDSO_MAP_VDSO],
> >>>>>   };
> >>>>>   #endif
> >>>>>



-- 
Best Regards
 Guo Ren

ML: https://lore.kernel.org/linux-csky/

WARNING: multiple messages have this Message-ID (diff)
From: Guo Ren <guoren@kernel.org>
To: Palmer Dabbelt <palmer@dabbelt.com>
Cc: "Guenter Roeck" <linux@roeck-us.net>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"Heiko Stübner" <heiko@sntech.de>,
	linux-riscv <linux-riscv@lists.infradead.org>,
	linux-arch <linux-arch@vger.kernel.org>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"Guo Ren" <guoren@linux.alibaba.com>
Subject: Re: [PATCH] riscv: compat: Using seperated vdso_maps for compat_vdso_info
Date: Thu, 26 May 2022 09:25:51 +0800	[thread overview]
Message-ID: <CAJF2gTQQEYKz7EG9=bdSC6E4_ds5D9FmAK1TBZgmsB3T-nrGiw@mail.gmail.com> (raw)
In-Reply-To: <mhng-54a3577b-2ae9-4ca0-a27d-f75f13807a29@palmer-ri-x1c9>

On Thu, May 26, 2022 at 8:43 AM Palmer Dabbelt <palmer@dabbelt.com> wrote:
>
> On Wed, 25 May 2022 17:39:39 PDT (-0700), Palmer Dabbelt wrote:
> > On Wed, 25 May 2022 15:56:07 PDT (-0700), linux@roeck-us.net wrote:
> >> On 5/25/22 14:34, Palmer Dabbelt wrote:
> >>> On Wed, 25 May 2022 14:15:03 PDT (-0700), linux@roeck-us.net wrote:
> >>>> On 5/25/22 09:04, guoren@kernel.org wrote:
> >>>>> From: Guo Ren <guoren@linux.alibaba.com>
> >>>>>
> >>>>> This is a fixup for vdso implementation which caused musl to
> >>>>> fail.
> >>>>>
> >>>>> [   11.600082] Run /sbin/init as init process
> >>>>> [   11.628561] init[1]: unhandled signal 11 code 0x1 at
> >>>>> 0x0000000000000000 in libc.so[ffffff8ad39000+a4000]
> >>>>> [   11.629398] CPU: 0 PID: 1 Comm: init Not tainted
> >>>>> 5.18.0-rc7-next-20220520 #1
> >>>>> [   11.629462] Hardware name: riscv-virtio,qemu (DT)
> >>>>> [   11.629546] epc : 00ffffff8ada1100 ra : 00ffffff8ada13c8 sp :
> >>>>> 00ffffffc58199f0
> >>>>> [   11.629586]  gp : 00ffffff8ad39000 tp : 00ffffff8ade0998 t0 :
> >>>>> ffffffffffffffff
> >>>>> [   11.629598]  t1 : 00ffffffc5819fd0 t2 : 0000000000000000 s0 :
> >>>>> 00ffffff8ade0cc0
> >>>>> [   11.629610]  s1 : 00ffffff8ade0cc0 a0 : 0000000000000000 a1 :
> >>>>> 00ffffffc5819a00
> >>>>> [   11.629622]  a2 : 0000000000000001 a3 : 000000000000001e a4 :
> >>>>> 00ffffffc5819b00
> >>>>> [   11.629634]  a5 : 00ffffffc5819b00 a6 : 0000000000000000 a7 :
> >>>>> 0000000000000000
> >>>>> [   11.629645]  s2 : 00ffffff8ade0ac8 s3 : 00ffffff8ade0ec8 s4 :
> >>>>> 00ffffff8ade0728
> >>>>> [   11.629656]  s5 : 00ffffff8ade0a90 s6 : 0000000000000000 s7 :
> >>>>> 00ffffffc5819e40
> >>>>> [   11.629667]  s8 : 00ffffff8ade0ca0 s9 : 00ffffff8addba50 s10:
> >>>>> 0000000000000000
> >>>>> [   11.629678]  s11: 0000000000000000 t3 : 0000000000000002 t4 :
> >>>>> 0000000000000001
> >>>>> [   11.629688]  t5 : 0000000000020000 t6 : ffffffffffffffff
> >>>>> [   11.629699] status: 0000000000004020 badaddr: 0000000000000000
> >>>>> cause: 000000000000000d
> >>>>>
> >>>>> The last __vdso_init(&compat_vdso_info) replaces the data in normal
> >>>>> vdso_info. This is an obvious bug.
> >>>>>
> >>>>> Reported-by: Guenter Roeck <linux@roeck-us.net>
> >>>>> Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
> >>>>> Signed-off-by: Guo Ren <guoren@kernel.org>
> >>>>> Cc: Palmer Dabbelt <palmer@dabbelt.com>
> >>>>> Cc: Heiko Stübner <heiko@sntech.de>
> >>>>
> >>>> Tested-by: Guenter Roeck <linux@roeck-us.net>
> >>>
> >>> Sorry I'm a bit buried right now, this is fixing the issue you pointed out earlier?
> >>>
> >> Yes.
> >
> > Awosome, I think that was the only big blocker so far.
> >
> > I added a musl-based userspace to my test setup, which is rv64-only
> > (buildroot doesn't have rv32 musl, I thought upstream had it but maybe
> > i'm misremembering).  This patch fixes the bug, so I've added it to
> > for-next with
>
> Just saw the v2, so I'm using that instead.
Sorry, v2 should be abandoned. Just adding Tested-by is enough.

>
> >
> > Fixes: 3092eb456375 ("riscv: compat: vdso: Add setup additional pages implementation")
> >
> > which I think is correct, but LMK if there's an issue.
> >
> > Thanks!
> >
> > (and also sorry I poked Geert instead of you about this one, oops ;))
> >
> >>
> >> Thanks,
> >> Guenter
> >>
> >>>>
> >>>>> ---
> >>>>>   arch/riscv/kernel/vdso.c | 15 +++++++++++++--
> >>>>>   1 file changed, 13 insertions(+), 2 deletions(-)
> >>>>>
> >>>>> diff --git a/arch/riscv/kernel/vdso.c b/arch/riscv/kernel/vdso.c
> >>>>> index 50fe4c877603..69b05b6c181b 100644
> >>>>> --- a/arch/riscv/kernel/vdso.c
> >>>>> +++ b/arch/riscv/kernel/vdso.c
> >>>>> @@ -206,12 +206,23 @@ static struct __vdso_info vdso_info __ro_after_init = {
> >>>>>   };
> >>>>>
> >>>>>   #ifdef CONFIG_COMPAT
> >>>>> +static struct vm_special_mapping rv_compat_vdso_maps[] __ro_after_init = {
> >>>>> +    [RV_VDSO_MAP_VVAR] = {
> >>>>> +        .name   = "[vvar]",
> >>>>> +        .fault = vvar_fault,
> >>>>> +    },
> >>>>> +    [RV_VDSO_MAP_VDSO] = {
> >>>>> +        .name   = "[vdso]",
> >>>>> +        .mremap = vdso_mremap,
> >>>>> +    },
> >>>>> +};
> >>>>> +
> >>>>>   static struct __vdso_info compat_vdso_info __ro_after_init = {
> >>>>>       .name = "compat_vdso",
> >>>>>       .vdso_code_start = compat_vdso_start,
> >>>>>       .vdso_code_end = compat_vdso_end,
> >>>>> -    .dm = &rv_vdso_maps[RV_VDSO_MAP_VVAR],
> >>>>> -    .cm = &rv_vdso_maps[RV_VDSO_MAP_VDSO],
> >>>>> +    .dm = &rv_compat_vdso_maps[RV_VDSO_MAP_VVAR],
> >>>>> +    .cm = &rv_compat_vdso_maps[RV_VDSO_MAP_VDSO],
> >>>>>   };
> >>>>>   #endif
> >>>>>



-- 
Best Regards
 Guo Ren

ML: https://lore.kernel.org/linux-csky/

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2022-05-26  1:26 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-25 16:04 [PATCH] riscv: compat: Using seperated vdso_maps for compat_vdso_info guoren
2022-05-25 16:04 ` guoren
2022-05-25 19:36 ` Heiko Stübner
2022-05-25 19:36   ` Heiko Stübner
2022-05-25 19:45   ` Heiko Stübner
2022-05-25 19:45     ` Heiko Stübner
2022-05-25 21:15 ` Guenter Roeck
2022-05-25 21:15   ` Guenter Roeck
2022-05-25 21:34   ` Palmer Dabbelt
2022-05-25 21:34     ` Palmer Dabbelt
2022-05-25 22:56     ` Guenter Roeck
2022-05-25 22:56       ` Guenter Roeck
2022-05-26  0:39       ` Palmer Dabbelt
2022-05-26  0:39         ` Palmer Dabbelt
2022-05-26  0:43         ` Palmer Dabbelt
2022-05-26  0:43           ` Palmer Dabbelt
2022-05-26  1:25           ` Guo Ren [this message]
2022-05-26  1:25             ` Guo Ren
2022-05-26  0:43         ` Guo Ren
2022-05-26  0:43           ` Guo Ren
2022-05-26  0:35     ` Guo Ren
2022-05-26  0:35       ` Guo Ren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJF2gTQQEYKz7EG9=bdSC6E4_ds5D9FmAK1TBZgmsB3T-nrGiw@mail.gmail.com' \
    --to=guoren@kernel.org \
    --cc=arnd@arndb.de \
    --cc=guoren@linux.alibaba.com \
    --cc=heiko@sntech.de \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux@roeck-us.net \
    --cc=palmer@dabbelt.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.