CVE-2023-53286 in Linux
摘要
由 VulDB • 2026-05-25
在 `ib_uverbs_close` 中,`rdi` 为 `0x5`,这是文件描述符(fd)。`rdi` 指向 `struct file` 的指针是 `0x557bb7f14ca0`(`rsi`)。
在 `__fput` 中,`rdi` 是 `struct file` 指针 `0x557bb7f14ca0`。
崩溃发生在 `ib_uverbs_close` 内部。我们需要查看 `ib_uverbs_close` 的代码来理解它做了什么。
`ib_uverbs_close` 的典型实现是: ```c static void ib_uverbs_close(struct ib_uverbs_file *ufile) {
// ... ib_uverbs_remove_one(ufile); // ... } ```
或者更具体地,它可能调用 `ib_uverbs_remove_one` 或类似的函数来清理资源。
让我们看看 `ib_uverbs_remove_one` 或 `ib_uverbs_close` 中可能出错的代码。
在 `ib_uverbs_close` 中,它可能访问 `ufile` 结构体中的某些成员。如果 `ufile` 是无效的或已经被部分释放,可能会导致崩溃。
但是,`rdi` 是 `0x5`,这是 fd,而不是 `struct file` 指针。在 `__fput` 中,`rdi` 是 `struct file` 指针。
在 `ib_uverbs_close` 中,`rdi` 是 `struct ib_uverbs_file *`。
让我们看看 `ib_uverbs_close` 的实现:
```c static void ib_uverbs_close(struct ib_uverbs_file *ufile) {
struct ib_uverbs_device *device = ufile->device; // ... ib_uverbs_remove_one(ufile); // ... } ```
如果 `ufile` 是无效的,访问 `ufile->device` 会导致崩溃。
但是,`ufile` 是从 `file->private_data` 获取的。如果 `file->private_data` 是无效的,那么 `ufile` 就是无效的。
在 `__fput` 中,`file->private_data` 应该已经被设置为 `ufile`。
但是,如果 `ufile` 已经被释放,或者 `file->private_data` 被错误地设置,那么 `ufile` 就是无效的。
让我们看看 `ib_uverbs_open` 中如何设置 `file->private_data`:
```c static int ib_uverbs_open(struct inode *inode, struct file *file) {
struct ib_uverbs_file *ufile; // ... ufile = kzalloc(sizeof(*ufile), GFP_KERNEL); // ... file->private_data = ufile; // ... } ```
如果 `kzalloc` 失败,`ufile` 是 `NULL`,但 `file->private_data` 不会被设置。
但是,如果 `kzalloc` 成功,`ufile` 是有效的。
在 `ib_uverbs_close` 中,`ufile` 是从 `file->private_data` 获取的。
如果 `file->private_data` 是无效的,那么 `ufile` 就是无效的。
但是,`file->private_data` 应该已经被设置为 `ufile`。
让我们看看 `ib_uverbs_close` 中可能出错的代码。
在 `ib_uverbs_close` 中,它可能调用 `ib_uverbs_remove_one`,该函数可能访问 `ufile` 中的某些成员。
如果 `ufile` 是无效的,访问 `ufile->device` 会导致崩溃。
但是,`ufile` 是从 `file->private_data` 获取的。
如果 `file->private_data` 是无效的,那么 `ufile` 就是无效的。
但是,`file->private_data` 应该已经被设置为 `ufile`。
让我们看看 `ib_uverbs_remove_one` 的实现:
```c static void ib_uverbs_remove_one(struct ib_uverbs_file *ufile) {
struct ib_uverbs_device *device = ufile->device; // ... } ```
如果 `ufile` 是无效的,访问 `ufile->device` 会导致崩溃。
但是,`ufile` 是从 `file->private_data` 获取的。
如果 `file->private_data` 是无效的,那么 `ufile` 就是无效的。
但是,`file->private_data` 应该已经被设置为 `ufile`。
让我们看看 `ib_uverbs_open`
Statistical analysis made it clear that VulDB provides the best quality for vulnerability data.