mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ivan Abramov <i.abramov@mt-integration.ru>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Kuniyuki Iwashima <kuniyu@amazon.com>,
	<aleksander.lobakin@intel.com>, <davem@davemloft.net>,
	<edumazet@google.com>, <horms@kernel.org>, <jdamato@fastly.com>,
	<kuba@kernel.org>, <leitao@debian.org>,
	<linux-kernel@vger.kernel.org>, <lvc-project@linuxtesting.org>,
	<netdev@vger.kernel.org>, <pabeni@redhat.com>,
	<syzbot+1df6ffa7a6274ae264db@syzkaller.appspotmail.com>
Subject: Re: [PATCH] net: Avoid calling WARN_ON() on -ENOMEM in __dev_change_net_namespace()
Date: Mon, 31 Mar 2025 12:17:07 +0300	[thread overview]
Message-ID: <20250331121707.5fcc75e026c2f3d0233abcd5@mt-integration.ru> (raw)
In-Reply-To: <875xjtb5o9.fsf@email.froward.int.ebiederm.org>

On Fri, 28 Mar 2025 09:17:42 -0500, Eric W. Biederman wrote:
> Kuniyuki Iwashima <kuniyu@amazon.com> writes:

>>> Subject: [PATCH] net: Avoid calling WARN_ON() on -ENOMEM in __dev_change_net_namespace()
>>
>> s/__dev_change_net_namespace/netif_change_net_namespace/
>>
>> Also, please specify the target tree: [PATCH v2 net]
>>
>>
>> From: Ivan Abramov <i.abramov@mt-integration.ru>
>> Date: Fri, 28 Mar 2025 04:12:57 +0300
>>> It's pointless to call WARN_ON() in case of an allocation failure in
>>> device_rename(), since it only leads to useless splats caused by deliberate
>>> fault injections, so avoid it.

> No.  It is not pointless.  The WARN_ON is there because the code can not
> rollback if device_rename fails in
> __dev_change_net_namespace/netif_change_net_namespace.

It's pointless in the sense that failure to allocate a few hundred bytes is
practically impossible and can only happen due to deliberate fault
injection during testing/fuzzing. The proposition is to avoid just that,
not to remove WARN_ON() altogether.

> If device_rename fails it means that the kernel's device tree
> are inconsistent with the actual network devices.

> If anything we need a way to guarantee that the device_rename will
> succeed, so that all of the parts that may fail may be performed
> before we commit ourselves by notifying userspace that the device
> is being renamed.
 
> As for Breno Leitao <leitao@debian.org>'s question should we fail
> immediately.  That will put us in a far worse state.

> As I recall the WARN_ON exists there because someone at the last minute
> stuffed network devices into sysfs, and no one has taken the time to
> handle the practically impossible case of a device_rename failure.

> If you are going to do something with this logic please figure out how
> to handle a failure instead just shutting up the error message that
> let's you know something bad is wrong in the kernel.

Although the issue of properly handling failure of device_rename deserves
a good thought and another patch/series, it's a much bigger problem to
solve, compared to what I try to achieve here.

> Eric

Thank you for detailed response! 

-- 
Ivan Abramov <i.abramov@mt-integration.ru>

  reply	other threads:[~2025-03-31  9:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-28  1:12 Ivan Abramov
2025-03-28  2:15 ` Kuniyuki Iwashima
2025-03-28 14:17   ` Eric W. Biederman
2025-03-31  9:17     ` Ivan Abramov [this message]
2025-03-28 13:25 ` Breno Leitao

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=20250331121707.5fcc75e026c2f3d0233abcd5@mt-integration.ru \
    --to=i.abramov@mt-integration.ru \
    --cc=aleksander.lobakin@intel.com \
    --cc=davem@davemloft.net \
    --cc=ebiederm@xmission.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jdamato@fastly.com \
    --cc=kuba@kernel.org \
    --cc=kuniyu@amazon.com \
    --cc=leitao@debian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=syzbot+1df6ffa7a6274ae264db@syzkaller.appspotmail.com \
    /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

all inboxes | Powered by JetHome®