Re: patch: support long (above 14 bytes) HW addresses in arp_ioctl

From: Roland Dreier
Date: Mon Nov 03 2008 - 12:39:43 EST


> * arp_ioctl will corrupt the kernel and user memory when this ioctl is
> used on the adapters that have HW addresses longer that 14 bytes.
> This is because when copying the HW address, the arp_ioctl code copies
> dev->addr_len bytes without checking that addr_len is not above 14
> bytes. This is done both for copy_to_user() and memcpy() calls on
> kernel data structures allocated on stack. The memcpy() call in
> particular, will corrupt kernel stack.

It's not obvious to me after a quick glance where this kernel memory
corruption occurs, but clearly we should at least fix this bug.

> The patch does not change the existing ABI but extends it. The kernel
> structure used in arp_ioctl calls is changed to support larger
> addresses, while the user-space structure is extended by appending
> extra-space to the end of the structure if ATF_NEWARPCTL -- a new flag
> -- is set in arp_flags of existing user-space structure. This allows
> avoiding big changes to the existing code while preserving the ABI
> compatibility.

However, given that applications need to be changed to use this,
wouldn't it make more sense just to change those applications to use
rtnetlink, which already supports large hardware addresses? ie is there
much point to extending a legacy ABI to add a feature that the preferred
modern interface already has?

- R.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/