Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pfsend segmentation fault on ARM #39

Closed
mhthdeg opened this issue Sep 15, 2015 · 3 comments
Closed

pfsend segmentation fault on ARM #39

mhthdeg opened this issue Sep 15, 2015 · 3 comments
Assignees
Labels

Comments

@mhthdeg
Copy link

mhthdeg commented Sep 15, 2015

Hello,

I am running an ARM board (DE1-SoC) and compiled PF_RING in version 6.0.3 on it. While compiling the ../userland/examples I got error messages such as "undefined reference to `pfring_recv' ". I could solve that by editing the Makefile and change this line
LIBS = ${LIBPCAP} ${LIBPFRING} ${LIBPCAP} -lpthread -lrt -lrt
to
LIBS = ${LIBPCAP} ${LIBPFRING} ${LIBPCAP} -lpthread -lpfring -lrt.

Now I receive the following errors (shown below) while compiling. The problem is the static inline ticks getticks(void) function of pfutils.c. I know this function is specified for x68_64 and amd64 architectures but is there also an ARM implementation that you know of? I like to use the pfsend program but if I comment "asm volatile ("rdtsc" : "=a"(lo), "=d"(hi));" out I receive a segmentation fault while running the compiled pfsend. I also found some piece of code that I implemented that doesn`t result in any error but pfsend also shows the segmentation fault.

Has someone an answer to get pfsend working?

static inline ticks getticks(void)
{
u_int32_t r = 0;
asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r"(r) );
return r;
}

./pfsend -i eth0 -n 0

[ 1584.745357] 7fc0: 000762e0 00000014 00008134 00000122 0006d37c 0006d4c8 00000000 0006dc60
[ 1584.753500] 7fe0: bebf6690 bebf6684 0002a8e3 b6f372dc 400d0030 00000003 00000000 00000000
[ 1584.761660] [](ring_sendmsg [pf_ring]) from
[ 1584.770072] from
[ 1584.777448] from
[ 1584.785074] Code: e24cb004 e52de004 e8bd4000 e1a06002 (e5922000)
[ 1584.791188] ---[ end trace 842d2bdb38ad7866 ]---
Segmentation fault

In file included from pfsend.c:44:0:
pfsend.c: In function ‘main’:
pfutils.c:266:3: error: impossible constraint in ‘asm’
asm volatile ("rdtsc" : "=a"(lo), "=d"(hi));
^
pfutils.c:266:3: error: impossible constraint in ‘asm’
asm volatile ("rdtsc" : "=a"(lo), "=d"(hi));
^
pfutils.c:266:3: error: impossible constraint in ‘asm’
asm volatile ("rdtsc" : "=a"(lo), "=d"(hi));
^
pfutils.c:266:3: error: impossible constraint in ‘asm’
asm volatile ("rdtsc" : "=a"(lo), "=d"(hi));
^
pfutils.c:266:3: error: impossible constraint in ‘asm’
asm volatile ("rdtsc" : "=a"(lo), "=d"(hi));
^
pfutils.c:266:3: error: impossible constraint in ‘asm’
asm volatile ("rdtsc" : "=a"(lo), "=d"(hi));
^
pfutils.c:266:3: error: impossible constraint in ‘asm’
asm volatile ("rdtsc" : "=a"(lo), "=d"(hi));
^
pfutils.c:266:3: error: impossible constraint in ‘asm’
asm volatile ("rdtsc" : "=a"(lo), "=d"(hi));
^
Makefile:54: recipe for target 'pfsend.o' failed
make: *** [pfsend.o] Error 1

@cardigliano
Copy link
Member

Hi
this has been fixed some time ago on github, please git clone the code from there and let us know.

Alfredo

On 15 Sep 2015, at 14:59, mhthdeg notifications@github.com wrote:

Hello,

I am running an ARM board (DE1-SoC) and compiled PF_RING in version 6.0.3 on it. While compiling the ../userland/examples I got error messages such as "undefined reference to `pfring_recv' ". I could solve that by editing the Makefile and change this line
LIBS = ${LIBPCAP} ${LIBPFRING} ${LIBPCAP} -lpthread -lrt -lrt
to
LIBS = ${LIBPCAP} ${LIBPFRING} ${LIBPCAP} -lpthread -lpfring -lrt.

Now I receive the following errors (shown below) while compiling. The problem is the static inline ticks getticks(void) function of pfutils.c. I know this function is specified for x68_64 and amd64 architectures but is there also an ARM implementation that you know of? I like to use the pfsend program but if I comment "asm volatile ("rdtsc" : "=a"(lo), "=d"(hi));" out I receive a segmentation fault while running the compiled pfsend. I also found some piece of code that I implemented that doesn`t result in any error but pfsend also shows the segmentation fault.

Has someone an answer to get pfsend working?

static inline ticks getticks(void)
{

u_int32_t r = 0;
asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r"(r) );
return r;
}

./pfsend -i eth0 -n 0

[ 1584.745357] 7fc0: 000762e0 00000014 00008134 00000122 0006d37c 0006d4c8 00000000 0006dc60
[ 1584.753500] 7fe0: bebf6690 bebf6684 0002a8e3 b6f372dc 400d0030 00000003 00000000 00000000
[ 1584.761660] x-msg://221/ring_sendmsg%20%5Bpf_ring%5Dfrom x-msg://221/sock_sendmsg+0x24/0x34
[ 1584.770072] x-msg://221/sock_sendmsgfrom x-msg://221/SyS_sendto+0xc8/0xf0
[ 1584.777448] x-msg://221/SyS_sendtofrom x-msg://221/ret_fast_syscall+0x0/0x3c
[ 1584.785074] Code: e24cb004 e52de004 e8bd4000 e1a06002 (e5922000)
[ 1584.791188] ---[ end trace 842d2bdb38ad7866 ]---
Segmentation fault

In file included from pfsend.c:44:0:
pfsend.c: In function ‘main’:
pfutils.c:266:3: error: impossible constraint in ‘asm’
asm volatile ("rdtsc" : "=a"(lo), "=d"(hi));
^
pfutils.c:266:3: error: impossible constraint in ‘asm’
asm volatile ("rdtsc" : "=a"(lo), "=d"(hi));
^
pfutils.c:266:3: error: impossible constraint in ‘asm’
asm volatile ("rdtsc" : "=a"(lo), "=d"(hi));
^
pfutils.c:266:3: error: impossible constraint in ‘asm’
asm volatile ("rdtsc" : "=a"(lo), "=d"(hi));
^
pfutils.c:266:3: error: impossible constraint in ‘asm’
asm volatile ("rdtsc" : "=a"(lo), "=d"(hi));
^
pfutils.c:266:3: error: impossible constraint in ‘asm’
asm volatile ("rdtsc" : "=a"(lo), "=d"(hi));
^
pfutils.c:266:3: error: impossible constraint in ‘asm’
asm volatile ("rdtsc" : "=a"(lo), "=d"(hi));
^
pfutils.c:266:3: error: impossible constraint in ‘asm’
asm volatile ("rdtsc" : "=a"(lo), "=d"(hi));
^
Makefile:54: recipe for target 'pfsend.o' failed
make: *** [pfsend.o] Error 1


Reply to this email directly or view it on GitHub #39.

@mhthdeg
Copy link
Author

mhthdeg commented Sep 18, 2015

Hi,
thank you for your response. I git cloned the code and compiled it and no error occured. Thanks for that. Unfortunately I still get an error while using an example program that sends via pf_ring. I tried the pfbridge example to forward the packets from eth0 to eth1 and the pfsend example on interface eth0 and still get the following error messages:

pfbridge program


0 pps
0 pps
0 pps
[ 1223.791080] Unable to handle kernel NULL pointer dereference at virtual address 0000003c
[ 1223.799254] pgd = e380c000
[ 1223.801990] [0000003c] *pgd=22ea6831, *pte=00000000, *ppte=00000000
[ 1223.808273] Internal error: Oops: 17 [#2] SMP ARM
[ 1223.812957] Modules linked in: pf_ring(O)
[ 1223.816979] CPU: 0 PID: 5245 Comm: pfbridge Tainted: G D O 4.1.0-00150-g60fd5d4 #1
[ 1223.825464] Hardware name: Altera SOCFPGA
[ 1223.829457] task: eeed5300 ti: eee8a000 task.ti: eee8a000
[ 1223.834847] PC is at ring_sendmsg+0x18/0x2e0 [pf_ring]
[ 1223.839969] LR is at sock_sendmsg+0x24/0x34
[ 1223.844136] pc : [] lr : [] psr: 400d0013
[ 1223.844136] sp : eee8be80 ip : eee8beb0 fp : eee8beac
[ 1223.855561] r10: 00000000 r9 : eee8a000 r8 : c000fc24
[ 1223.860763] r7 : 00000122 r6 : 0000003c r5 : 00000000 r4 : 00000000
[ 1223.867260] r3 : bf003f04 r2 : 0000003c r1 : eee8bedc r0 : eebed680
[ 1223.873759] Flags: nZcv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
[ 1223.880861] Control: 10c5387d Table: 2380c04a DAC: 00000015
[ 1223.886582] Process pfbridge (pid: 5245, stack limit = 0xeee8a218)
[ 1223.892733] Stack: (0xeee8be80 to 0xeee8c000)
[ 1223.897075] be80: bf003f04 00000000 00000000 eebed680 00000122 c000fc24 eee8a000 00000000
[ 1223.905219] bea0: eee8bebc eee8beb0 c0450f40 bf003f10 eee8bfa4 eee8bec0 c0452378 c0450f28
[ 1223.913361] bec0: eee8bee4 00000800 00000000 00000000 00000000 b67a90b8 0000003c eee8bf08
[ 1223.921503] bee0: 00000014 00000001 00000000 0000003c eee8bed4 00000001 00000000 00000000
[ 1223.929646] bf00: 00000000 c012f170 03000011 00000000 00000000 00000000 00000000 eee8bf48
[ 1223.937788] bf20: c000fc24 eee8a000 eee8bf7c eee8bf40 c012f170 c0075d6c c012f144 c007ea18
[ 1223.945931] bf40: 1dcd6500 c000ab20 000004c7 36efb7d6 00000000 00000001 beb0ea64 0000001c
[ 1223.954072] bf60: 00000020 c000fc24 eee8a000 00000000 eee8bfa4 eee8bf80 c01304d8 c012ff70
[ 1223.962214] bf80: 000004c7 36efb7d6 0006b480 0007c604 00000014 00008144 00000000 eee8bfa8
[ 1223.970357] bfa0: c000fa80 c04522bc 0007c604 00000014 00000004 b67a90b8 0000003c 00000000
[ 1223.978501] bfc0: 0007c604 00000014 00008144 00000122 0007c5a2 00000000 b6f95000 00000000
[ 1223.986644] bfe0: beb0eac0 beb0eab4 0001514b b6f652dc 400d0030 00000004 00000000 00000000
[ 1223.994804] [](ring_sendmsg [pf_ring]) from
[ 1224.003213] from
[ 1224.010588] from
[ 1224.018215] Code: e24cb004 e52de004 e8bd4000 e1a06002 (e5922000)
[ 1224.024330] ---[ end trace 68df3e84878b5372 ]---
Segmentation fault


pfsend program


root@linaro-nano:~/PF_RING/userland/examples# ./pfsend -i eth0
Sending packets on eth0
Using PF_RING v.6.0.3
[ 1309.781569] Unable to handle kernel NULL pointer dereference at virtual address 0000003c
NOT using zero-copy: not supported by this driver
Dumping statistics on /proc/net/pf_ring/stats/5253-eth0.7
[ 1309.791398] pgd = e380c000
[ 1309.803580] [0000003c] *pgd=2348c831, *pte=00000000, *ppte=00000000
[ 1309.809873] Internal error: Oops: 17 [#3] SMP ARM
[ 1309.814556] Modules linked in: pf_ring(O)
[ 1309.818578] CPU: 1 PID: 5253 Comm: pfsend Tainted: G D O 4.1.0-00150-g60fd5d4 #1
[ 1309.826889] Hardware name: Altera SOCFPGA
[ 1309.830882] task: eeed7440 ti: e39f8000 task.ti: e39f8000
[ 1309.836274] PC is at ring_sendmsg+0x18/0x2e0 [pf_ring]
[ 1309.841396] LR is at sock_sendmsg+0x24/0x34
[ 1309.845562] pc : [] lr : [] psr: 400d0013
[ 1309.845562] sp : e39f9e80 ip : e39f9eb0 fp : e39f9eac
[ 1309.856986] r10: 00000000 r9 : e39f8000 r8 : c000fc24
[ 1309.862187] r7 : 00000122 r6 : 0000003c r5 : 00000000 r4 : 00000000
[ 1309.868684] r3 : bf003f04 r2 : 0000003c r1 : e39f9edc r0 : eebed980
[ 1309.875182] Flags: nZcv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
[ 1309.882285] Control: 10c5387d Table: 2380c04a DAC: 00000015
[ 1309.888005] Process pfsend (pid: 5253, stack limit = 0xe39f8218)
[ 1309.893984] Stack: (0xe39f9e80 to 0xe39fa000)
[ 1309.898326] 9e80: bf003f04 00000000 00000000 eebed980 00000122 c000fc24 e39f8000 00000000
[ 1309.906469] 9ea0: e39f9ebc e39f9eb0 c0450f40 bf003f10 e39f9fa4 e39f9ec0 c0452378 c0450f28
[ 1309.914613] 9ec0: e39f9ee4 c000fc24 e39f8000 00000000 00000000 00076350 0000003c e39f9f08
[ 1309.922755] 9ee0: 00000014 00000001 00000000 0000003c e39f9ed4 00000001 00000000 00000000
[ 1309.930897] 9f00: 00000000 eed26308 03000011 00000000 00000000 00000000 00000000 00000000
[ 1309.939040] 9f20: 00000000 eee973c0 0000003a eed26308 00000002 eee973c8 e39f8000 00000000
[ 1309.947182] 9f40: e39f9f7c e39f9f50 c011c728 c015a31c 00000000 00000000 e39f9f7c eee973c0
[ 1309.955325] 9f60: eee973c0 beb61178 0000003a c000fc24 e39f9fa4 e39f9f80 c011cf48 c011c610
[ 1309.963467] 9f80: 00000000 00000000 0000003a 000762fc 00000014 00008144 00000000 e39f9fa8
[ 1309.971610] 9fa0: c000fa80 c04522bc 000762fc 00000014 00000003 00076350 0000003c 00000000
[ 1309.979752] 9fc0: 000762fc 00000014 00008144 00000122 0006d4c8 00000000 0006dc60 00000000
[ 1309.987895] 9fe0: beb636d0 beb636c4 0002a783 b6fa02dc 400d0030 00000003 00000000 00000000
[ 1309.996053] [](ring_sendmsg [pf_ring]) from
[ 1310.004462] from
[ 1310.011838] from
[ 1310.019464] Code: e24cb004 e52de004 e8bd4000 e1a06002 (e5922000)
[ 1310.025567] ---[ end trace 68df3e84878b5373 ]---
Segmentation fault


Has anyone an idea how to fix this issue?

@cardigliano
Copy link
Member

Latest dev pfsend seems to be working on ARM, if you are still able to reproduce this please reopen the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants