mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: CVE-2024-42082: xdp: Remove WARN() from __xdp_reg_mem_model()
       [not found] <2024072956-CVE-2024-42082-8411@gregkh>
@ 2024-08-06  8:48 ` Shung-Hsi Yu
  2024-08-06  8:55   ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Shung-Hsi Yu @ 2024-08-06  8:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman, cve; +Cc: linux-kernel

On Mon, Jul 29, 2024 at 05:53:11PM GMT, Greg Kroah-Hartman wrote:
> Description
> ===========
> 
> In the Linux kernel, the following vulnerability has been resolved:
> 
> xdp: Remove WARN() from __xdp_reg_mem_model()
> 
> syzkaller reports a warning in __xdp_reg_mem_model().
> 
> The warning occurs only if __mem_id_init_hash_table() returns an error. It
> returns the error in two cases:
> 
>   1. memory allocation fails;
>   2. rhashtable_init() fails when some fields of rhashtable_params
>      struct are not initialized properly.
> 
> The second case cannot happen since there is a static const rhashtable_params
> struct with valid fields. So, warning is only triggered when there is a
> problem with memory allocation.
> 
> Thus, there is no sense in using WARN() to handle this error and it can be
> safely removed.
[...]

The mention fix (below) simply removed a WARN_ON(1) call, so I believe
there's no security implication here.


--- a/net/core/xdp.c
+++ b/net/core/xdp.c
@@ -295,10 +295,8 @@ static struct xdp_mem_allocator *__xdp_reg_mem_model(struct xdp_mem_info *mem,
 		mutex_lock(&mem_id_lock);
 		ret = __mem_id_init_hash_table();
 		mutex_unlock(&mem_id_lock);
-		if (ret < 0) {
-			WARN_ON(1);
+		if (ret < 0)
 			return ERR_PTR(ret);
-		}
 	}
 
 	xdp_alloc = kzalloc(sizeof(*xdp_alloc), gfp);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: CVE-2024-42082: xdp: Remove WARN() from __xdp_reg_mem_model()
  2024-08-06  8:48 ` CVE-2024-42082: xdp: Remove WARN() from __xdp_reg_mem_model() Shung-Hsi Yu
@ 2024-08-06  8:55   ` Greg Kroah-Hartman
  2024-08-06 12:50     ` Shung-Hsi Yu
  0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2024-08-06  8:55 UTC (permalink / raw)
  To: Shung-Hsi Yu; +Cc: cve, linux-kernel

On Tue, Aug 06, 2024 at 04:48:56PM +0800, Shung-Hsi Yu wrote:
> On Mon, Jul 29, 2024 at 05:53:11PM GMT, Greg Kroah-Hartman wrote:
> > Description
> > ===========
> > 
> > In the Linux kernel, the following vulnerability has been resolved:
> > 
> > xdp: Remove WARN() from __xdp_reg_mem_model()
> > 
> > syzkaller reports a warning in __xdp_reg_mem_model().
> > 
> > The warning occurs only if __mem_id_init_hash_table() returns an error. It
> > returns the error in two cases:
> > 
> >   1. memory allocation fails;
> >   2. rhashtable_init() fails when some fields of rhashtable_params
> >      struct are not initialized properly.
> > 
> > The second case cannot happen since there is a static const rhashtable_params
> > struct with valid fields. So, warning is only triggered when there is a
> > problem with memory allocation.
> > 
> > Thus, there is no sense in using WARN() to handle this error and it can be
> > safely removed.
> [...]
> 
> The mention fix (below) simply removed a WARN_ON(1) call, so I believe
> there's no security implication here.

If memory allocation fails, and panic-on-warn is enabled, this will
cause the machine to reboot, hence the need for a CVE allocation.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: CVE-2024-42082: xdp: Remove WARN() from __xdp_reg_mem_model()
  2024-08-06  8:55   ` Greg Kroah-Hartman
@ 2024-08-06 12:50     ` Shung-Hsi Yu
  0 siblings, 0 replies; 3+ messages in thread
From: Shung-Hsi Yu @ 2024-08-06 12:50 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: cve, linux-kernel

On Tue, Aug 06, 2024 at 10:55:00AM GMT, Greg Kroah-Hartman wrote:
> On Tue, Aug 06, 2024 at 04:48:56PM +0800, Shung-Hsi Yu wrote:
> > On Mon, Jul 29, 2024 at 05:53:11PM GMT, Greg Kroah-Hartman wrote:
> > > Description
> > > ===========
> > > 
> > > In the Linux kernel, the following vulnerability has been resolved:
> > > 
> > > xdp: Remove WARN() from __xdp_reg_mem_model()
> > > 
> > > syzkaller reports a warning in __xdp_reg_mem_model().
> > > 
> > > The warning occurs only if __mem_id_init_hash_table() returns an error. It
> > > returns the error in two cases:
> > > 
> > >   1. memory allocation fails;
> > >   2. rhashtable_init() fails when some fields of rhashtable_params
> > >      struct are not initialized properly.
> > > 
> > > The second case cannot happen since there is a static const rhashtable_params
> > > struct with valid fields. So, warning is only triggered when there is a
> > > problem with memory allocation.
> > > 
> > > Thus, there is no sense in using WARN() to handle this error and it can be
> > > safely removed.
> > [...]
> > 
> > The mention fix (below) simply removed a WARN_ON(1) call, so I believe
> > there's no security implication here.
> 
> If memory allocation fails, and panic-on-warn is enabled, this will
> cause the machine to reboot, hence the need for a CVE allocation.

I had not considered that. Thanks for the explanation.

Shung-Hsi

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-08-06 12:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <2024072956-CVE-2024-42082-8411@gregkh>
2024-08-06  8:48 ` CVE-2024-42082: xdp: Remove WARN() from __xdp_reg_mem_model() Shung-Hsi Yu
2024-08-06  8:55   ` Greg Kroah-Hartman
2024-08-06 12:50     ` Shung-Hsi Yu

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®