Date: Tue, 3 Mar 2015 20:55:03 +0000 From: "sumith.devvojini@freescale.com" <sumith.devvojini@freescale.com> To: "rizzo@iet.unipi.it" <rizzo@iet.unipi.it>, "net@freebsd.org" <net@freebsd.org> Subject: Segmentation Fault When using Netmap with big endian Message-ID: <BN1PR03MB008D0E5B65B2A56C3045D4783110@BN1PR03MB008.namprd03.prod.outlook.com>
next in thread | raw e-mail | index | archive | help
Hello Luigi, I am a Software Engineer at Freescale semiconductor and I am currently work= ing on porting netmap to Freescale's integrated network controller ETSEC. I= came across the segmentation problem while testing my port with pkt-gen ap= plication provided as an example. This segmentation fault is due to the buf= fer pointer return to user space which is beyond the address space of the a= pplication. The reason for this I believe is line number 1351 in file netma= p_mem2.c *(uint16_t *)(uintptr_t)&ring->nr_buf_size =3D netmap_mem_bufsize(na->nm_mem); where nr_buf_size is a 32 bit integer but we are storing the buffer size wh= ile casting this variable to a 16 bit integer pointer. When userspace appli= cation requests the buffer address we read this variable as a 32 bit intege= r and apply that as the offset. Though this works on little endian systems because how they store the value= in memory, it breaks in big endian systems. The cast can be changed to 32 = bit integer pointer to make netmap more stable across different platforms. Thank you, Sumith Dev Vojini
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BN1PR03MB008D0E5B65B2A56C3045D4783110>