DPDK patches and discussions
 help / color / mirror / Atom feed
From: nan he <nhe295771@gmail.com>
To: dev@dpdk.org
Subject: [Bug Report] KNI Module Causes Loopback Interface to Have Incorrect ifindex in Linux 5.4.46
Date: Wed, 23 Apr 2025 13:52:39 +0800	[thread overview]
Message-ID: <CAFohB5uoG8Sx5LXiX8F8QihT=ov2yR5rzgbaVNeodmYedy5S5g@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2102 bytes --]

Dear DPDK Developers,

I am reporting an issue encountered in an environment running Linux kernel
version 5.4.46 with DPDK 19.11. When attempting to run Docker containers in
bridge mode, the container creation fails consistently. The kmsg indicate a
crash during the initialization of the loopback device within a new
*net_namespace*, specifically due to the loopback interface not being
assigned the expected ifindex of 1.

*Issue Description:*

During the creation of a  net_namespace, the kernel initializes network
devices in a specific order. It is expected that the loopback interface is
the first to be initialized, thereby receiving an ifindex of 1. This
assumption is enforced in the kernel code, where a BUG_ON check ensures
that the loopback interface has *ifindex == 1.* However, with the DPDK KNI
module loaded, this assumption fails, resulting in a kernel panic during
container creation.

*Root Cause Analysis:*

Upon investigation, it appears that the KNI module registers its network
operations using the *register_pernet_subsys()* function. This registration
method places the KNI initialization function before the loopback device's
initialization in *pernet_list*. Consequently, when a new * net_namespace*
is created, the KNI interface is initialized before the loopback interface,
causing the KNI interface to receive ifindex 1 and the loopback interface
to receive ifindex 2. This order violates the kernel's expectation and
triggers the BUG_ON check.

*Environment Details:*

   -

   DPDK Version: 19.11
   -

   Kernel Version: 5.4.46
   -

   Operating System:  Linux
   - Architecture: x86_64

*Reproduction Steps:*

   1.

   Load the DPDK KNI module.
   2.

   Use Docker to create a new container in bridge mode.
   3.

   Observe the kernel panic due to the loopback interface not having ifindex
   1.

*Additional Information:*

We would appreciate it if the DPDK development team could review this issue
and consider incorporating the proposed change into future releases. Please
let us know if further information or testing is required from our side.

Best regards,

[-- Attachment #2: Type: text/html, Size: 2919 bytes --]

                 reply	other threads:[~2025-05-05 12:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFohB5uoG8Sx5LXiX8F8QihT=ov2yR5rzgbaVNeodmYedy5S5g@mail.gmail.com' \
    --to=nhe295771@gmail.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).