net: deal with integer overflows in kmalloc_reserve()
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
net: deal with integer overflows in kmalloc_reserve()
Blamed commit changed: ptr = kmalloc(size); if (ptr) size = ksize(ptr);
size = kmalloc_size_roundup(size); ptr = kmalloc(size);
This allowed various crash as reported by syzbot [1] and Kyle Zeng.
Problem is that if @size is bigger than 0x80000001, kmalloc_size_roundup(size) returns 2^32.
kmalloc_reserve() uses a 32bit variable (obj_size), so 2^32 is truncated to 0.
kmalloc(0) returns ZERO_SIZE_PTR which is not handled by skb allocations.
From the CVE record · Linux
An integer overflow in the Linux kernel’s kmalloc_reserve() can cause network buffer allocation to use an invalid pointer and crash. The reported trigger requires a network device MTU set close to 0x7fffffff; the input does not establish whether an attacker can trigger this remotely or what privileges are needed to set the MTU.
Engineers running Linux kernels should check whether their kernel includes the fix; affected versions are not specified.