Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

License issue #213

Closed
nbdd0121 opened this issue Apr 22, 2021 · 6 comments
Closed

License issue #213

nbdd0121 opened this issue Apr 22, 2021 · 6 comments
Labels
• misc Related to other topics (e.g. CI).

Comments

@nbdd0121
Copy link
Member

The ecosystem prefers MIT + Apache 2.0 dual licensing while Linux is GPL-2.0. Linux-related would certainly be GPL-2.0, but at the same time Rust-for-linux may produce some libraries (e.g. fallible alloc) that are useful for other libraries as well, and license them in GPL-2.0 may hinder adoption and can potentially split the ecosystem as it cannot be merged back upstream.

Would it make sense to have a policy on which parts could be licensed in MIT + Apache 2.0 (I envision the fallible alloc fork be licensed this way)?

@ojeda ojeda added prio: normal • misc Related to other topics (e.g. CI). labels Apr 22, 2021
@ojeda
Copy link
Member

ojeda commented Apr 22, 2021

I think that preference is only intended for Rust official projects. After all, anybody can licence their own projects however they wish (assuming by ecosystem you mean the Rust one, i.e. crates.io etc.).

In any case, if we end up with a custom alloc-like library, it would likely be tailored for usage within the kernel unless we explicitly design it with general usage in mind. Furthermore, maintaining it as a separate project could be a significant effort which we need to consider. On the other hand, sharing it with other projects has many advantages, of course, so it is a good question.

Nevertheless, even if the code ends up being only useful for the Linux kernel, parts of the code could still be useful for others, so the question still applies. Another point is that we may reuse/share some parts from alloc anyway, and so those are likely to remain under the same licence.

@nbdd0121
Copy link
Member Author

nbdd0121 commented Apr 22, 2021

It's a requirement only for Rust official projects, but all libraries in the Rust ecosystem are encouraged to adopt MIT and Apache dual license, see https://rust-lang.github.io/api-guidelines/necessities.html#crate-and-its-dependencies-have-a-permissive-license-c-permissive.

@TheSven73
Copy link
Collaborator

TheSven73 commented Apr 22, 2021

Many parts of the kernel are dual licensed, e.g. (GPL-2.0 OR MPL-1.1) or (GPL-2.0 OR MIT). I wonder if such code can be merged back upstream into dual-licensed Rust? Possibly, this requires a legal opinion from lawyers.

@bensadiku
Copy link

@ojeda sorry to hijack the thread with a question but is there a plan or work being done on the alloc library? I couldn't find anything but I'd love to help out in any capacity.

@ojeda
Copy link
Member

ojeda commented Apr 22, 2021

It's a requirement only for Rust official projects, but all libraries in the Rust ecosystem are encouraged to adopt MIT and Apache dual license, see https://rust-lang.github.io/api-guidelines/necessities.html#crate-and-its-dependencies-have-a-permissive-license-c-permissive.

My reading of that document is different. It talks about libraries that need the compatibility, not all of them. For instance, if you write a library that you would like to be used by rustc, you would need to do it. In general, if you write a library that is intended to be used by everyone, including proprietary projects and companies, then you need to use a permissive licence.

@ojeda
Copy link
Member

ojeda commented Apr 22, 2021

@ojeda sorry to hijack the thread with a question but is there a plan or work being done on the alloc library? I couldn't find anything but I'd love to help out in any capacity.

Thanks! I would recommend that you join the meetings in that case.

(Also, for general questions like this, please use the mailing list. The relevant issue is #199.)

ojeda pushed a commit that referenced this issue Apr 29, 2024
When the mirred action is used on a classful egress qdisc and a packet is
mirrored or redirected to self we hit a qdisc lock deadlock.
See trace below.

[..... other info removed for brevity....]
[   82.890906]
[   82.890906] ============================================
[   82.890906] WARNING: possible recursive locking detected
[   82.890906] 6.8.0-05205-g77fadd89fe2d-dirty #213 Tainted: G        W
[   82.890906] --------------------------------------------
[   82.890906] ping/418 is trying to acquire lock:
[   82.890906] ffff888006994110 (&sch->q.lock){+.-.}-{3:3}, at:
__dev_queue_xmit+0x1778/0x3550
[   82.890906]
[   82.890906] but task is already holding lock:
[   82.890906] ffff888006994110 (&sch->q.lock){+.-.}-{3:3}, at:
__dev_queue_xmit+0x1778/0x3550
[   82.890906]
[   82.890906] other info that might help us debug this:
[   82.890906]  Possible unsafe locking scenario:
[   82.890906]
[   82.890906]        CPU0
[   82.890906]        ----
[   82.890906]   lock(&sch->q.lock);
[   82.890906]   lock(&sch->q.lock);
[   82.890906]
[   82.890906]  *** DEADLOCK ***
[   82.890906]
[..... other info removed for brevity....]

Example setup (eth0->eth0) to recreate
tc qdisc add dev eth0 root handle 1: htb default 30
tc filter add dev eth0 handle 1: protocol ip prio 2 matchall \
     action mirred egress redirect dev eth0

Another example(eth0->eth1->eth0) to recreate
tc qdisc add dev eth0 root handle 1: htb default 30
tc filter add dev eth0 handle 1: protocol ip prio 2 matchall \
     action mirred egress redirect dev eth1

tc qdisc add dev eth1 root handle 1: htb default 30
tc filter add dev eth1 handle 1: protocol ip prio 2 matchall \
     action mirred egress redirect dev eth0

We fix this by adding an owner field (CPU id) to struct Qdisc set after
root qdisc is entered. When the softirq enters it a second time, if the
qdisc owner is the same CPU, the packet is dropped to break the loop.

Reported-by: Mingshuai Ren <renmingshuai@huawei.com>
Closes: https://lore.kernel.org/netdev/20240314111713.5979-1-renmingshuai@huawei.com/
Fixes: 3bcb846 ("net: get rid of spin_trylock() in net_tx_action()")
Fixes: e578d9c ("net: sched: use counter to break reclassify loops")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Victor Nogueira <victor@mojatatu.com>
Reviewed-by: Pedro Tammela <pctammela@mojatatu.com>
Tested-by: Jamal Hadi Salim <jhs@mojatatu.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Link: https://lore.kernel.org/r/20240415210728.36949-1-victor@mojatatu.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
@ojeda ojeda closed this as completed Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
• misc Related to other topics (e.g. CI).
Development

No branches or pull requests

4 participants