This patch series enables macvlan and macvtap support on the morello board. MACVLAN is an important part of containerised hosts.
0001 makes changes to tap.c such that CHERI capabilities can be used and "pointer or value" arguments are addressed in a compat function
0002 enables MACVLAN and MACVTAP support in the tree
The change has been tested using Docker
Harrison Marcks (2): net: tap: make PCuABI compliant arm64: morello: enable MACVLAN by default
.../morello_transitional_pcuabi_defconfig | 2 ++ drivers/net/tap.c | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-)
Here tap_ioctl is updated to a user_uintptr_t to make use of CHERI capabilities and a compat_tap_ioctl function is so that when arg is a value and not a pointer, it is handled correctly. --- drivers/net/tap.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/drivers/net/tap.c b/drivers/net/tap.c index 9e75ed3f08ce..0bea2a4280c9 100644 --- a/drivers/net/tap.c +++ b/drivers/net/tap.c @@ -986,7 +986,7 @@ static int set_offload(struct tap_queue *q, unsigned long arg) * provide compatibility with generic tun/tap interface */ static long tap_ioctl(struct file *file, unsigned int cmd, - unsigned long arg) + user_uintptr_t arg) { struct tap_queue *q = file->private_data; struct tap_dev *tap; @@ -1134,6 +1134,17 @@ static long tap_ioctl(struct file *file, unsigned int cmd, } }
+#ifdef CONFIG_COMPAT +static long compat_tap_ioctl(struct file *file, unsigned int cmd, + unsigned long arg) +{ + user_uintptr_t cmd_arg = (cmd != TUNSETOFFLOAD) ? + (user_uintptr_t)compat_ptr(arg) : + (user_uintptr_t)arg; + return tap_ioctl(file, cmd, cmd_arg); +} +#endif + static const struct file_operations tap_fops = { .owner = THIS_MODULE, .open = tap_open, @@ -1143,7 +1154,9 @@ static const struct file_operations tap_fops = { .poll = tap_poll, .llseek = no_llseek, .unlocked_ioctl = tap_ioctl, - .compat_ioctl = compat_ptr_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = compat_tap_ioctl, +#endif };
static int tap_get_user_xdp(struct tap_queue *q, struct xdp_buff *xdp)
It is useful to have MACVLANS enabled by default much like they are in the standard kernel. This allows on the fly container setups without necassarily needing a rebuild. --- arch/arm64/configs/morello_transitional_pcuabi_defconfig | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/arch/arm64/configs/morello_transitional_pcuabi_defconfig b/arch/arm64/configs/morello_transitional_pcuabi_defconfig index 856806652bac..ba0a947f25e0 100644 --- a/arch/arm64/configs/morello_transitional_pcuabi_defconfig +++ b/arch/arm64/configs/morello_transitional_pcuabi_defconfig @@ -95,6 +95,8 @@ CONFIG_SATA_AHCI=y CONFIG_MD=y CONFIG_BLK_DEV_DM=y CONFIG_NETDEVICES=y +CONFIG_MACVLAN=y +CONFIG_MACVTAP=y CONFIG_TUN=y CONFIG_VETH=y CONFIG_VIRTIO_NET=y
On 26/07/2023 14:17, Harrison Marcks wrote:
This patch series enables macvlan and macvtap support on the morello board. MACVLAN is an important part of containerised hosts.
0001 makes changes to tap.c such that CHERI capabilities can be used and "pointer or value" arguments are addressed in a compat function
0002 enables MACVLAN and MACVTAP support in the tree
The change has been tested using Docker
Thank you for your contribution Harrison, the patches look good to me! The only issue is that the commit messages are missing your Signed-off-by, which is an important part of the standard kernel contribution process [1]. Please resend the patches with your Signed-off-by added.
Kevin
[1] https://docs.kernel.org/process/submitting-patches.html#sign-your-work-the-d...
Harrison Marcks (2): net: tap: make PCuABI compliant arm64: morello: enable MACVLAN by default
.../morello_transitional_pcuabi_defconfig | 2 ++ drivers/net/tap.c | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-)
linux-morello@op-lists.linaro.org