DPDK patches and discussions
 help / color / mirror / Atom feed
* [Bug 1155] DPDK 22.07 RTE flow: Segmentation fault seen in i40e_flow_parse_fdir_filter() for raw item type
@ 2022-12-21  2:47 bugzilla
  0 siblings, 0 replies; only message in thread
From: bugzilla @ 2022-12-21  2:47 UTC (permalink / raw)
  To: dev

https://bugs.dpdk.org/show_bug.cgi?id=1155

            Bug ID: 1155
           Summary: DPDK 22.07 RTE flow: Segmentation fault seen in
                    i40e_flow_parse_fdir_filter() for raw item type
           Product: DPDK
           Version: 22.07
          Hardware: x86
                OS: Linux
            Status: UNCONFIRMED
          Severity: critical
          Priority: Normal
         Component: other
          Assignee: dev@dpdk.org
          Reporter: lthammin@usc.edu
  Target Milestone: ---

I am using a RTE_FLOW_ITEM_TYPE_RAW to match a flow with specific src-ip
address from IP header. With this, it is recommended to use pre-defined
rte_flow_item_raw_mask(default mask) as the mask.

/** Default mask for RTE_FLOW_ITEM_TYPE_RAW. */
#ifndef __cplusplus
static const struct rte_flow_item_raw rte_flow_item_raw_mask = {
        .relative = 1,
        .search = 1,
        .reserved = 0x3fffffff,
        .offset = 0xffffffff,
        .limit = 0xffff,
        .length = 0xffff,
        .pattern = NULL,
};
#endif

When I use this default mask and call rte_flow_validate(), I get a segmentation
fault. But, if I replace the NULL pattern by a non-NULL pointer having some
string then I don't see the segmentation fault (uncomment pattern[1].mask =
&raw_mask; in below code). 

Below are my api and gdb backtrace.

void
dpdk_flow_add_raw_type (dpdk_device_t * xd)
{
        /* create the attribute structure */
        struct rte_flow_attr attr = { .ingress = 1 };
        struct rte_flow_item pattern[3];
        struct rte_flow_action actions[2];
        struct rte_flow_item_raw raw_src_ip;
        struct rte_flow_item_raw raw_mask;
        uint8_t src_ip_str[5];
        uint8_t raw_mask_str[5];
        struct rte_flow_action_queue queue = { .index = 3 };
        struct rte_flow_error error;
        int rv;


        /* setting the eth to pass all packets */
        pattern[0].type = RTE_FLOW_ITEM_TYPE_ETH;
        pattern[0].spec = NULL;
        pattern[0].mask = NULL;
        pattern[0].last = NULL;

        /* Match src-ip 44.45.46.47 */
        src_ip_str[0] = 44;
        src_ip_str[1] = 45;
        src_ip_str[2] = 46;
        src_ip_str[3] = 47;
        src_ip_str[4] = '\0';

        /* Setting raw item mask's pattern to all 1s. Not sure if this is right
*/
        raw_mask_str[0] = 0xff;
        raw_mask_str[1] = 0xff;
        raw_mask_str[2] = 0xff;
        raw_mask_str[3] = 0xff;
        raw_mask_str[4] = '\0';

        /* Same as rte_flow_item_raw_mask (default raw mask) except that
pattern is non-NULL */
        raw_mask.relative = 1;
        raw_mask.search = 1;
        raw_mask.reserved = 0x3fffffff;
        raw_mask.offset = 0xffffffff;
        raw_mask.limit = 0xffff;
        raw_mask.length = 0xffff;
        //raw_mask.pattern = NULL,
        raw_mask.pattern = raw_mask_str;


        pattern[1].type = RTE_FLOW_ITEM_TYPE_RAW;

        raw_src_ip.relative = 1;
        raw_src_ip.search = 0;
        raw_src_ip.offset = 12; // src-ip in IP header starts after 12 bytes
        raw_src_ip.limit = 0;
        raw_src_ip.length = 4; // src-ip is 4 bytes long
        raw_src_ip.pattern = src_ip_str; // Match 44.45.46.47 of length 4 bytes
after 12 bytes

        pattern[1].spec = &raw_src_ip;

        pattern[1].mask = &rte_flow_item_raw_mask;
        //pattern[1].mask = &raw_mask;  // comment above line and un-comment
this. Then segmentation fault is not seen.

        pattern[1].last = NULL;

        pattern[2].type = RTE_FLOW_ITEM_TYPE_END;

        /* create the queue action */
        actions[0].type = RTE_FLOW_ACTION_TYPE_QUEUE;
        actions[0].conf = &queue;                                              
// redirect to queue 3
        actions[1].type = RTE_FLOW_ACTION_TYPE_END;


        /* validate and create the flow rule */
        if (!(rv = rte_flow_validate(xd->port_id, &attr, pattern, actions,
&error)))
                rte_flow_create(xd->port_id, &attr, pattern, actions, &error);

}





Thread 1 "vpp_main" received signal SIGSEGV, Segmentation fault.
0x00007fffb4c9b35b in i40e_flow_parse_fdir_filter () from
build-root/install-vpp_debug-native/vpp/lib/x86_64-linux-gnu/vpp_plugins/dpdk_plugin.so
(gdb) bt
#0  0x00007fffb4c9b35b in i40e_flow_parse_fdir_filter () from
build-root/install-vpp_debug-native/vpp/lib/x86_64-linux-gnu/vpp_plugins/dpdk_plugin.so
#1  0x00007fffb4c97c6e in i40e_flow_validate () from
build-root/install-vpp_debug-native/vpp/lib/x86_64-linux-gnu/vpp_plugins/dpdk_plugin.so
#2  0x00007fffb4aa50f2 in rte_flow_validate () from
build-root/install-vpp_debug-native/vpp/lib/x86_64-linux-gnu/vpp_plugins/dpdk_plugin.so
#3  0x00007fffb4fdab1e in dpdk_flow_add_raw_type (xd=0x7fffbda2b200) at 



Please check this out and let me know.

Thanks,
Nikhil

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-12-21  2:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-21  2:47 [Bug 1155] DPDK 22.07 RTE flow: Segmentation fault seen in i40e_flow_parse_fdir_filter() for raw item type bugzilla

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).