[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <de23f3cd-833a-44c0-91bc-5a013458a05f@redhat.com>
Date: Tue, 19 Nov 2024 12:01:34 +0100
From: Paolo Abeni <pabeni@...hat.com>
To: Song Chen <chensong_2000@....cn>, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, kory.maincent@...tlin.com,
aleksander.lobakin@...el.com, willemb@...gle.com
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net/core/dev_ioctl: avoid invoking modprobe with empty
ifr_name
On 11/17/24 05:55, Song Chen wrote:
> dev_ioctl handles requests from user space if a process calls
> ioctl(sockfd, SIOCGIFINDEX, &ifr). However, if this user space
> process doesn't have interface name well specified, dev_ioctl
> doesn't give it an essential check, as a result, dev_load will
> invoke modprobe with a nonsense module name if the user happens
> to be sys admin or root, see following code in dev_load:
>
> no_module = !dev;
> if (no_module && capable(CAP_NET_ADMIN))
> no_module = request_module("netdev-%s", name);
> if (no_module && capable(CAP_SYS_MODULE))
> request_module("%s", name);
>
> This patch checks if ifr_name is empty at the beginning, reduces
> the overhead of calling modprobe.
AFAICS technically this optimize a slow path (bad input from the
user-space) at the expense of the more usual path (additional unneeded
conditional) and still AFAICS, there are no functional issues addressed
here.
Note that even the latter more usual path is not a fast path, still the
optimization is not worthy.
/P
Powered by blists - more mailing lists