CVE-2024-56655

Summary

In the Linux kernel, the following vulnerability has been resolved:

netfilter: nf_tables: do not defer rule destruction via call_rcu

nf_tables_chain_destroy can sleep, it can't be used from call_rcu callbacks.

Moreover, nf_tables_rule_release() is only safe for error unwinding, while transaction mutex is held and the to-be-desroyed rule was not exposed to either dataplane or dumps, as it deactives+frees without the required synchronize_rcu() in-between.

nft_rule_expr_deactivate() callbacks will change ->use counters of other chains/sets, see e.g. nft_lookup .deactivate callback, these must be serialized via transaction mutex.

Also add a few lockdep asserts to make this more explicit.

Calling synchronize_rcu() isn't ideal, but fixing this without is hard and way more intrusive. As-is, we can get:

WARNING: .. net/netfilter/nf_tables_api.c:5515 nft_set_destroy+0x.. Workqueue: events nf_tables_trans_destroy_work RIP: 0010:nft_set_destroy+0x3fe/0x5c0 Call Trace: <TASK> nf_tables_trans_destroy_work+0x6b7/0xad0 process_one_work+0x64a/0xce0 worker_thread+0x613/0x10d0

In case the synchronize_rcu becomes an issue, we can explore alternatives.

One way would be to allocate nft_trans_rule objects + one nft_trans_chain object, deactivate the rules + the chain and then defer the freeing to the nft destroy workqueue. We'd still need to keep the synchronize_rcu path as a fallback to handle -ENOMEM corner cases though.

Affected Software

VendorProductVersion RangeStatus
LinuxLinux9eee6097ffb26cdd2adb988c0d378fa0d650c737 < 5146c27b2780aac59876a887a5f4e793b8949862affected
LinuxLinux558f503f707f481bbf40efa74a938b8021df841d < 2991dc357a28b61c13ed1f7b59e9251e2b4562fbaffected
LinuxLinuxa394c160d57f4b083bd904a22802f6fb7f5b3cea < b8d8f53e1858178882b881b8c09f94ef0e83bf76affected
LinuxLinuxe6c32a64d61184c2bdf89442b3d31ef530afba34 < b0f013bebf94fe7ae75e5a53be2f2bd1cc1841e3affected
LinuxLinuxbfd05c68e4c6320304e9f371ffa356b6e4b9cc53 < 27f0574253f6c24c8ee4e3f0a685b75ed3a256edaffected
LinuxLinuxc03d278fdf35e73dd0ec543b9b556876b9d9a8dc < 7cf0bd232b565d9852cb25fd094f77254773e048affected
LinuxLinuxc03d278fdf35e73dd0ec543b9b556876b9d9a8dc < b04df3da1b5c6f6dc7cdccc37941740c078c4043affected
LinuxLinuxcb401e5799e0acacb405f2128097e9c4ccf82f8aaffected
LinuxLinux6.6.61 < 6.6.67affected
LinuxLinux6.11.8 < 6.12affected
LinuxLinux6.12affected
LinuxLinux0 < 6.12unaffected
LinuxLinux6.6.67 <= 6.6.*unaffected
LinuxLinux6.12.6 <= 6.12.*unaffected
LinuxLinux6.13 <= *unaffected

Weaknesses

References