From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <3chas3@gmail.com> Received: from mail-qt1-f193.google.com (mail-qt1-f193.google.com [209.85.160.193]) by dpdk.org (Postfix) with ESMTP id 97DDC10A3; Sun, 24 Mar 2019 18:24:02 +0100 (CET) Received: by mail-qt1-f193.google.com with SMTP id h39so7844888qte.2; Sun, 24 Mar 2019 10:24:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=IGp3xnh7MjJOipLPPKaDupBm1ajr/3SIDUzkKjX5gVo=; b=MyM0TnizsQLKHGtbzt9PFNg4XSc3szyQdIZGnY+7d1i+iJtkWvLWM0RRWZuPhIgxdC ZeOFU/rn8vPTBI+3K4gqXN9l71LvXhbtTz3spmbj93z4i/9yN8jcqZuuibRkm2DTBQLU HmN0chmMPcgy2mb0FXpb91JbJwbjUVp9hOmd+S6zl+nBSM5BQ0v5BY/PlFdeHKgb1eej y2BglqYmJ1nsDvzTctts10XihqrJwMZ5auap3E+WGBy6yJv/7yx33dXZTinoeJ+2Ynmk P1Zfc5YXWDzxOsS28Yj/mj6jz7jhXS45PG3lwKlLUkPYMTwqBwRg+LT0wh46s7XR+MfJ F3PA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=IGp3xnh7MjJOipLPPKaDupBm1ajr/3SIDUzkKjX5gVo=; b=RxxM9J6ONgR4gNSoOUFKIgF6rOMmcpSpFs8dSeq0CAEsRWdXHK6hXGqUKxc/Jp7cjO 5Tt0dTXNTCiw9OUA7Qjqw8j9Byzb64uA/ZMQn2vTzr5d8QrzuEfO5TuEBgiZ3WnP3dBK g4h7PFwifDUdDlqMeGAXtpqiPzSPnDmZ3zVPT/np5FESgDktSEtQvydiZ3vSGVCKJ0Cy 5OzSNGqjqFURdqoUvUe8KaPBNaVPurbZEWf0GNGZ6IpD9crCIcHQccUBrg1pnIjMpX3Z 5yh7bKuZWgpWr8la0uUDsdjjVaGrkJtDcxeYtD+4MogiVvy4nWn8S9HjBsaJCqhll6Hb OXxA== X-Gm-Message-State: APjAAAWI2jq9nzieBvFlguqsUrtQh3CsyQOAda93wCMKOQucB6mCrWOb wUFtwonS/GJdoXWaJj9vRM/xpGUv X-Google-Smtp-Source: APXvYqxhNGXARSEpu0CnN43HQvapJXRDxdiQ99GGwOgbnw217P/pIYVo2DXbBajA1yinnaKEWAWqMw== X-Received: by 2002:a0c:d2fc:: with SMTP id x57mr15618935qvh.214.1553448241692; Sun, 24 Mar 2019 10:24:01 -0700 (PDT) Received: from [192.168.1.10] (pool-96-255-82-34.washdc.fios.verizon.net. [96.255.82.34]) by smtp.gmail.com with ESMTPSA id r15sm9675499qtb.22.2019.03.24.10.24.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 24 Mar 2019 10:24:00 -0700 (PDT) To: David Marchand Cc: dev , "Yigit, Ferruh" , chas3@att.com, "Zhaohui (zhaohui, Polestar)" , dpdk stable References: <1553200094-5487-1-git-send-email-david.marchand@redhat.com> <1553200094-5487-2-git-send-email-david.marchand@redhat.com> <615b76a3-ea73-19b7-c1b2-9ee1862473a6@gmail.com> From: Chas Williams <3chas3@gmail.com> Message-ID: <8eb07dc9-0640-66bd-22aa-e8518d449e97@gmail.com> Date: Sun, 24 Mar 2019 13:24:00 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH 2/2] net/bonding: fix oob access in "other" aggregator modes X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Mar 2019 17:24:02 -0000 On 3/24/19 1:11 PM, David Marchand wrote: > On Sun, Mar 24, 2019 at 2:35 PM Chas Williams <3chas3@gmail.com > > wrote: > > Have you ever experienced this problem in practice? I ask because I am > considering some fixes that would limit the number of slaves to a more > reasonable number (and reduce the over stack usage of the bonding > driver > in general). > > > Not too hard to reproduce, the problem is not the number of slaves. > With a default RTE_MAX_ETHPORTS at 32, any slave whose portid >= 8 would > trigger an oob access. Err... Well I have a lot of questions then about this whole thing. What is max_index() doing? mode_count_id = max_index(agg_count, slaves_count); It's indexing up to slaves_count, which is likely to be somewhere around 2. agg_count() is indexed by the port id. It's likely agg_count was intended to be indexed by the slave index and not the port id. > > > Example: > # git describe > v19.02-294-gad2f555 > > # gdb ./master/app/testpmd > (gdb) b selection_logic > (gdb) run -c 0x3 --no-pci --vdev net_ring0 --vdev net_ring1 --vdev > net_ring2 --vdev net_ring3 --vdev net_ring4 --vdev net_ring5 --vdev > net_ring6 --vdev net_ring7 --vdev net_ring8 --vdev net_ring9 --vdev > net_bonding0,mode=4,slave=8,slave=9 -- -i --total-num-mbufs 2048 > > Breakpoint 1, selection_logic (internals=0x17fe51980, slave_id=8) at > /root/dpdk/drivers/net/bonding/rte_eth_bond_8023ad.c:670 > 670        uint16_t slaves_count, new_agg_id, i, j = 0; > Missing separate debuginfos, use: debuginfo-install > glibc-2.17-260.el7_6.3.x86_64 libgcc-4.8.5-36.el7.x86_64 > numactl-libs-2.0.9-7.el7.x86_64 > (gdb) n > 672        uint64_t agg_bandwidth[8] = {0}; > (gdb) > 673        uint64_t agg_count[8] = {0}; > (gdb) > 674        uint16_t default_slave = 0; > (gdb) p agg_bandwidth > $1 = {0, 0, 0, 0, 0, 0, 0, 0} > (gdb) p agg_count > $2 = {0, 0, 0, 0, 0, 0, 0, 0} > (gdb) n > 678        slaves = internals->active_slaves; > (gdb) > 679        slaves_count = internals->active_slave_count; > (gdb) > 680        port = &bond_mode_8023ad_ports[slave_id]; > (gdb) > 683        for (i = 0; i < slaves_count; ++i) { > (gdb) > 684            agg = &bond_mode_8023ad_ports[slaves[i]]; > (gdb) > 686            if (agg->aggregator_port_id != slaves[i]) > (gdb) > 689            agg_count[agg->aggregator_port_id] += 1; > (gdb) > 690            rte_eth_link_get_nowait(slaves[i], &link_info); > (gdb) p agg_bandwidth > $3 = {1, 0, 0, 0, 0, 0, 0, 0} > (gdb) p agg_count > $4 = {0, 0, 0, 0, 0, 0, 0, 0} > > > -- > David Marchand From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 935CBA05D3 for ; Sun, 24 Mar 2019 18:24:04 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6865929AC; Sun, 24 Mar 2019 18:24:03 +0100 (CET) Received: from mail-qt1-f193.google.com (mail-qt1-f193.google.com [209.85.160.193]) by dpdk.org (Postfix) with ESMTP id 97DDC10A3; Sun, 24 Mar 2019 18:24:02 +0100 (CET) Received: by mail-qt1-f193.google.com with SMTP id h39so7844888qte.2; Sun, 24 Mar 2019 10:24:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=IGp3xnh7MjJOipLPPKaDupBm1ajr/3SIDUzkKjX5gVo=; b=MyM0TnizsQLKHGtbzt9PFNg4XSc3szyQdIZGnY+7d1i+iJtkWvLWM0RRWZuPhIgxdC ZeOFU/rn8vPTBI+3K4gqXN9l71LvXhbtTz3spmbj93z4i/9yN8jcqZuuibRkm2DTBQLU HmN0chmMPcgy2mb0FXpb91JbJwbjUVp9hOmd+S6zl+nBSM5BQ0v5BY/PlFdeHKgb1eej y2BglqYmJ1nsDvzTctts10XihqrJwMZ5auap3E+WGBy6yJv/7yx33dXZTinoeJ+2Ynmk P1Zfc5YXWDzxOsS28Yj/mj6jz7jhXS45PG3lwKlLUkPYMTwqBwRg+LT0wh46s7XR+MfJ F3PA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=IGp3xnh7MjJOipLPPKaDupBm1ajr/3SIDUzkKjX5gVo=; b=RxxM9J6ONgR4gNSoOUFKIgF6rOMmcpSpFs8dSeq0CAEsRWdXHK6hXGqUKxc/Jp7cjO 5Tt0dTXNTCiw9OUA7Qjqw8j9Byzb64uA/ZMQn2vTzr5d8QrzuEfO5TuEBgiZ3WnP3dBK g4h7PFwifDUdDlqMeGAXtpqiPzSPnDmZ3zVPT/np5FESgDktSEtQvydiZ3vSGVCKJ0Cy 5OzSNGqjqFURdqoUvUe8KaPBNaVPurbZEWf0GNGZ6IpD9crCIcHQccUBrg1pnIjMpX3Z 5yh7bKuZWgpWr8la0uUDsdjjVaGrkJtDcxeYtD+4MogiVvy4nWn8S9HjBsaJCqhll6Hb OXxA== X-Gm-Message-State: APjAAAWI2jq9nzieBvFlguqsUrtQh3CsyQOAda93wCMKOQucB6mCrWOb wUFtwonS/GJdoXWaJj9vRM/xpGUv X-Google-Smtp-Source: APXvYqxhNGXARSEpu0CnN43HQvapJXRDxdiQ99GGwOgbnw217P/pIYVo2DXbBajA1yinnaKEWAWqMw== X-Received: by 2002:a0c:d2fc:: with SMTP id x57mr15618935qvh.214.1553448241692; Sun, 24 Mar 2019 10:24:01 -0700 (PDT) Received: from [192.168.1.10] (pool-96-255-82-34.washdc.fios.verizon.net. [96.255.82.34]) by smtp.gmail.com with ESMTPSA id r15sm9675499qtb.22.2019.03.24.10.24.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 24 Mar 2019 10:24:00 -0700 (PDT) To: David Marchand Cc: dev , "Yigit, Ferruh" , chas3@att.com, "Zhaohui (zhaohui, Polestar)" , dpdk stable References: <1553200094-5487-1-git-send-email-david.marchand@redhat.com> <1553200094-5487-2-git-send-email-david.marchand@redhat.com> <615b76a3-ea73-19b7-c1b2-9ee1862473a6@gmail.com> From: Chas Williams <3chas3@gmail.com> Message-ID: <8eb07dc9-0640-66bd-22aa-e8518d449e97@gmail.com> Date: Sun, 24 Mar 2019 13:24:00 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format="flowed" Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH 2/2] net/bonding: fix oob access in "other" aggregator modes X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190324172400.xHfshH0vtlbBMFrp8Bs5AQ7FvQq0b_jKuKwyjZHiqrw@z> On 3/24/19 1:11 PM, David Marchand wrote: > On Sun, Mar 24, 2019 at 2:35 PM Chas Williams <3chas3@gmail.com > > wrote: > > Have you ever experienced this problem in practice? I ask because I am > considering some fixes that would limit the number of slaves to a more > reasonable number (and reduce the over stack usage of the bonding > driver > in general). > > > Not too hard to reproduce, the problem is not the number of slaves. > With a default RTE_MAX_ETHPORTS at 32, any slave whose portid >= 8 would > trigger an oob access. Err... Well I have a lot of questions then about this whole thing. What is max_index() doing? mode_count_id = max_index(agg_count, slaves_count); It's indexing up to slaves_count, which is likely to be somewhere around 2. agg_count() is indexed by the port id. It's likely agg_count was intended to be indexed by the slave index and not the port id. > > > Example: > # git describe > v19.02-294-gad2f555 > > # gdb ./master/app/testpmd > (gdb) b selection_logic > (gdb) run -c 0x3 --no-pci --vdev net_ring0 --vdev net_ring1 --vdev > net_ring2 --vdev net_ring3 --vdev net_ring4 --vdev net_ring5 --vdev > net_ring6 --vdev net_ring7 --vdev net_ring8 --vdev net_ring9 --vdev > net_bonding0,mode=4,slave=8,slave=9 -- -i --total-num-mbufs 2048 > > Breakpoint 1, selection_logic (internals=0x17fe51980, slave_id=8) at > /root/dpdk/drivers/net/bonding/rte_eth_bond_8023ad.c:670 > 670        uint16_t slaves_count, new_agg_id, i, j = 0; > Missing separate debuginfos, use: debuginfo-install > glibc-2.17-260.el7_6.3.x86_64 libgcc-4.8.5-36.el7.x86_64 > numactl-libs-2.0.9-7.el7.x86_64 > (gdb) n > 672        uint64_t agg_bandwidth[8] = {0}; > (gdb) > 673        uint64_t agg_count[8] = {0}; > (gdb) > 674        uint16_t default_slave = 0; > (gdb) p agg_bandwidth > $1 = {0, 0, 0, 0, 0, 0, 0, 0} > (gdb) p agg_count > $2 = {0, 0, 0, 0, 0, 0, 0, 0} > (gdb) n > 678        slaves = internals->active_slaves; > (gdb) > 679        slaves_count = internals->active_slave_count; > (gdb) > 680        port = &bond_mode_8023ad_ports[slave_id]; > (gdb) > 683        for (i = 0; i < slaves_count; ++i) { > (gdb) > 684            agg = &bond_mode_8023ad_ports[slaves[i]]; > (gdb) > 686            if (agg->aggregator_port_id != slaves[i]) > (gdb) > 689            agg_count[agg->aggregator_port_id] += 1; > (gdb) > 690            rte_eth_link_get_nowait(slaves[i], &link_info); > (gdb) p agg_bandwidth > $3 = {1, 0, 0, 0, 0, 0, 0, 0} > (gdb) p agg_count > $4 = {0, 0, 0, 0, 0, 0, 0, 0} > > > -- > David Marchand