lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABgGipXu7iq-J5v6GVMPrnHiGVLuMxabB0_hPb+o+04T2MAwpw@mail.gmail.com>
Date:   Tue, 30 May 2023 17:48:58 +0800
From:   Andy Chiu <andy.chiu@...ive.com>
To:     Guo Ren <guoren@...nel.org>
Cc:     Conor Dooley <conor.dooley@...rochip.com>, greentime.hu@...ive.com,
        vincent.chen@...ive.com, paul.walmsley@...ive.com,
        palmer@...osinc.com, linux-riscv@...ts.infradead.org,
        linux-kernel@...r.kernel.org, Guo Ren <guoren@...ux.alibaba.com>
Subject: Re: [PATCH] riscv: vector: Fixup modules compile error

On Tue, May 30, 2023 at 2:52 PM Guo Ren <guoren@...nel.org> wrote:
>
> On Tue, May 30, 2023 at 10:59 AM Guo Ren <guoren@...nel.org> wrote:
> >
> > On Mon, May 29, 2023 at 9:43 PM Conor Dooley <conor.dooley@...rochip.com> wrote:
> > >
> > > On Mon, May 29, 2023 at 03:38:45AM -0400, guoren@...nel.org wrote:
> > > > From: Guo Ren <guoren@...ux.alibaba.com>
> > > >
> > > > Some .ko also need the riscv_v_user_allowed symbol.
> > > >
> > > > ERROR: modpost: "riscv_v_user_allowed" [arch/riscv/kvm/kvm.ko]
> > > > undefined!
> > > > make[3]: ***
> > > > [/home/guoren/source/kernel/linux/scripts/Makefile.modpost:136:
> > > > Module.symvers] Error 1
> > > >
> > > > Signed-off-by: Guo Ren <guoren@...ux.alibaba.com>
> > > > Signed-off-by: Guo Ren <guoren@...nel.org>
> > > > ---
> > > >  arch/riscv/kernel/vector.c | 1 +
> > > >  1 file changed, 1 insertion(+)
> > > >
> > > > diff --git a/arch/riscv/kernel/vector.c b/arch/riscv/kernel/vector.c
> > > > index 1c4ac821e008..3ae08816d608 100644
> > > > --- a/arch/riscv/kernel/vector.c
> > > > +++ b/arch/riscv/kernel/vector.c
> > > > @@ -129,6 +129,7 @@ bool riscv_v_user_allowed(void)
> > > >  {
> > > >       return riscv_v_get_cur_ctrl(current) == PR_RISCV_V_VSTATE_CTRL_ON;
> > > >  }
> > > > +EXPORT_SYMBOL(riscv_v_user_allowed);
> > >
> > > Is there a reason that this should not be EXPORT_SYMBOL_GPL()?
> > Good question, but I just follow our arch/riscv habbit, maybe we
> > should change all of that in another patch.
> >
> > ➜  linux-s64ilp32 git:(s64ilp32) ✗ grep EXPORT_SYMBOL  arch/riscv -r | wc -l
> > 66
> > ➜  linux-s64ilp32 git:(s64ilp32) ✗ grep EXPORT_SYMBOL_GPL  arch/riscv -r | wc -l
> > 15
>
> Why !MODULE_LICENSE(GPL) modules couldn't use riscv_v_user_allowed?
> Seems EXPORT_SYMBOL_GPL has more limitations.
>
> :c:func:`EXPORT_SYMBOL_GPL()`
> -----------------------------
>
> Defined in ``include/linux/export.h``
>
> Similar to :c:func:`EXPORT_SYMBOL()` except that the symbols
> exported by :c:func:`EXPORT_SYMBOL_GPL()` can only be seen by
> modules with a :c:func:`MODULE_LICENSE()` that specifies a GPL
> compatible license. It implies that the function is considered an
> internal implementation issue, and not really an interface. Some
> maintainers and developers may however require EXPORT_SYMBOL_GPL()
> when adding any new APIs or functionality.
>
> For kvm is okay:
>
> MODULE_AUTHOR("Qumranet");
> MODULE_LICENSE("GPL");
>
> So, I would leave the decition to Andy. If he didn't want it used with
> other non-gpl modules, choose the EXPORT_SYMBOL_GPL.

Do you have any use case for exporting this function to non-GPL
licensed modules? I exported the function with EXPORT_SYMBOL_GPL() in
v20[1] because I thought most maintainers would accept GPL rather than
non-GPL one. And it seems most drivers would never call this function
anyway.

>
> >
> > >
> > > I figure Andy will roll this into this next revision.

The fix for this has been included in v20[1]. However, I also changed
the function name
s/riscv_v_user_allowed/riscv_v_vstate_ctrl_user_allowed/.

> > >
> > > Cheers,
> > > Conor.
> >
> >
> >
> > --
> > Best Regards
> >  Guo Ren
>
>
>
> --
> Best Regards
>  Guo Ren

[1]: https://lore.kernel.org/all/20230518161949.11203-21-andy.chiu@sifive.com/

Cheers,
Andy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ