netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* virtio_net: MAC address releated breakage if there is no MAC area in config
@ 2009-04-02 11:33 Christian Borntraeger
  2009-04-02 16:06 ` Alex Williamson
  2009-04-05  3:41 ` Rusty Russell
  0 siblings, 2 replies; 6+ messages in thread
From: Christian Borntraeger @ 2009-04-02 11:33 UTC (permalink / raw)
  To: Alex Williamson; +Cc: Rusty Russell, netdev, kvm

Hello,

commit 9c46f6d42f1b5627c49a5906cb5b315ad8716ff0
Author: Alex Williamson <alex.williamson@hp.com>
Date:   Wed Feb 4 16:36:34 2009 -0800
virtio_net: Allow setting the MAC address of the NIC

Introduced an unconditional config->set to the MAC address field of
the device config.


+       } else {
                random_ether_addr(dev->dev_addr);
+               vdev->config->set(vdev, offsetof(struct virtio_net_config, mac),
+                                 dev->dev_addr, dev->addr_len);
+       }

Since our kuli userspace sample does not set VIRTIO_NET_F_MAC, there is no
config space assigned for this device. When virtio_net tries to overwrite
the non-existing field, this triggers a bug.

virtio_net.h specifies:
struct virtio_net_config
{
        /* The config defining mac address (if VIRTIO_NET_F_MAC) */
        __u8 mac[6];
[...]

I read this as the mac config field is optional (similar to all the optional
fields we added in virtio_blk later).

I see two options:
1. Change our sample userspace to always allocate the config (like lguest and
qemu)
2. Change the kernel code to not write into the config unless a specific feature
bit is set. (e.g. VIRTIO_NET_F_SETMAC)


Opinions?

PS: The same is true for virtnet_set_mac_address. it crashes as well

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-04-05 13:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-02 11:33 virtio_net: MAC address releated breakage if there is no MAC area in config Christian Borntraeger
2009-04-02 16:06 ` Alex Williamson
2009-04-02 17:23   ` Christian Borntraeger
2009-04-04 23:40     ` David Miller
2009-04-05 13:19       ` Rusty Russell
2009-04-05  3:41 ` Rusty Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).