-
Notifications
You must be signed in to change notification settings - Fork 129
Commit c8c5e35
committed
af_xdp: Allow running onload as non-root
There's a TODO saying how it fails when the process does not have
CAP_NET_RAW. This is true, so to workaround that, swap to a
temporary global-root cred from `prepare_kernel_cred(&init_task)`.
While in theory one could create a less-privileged cred via
`prepare_creds()` and individually raise the required capability
bits, just like in oo_cplane_empower_cap_net_raw, unfortunately
xdp_umem_create -> xdp_umem_reg -> xdp_umem_account_pages requires
CAP_IPC_LOCK in the init user ns, and escalating to init user ns
while keeping capability bits sounds meaningless to me.
The netns of the process is backed by the nsproxy and not the cred
so this should not affect netns. Though I'm not sure about the
security implications of this, considering onload is able to run
rootless in non-AF_XDP mode already.
Signed-off-by: YiFei Zhu <zhuyifei@google.com>1 parent 221f5f4 commit c8c5e35
1 file changed
+18
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
730 | 730 | | |
731 | 731 | | |
732 | 732 | | |
733 | + | ||
734 | + | ||
733 | 735 | | |
734 | 736 | | |
735 | 737 | | |
| |||
749 | 751 | | |
750 | 752 | | |
751 | 753 | | |
754 | + | ||
755 | + | ||
756 | + | ||
757 | + | ||
758 | + | ||
752 | 759 | | |
753 | 760 | | |
754 | 761 | | |
755 | - | ||
756 | 762 | | |
757 | 763 | | |
758 | 764 | | |
759 | - | ||
765 | + | ||
760 | 766 | | |
761 | 767 | | |
762 | - | ||
763 | - | ||
768 | + | ||
769 | + | ||
770 | + | ||
771 | + | ||
764 | 772 | | |
765 | 773 | | |
766 | 774 | | |
| |||
815 | 823 | | |
816 | 824 | | |
817 | 825 | | |
826 | + | ||
827 | + | ||
828 | + | ||
818 | 829 | | |
819 | 830 | | |
820 | 831 | | |
821 | 832 | | |
822 | 833 | | |
834 | + | ||
835 | + | ||
836 | + | ||
823 | 837 | | |
824 | 838 | | |
825 | 839 | | |
| |||
0 commit comments