[PATCH 1/2] rtnl_link: decode ifinfomsg netlink attributes
Dmitry V. Levin
ldv at altlinux.org
Fri Aug 18 10:42:24 UTC 2017
On Fri, Aug 18, 2017 at 04:43:57PM +0800, JingPiao Chen wrote:
[...]
> +static bool
> +decode_rtnl_link_ifmap(struct tcb *const tcp,
> + const kernel_ulong_t addr,
> + const unsigned int len,
> + const void *const opaque_data)
> +{
> + struct rtnl_link_ifmap map;
> + unsigned int sizeof_ifmap = sizeof_struct_rtnl_link_ifmap();
> +
> + if (len < sizeof_ifmap)
> + return false;
This would be incompatible with the kernel that implements this differently,
see net/core/rtnetlink.c:rtnl_fill_link_ifmap
struct rtnl_link_ifmap map;
memset(&map, 0, sizeof(map));
...
if (nla_put_64bit(skb, IFLA_MAP, sizeof(map), &map, IFLA_PAD))
...
In other words, this should be something like
const unsigned int sizeof_ifmap = offsetofend(struct rtnl_link_ifmap map, port);
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20170818/f9560d3f/attachment.bin>
More information about the Strace-devel
mailing list