[P4] SOS - segfault Encap + Decap

Sándor Laki lakis at elte.hu
Wed May 30 23:34:06 CEST 2018


Hi,

decapsulation segfaultot dob - a lenti első memcpy sornál kapjuk:

void action_code_gtp_decapsulate_0(packet_descriptor_t* pd, 
lookup_table_t** tables) { // actions at 41
     uint32_t value32, res32, mask32; // actions at 42
     (void)value32; (void)res32; (void)mask32; // actions at 43
     control_locals_MyIngress_t* control_locals = 
(control_locals_MyIngress_t*) pd->control_locals; // actions at 44
// TODO make it work properly for non-byte-aligned fields // codegen at 256
memcpy(pd->headers[header_instance_ipv4].pointer, 
pd->headers[header_instance_inner_ipv4].pointer, 
(field_instance_bit_width[header_instance_ipv4]+7)/8); // codegen at 257

a debugger alapján:

#0  0x00000000004389e8 in memcpy (__len=6, __src=0x0, __dest=0x7fffda81410e)
     at /usr/include/x86_64-linux-gnu/bits/string3.h:53
#1  action_code_gtp_decapsulate_0 (pd=pd at entry=0x7fffffffdcd0,
     tables=tables at entry=0x858580 <lcore_conf+9600>)
     at 
/home/p4/demo/t4p4s-16/build/vsmgw-no-typedef//../src_hardware_indep/actions.c:93
#2  0x000000000043859b in ue_selector_apply (
     tables=0x858580 <lcore_conf+9600>, pd=0x7fffffffdcd0)
     at 
/home/p4/demo/t4p4s-16/build/vsmgw-no-typedef//../src_hardware_indep/dataplane.c:67


Encapsulation hasonlan segfaultol, de itt a udp fejléces memcpy 
csinálja. Ez lehet, hogy kiküszöbölhető pl. az inner_udp eltűntetésével.

void action_code_gtp_encapsulate_0(packet_descriptor_t* pd, 
lookup_table_t** tables, struct action_gtp_encapsulate_0_params 
parameters) { // actions at 41
     uint32_t value32, res32, mask32; // actions at 42
     (void)value32; (void)res32; (void)mask32; // actions at 43
     control_locals_MyIngress_t* control_locals = 
(control_locals_MyIngress_t*) pd->control_locals; // actions at 44
// setValid called on <Member>[#-2433][expr, header_ref, member, type] 
// codegen at 305
debug("Setting header instance inner_ipv4 as valid"); // codegen at 331
pd->headers[header_instance_inner_ipv4].pointer = 
(pd->header_tmp_storage + 
header_instance_byte_width_summed[header_instance_inner_ipv4]); // 
codegen at 332
// TODO initialise header instance contents? // codegen at 333
// TODO make it work properly for non-byte-aligned fields // codegen at 256
memcpy(pd->headers[header_instance_inner_ipv4].pointer, 
pd->headers[header_instance_ipv4].pointer, 
(field_instance_bit_width[header_instance_inner_ipv4]+7)/8); // codegen at 257
// TODO make it work properly for non-byte-aligned fields // codegen at 256
memcpy(pd->headers[header_instance_inner_udp].pointer, 
pd->headers[header_instance_udp].pointer, 
(field_instance_bit_width[header_instance_inner_udp]+7)/8);

debugger:

Thread 1 "vsmgw-no-typede" received signal SIGSEGV, Segmentation fault.
action_code_gtp_encapsulate_0 (pd=pd at entry=0x7fffffffdcd0,
     tables=tables at entry=0x858580 <lcore_conf+9600>, parameters=...)
     at 
/home/p4/demo/t4p4s-16/build/vsmgw-no-typedef//../src_hardware_indep/actions.c:38
38      memcpy(pd->headers[header_instance_inner_udp].pointer, 
pd->headers[header_instance_udp].pointer, 
(field_instance_bit_width[header_instance_inner_udp]+7)/8); // codegen at 257
(gdb) bt
#0  action_code_gtp_encapsulate_0 (pd=pd at entry=0x7fffffffdcd0,
     tables=tables at entry=0x858580 <lcore_conf+9600>, parameters=...)
     at 
/home/p4/demo/t4p4s-16/build/vsmgw-no-typedef//../src_hardware_indep/actions.c:38

Üdv.
Sanyi

-- 
Sándor Laki, PhD
Assistant professor
Department of Information Systems
Eötvös Loránd University
Pázmány Péter stny. 1/C
H-1117, Budapest, Hungary
Room 2.506
Web: http://lakis.web.elte.hu
Phone: +36 1 372 2869 / 8477
Cell: +36 70 374 2646


---
Ezt az e-mailt az Avast víruskereső szoftver átvizsgálta.
https://www.avast.com/antivirus



More information about the P4 mailing list