2024-01-17 16:30:53

by Yang, Chenyuan

[permalink] [raw]
Subject: FW: [Linux Kernel Bug] WARNING: zero-size vmalloc in ubi_read_volume_table

Hello,

We detected one crash, ?WARNING: zero-size vmalloc in ubi_read_volume_table? for the volume management system UBI (under linux/drivers/mtd/ubi) by using our generated syscall specification for it.

This crash is triggered by `create_empty_lvol` (https://elixir.bootlin.com/linux/v6.7/source/drivers/mtd/ubi/vtbl.c#L484), which allocates a zero-size memory by using `vzalloc`. Additionally, this issue is associated with the `/dev/ubi_ctrl` driver, particularly when using IOCTL with the command value UBI_IOCATT. The size allocated can be manipulated through the `ubi_attach_req` argument by altering the `vid_hdr_offset` and `max_beb_per1024` fields.

To fix this issue, it would be better to implement a check step in the `create_empty_lvol` function.

The crash is reproducible by a C program, which is attached in the file.
If you have any questions or require more information, please feel free to contact us.

Best,
Chenyuan




Attachments:
repro.cprog (1.20 kB)
repro.cprog
repro.log (15.51 kB)
repro.log
repro.prog (640.00 B)
repro.prog
repro.report (2.51 kB)
repro.report
Download all attachments

2024-01-17 16:31:12

by Yang, Chenyuan

[permalink] [raw]
Subject: WARNING: zero-size vmalloc in ubi_read_volume_table

Hello,

We detected one crash, ?WARNING: zero-size vmalloc in ubi_read_volume_table? for the volume management system UBI (under linux/drivers/mtd/ubi) by using our generated syscall specification for it.

This crash is triggered by `create_empty_lvol` (https://elixir.bootlin.com/linux/v6.7/source/drivers/mtd/ubi/vtbl.c#L484), which allocates a zero-size memory by using `vzalloc`. Additionally, this issue is associated with the `/dev/ubi_ctrl` driver, particularly when using IOCTL with the command value UBI_IOCATT. The size allocated can be manipulated through the `ubi_attach_req` argument by altering the `vid_hdr_offset` and `max_beb_per1024` fields.

To fix this issue, it would be better to implement a check step in the `create_empty_lvol` function.

The crash is reproducible by a C program, which is attached in the file.
If you have any questions or require more information, please feel free to contact us.

Best,
Chenyuan


Attachments:
repro.cprog (1.20 kB)
repro.cprog
repro.log (15.51 kB)
repro.log
repro.prog (640.00 B)
repro.prog
repro.report (2.51 kB)
repro.report
Download all attachments