В ядре Linux устранена следующая уязвимость:
ceph: исправлен возможный тупик при удержании Fwb для получения inline_data
1, монтировать с помощью wsync.
2, создаём файл с O_RDWR, и запрос отправляется на mds.0:
ceph_atomic_open() -->
ceph_mdsc_do_request (openc)
Finish_open(файл, dentry, ceph_open) -->
ceph_open() -->
ceph_init_file() -->
ceph_init_file_info() -->
ceph_uninline_data() -->
{
...
if (inline_version == 1 || /* начальная версия, нет данных */
встроенная_версия == CEPH_INLINE_NONE)
перейти к out_unlock;
...
}
Inline_version будет иметь значение 1, что является начальной версией для
новый создать файл. И здесь ci->i_inline_version будет иметь значение 1,
это глючит.
3, буферная запись в файл немедленно:
ceph_write_iter() -->
ceph_get_caps(файл, нужно=Fw, хочу=Fb, ...);
generic_perform_write() -->
a_ops->write_begin() -->
ceph_write_begin() -->
netfs_write_begin() -->
netfs_begin_read() -->
netfs_rreq_submit_slice() -->
netfs_read_from_server() -->
rreq->netfs_ops->issue_read()-->
ceph_netfs_issue_read() -->
{
...
if (ci->i_inline_version != CEPH_INLINE_NONE &&
ceph_netfs_issue_op_inline(subreq))
возврат;
...
}
ceph_put_cap_refs (ci, Fwb);
ceph_netfs_issue_op_inline() отправит запрос getattr(Fsr)
мдс.1.
4, то mds.1 запросит блокировку rd для CInode::filelock от
auth mds.0, mds.0 выполнит преобразование состояния CInode::filelock
из excl -> sync, но необходимо отменить ограничения Fxwb обратно из
клиенты. Пока клиент ядра уже удерживает ограничения Fwb и ждет
getattr(Фср).
Это тупик!
URL: https://tracker.ceph.com/issues/55377.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: ceph: fix possible deadlock when holding Fwb to get inline_data 1, mount with wsync. 2, create a file with O_RDWR, and the request was sent to mds.0: ceph_atomic_open()--> ceph_mdsc_do_request(openc) finish_open(file, dentry, ceph_open)--> ceph_open()--> ceph_init_file()--> ceph_init_file_info()--> ceph_uninline_data()--> { ... if (inline_version == 1 || /* initial version, no data */ inline_version == CEPH_INLINE_NONE) goto out_unlock; ... } The inline_version will be 1, which is the initial version for the new create file. And here the ci->i_inline_version will keep with 1, it's buggy. 3, buffer write to the file immediately: ceph_write_iter()--> ceph_get_caps(file, need=Fw, want=Fb, ...); generic_perform_write()--> a_ops->write_begin()--> ceph_write_begin()--> netfs_write_begin()--> netfs_begin_read()--> netfs_rreq_submit_slice()--> netfs_read_from_server()--> rreq->netfs_ops->issue_read()--> ceph_netfs_issue_read()--> { ... if (ci->i_inline_version != CEPH_INLINE_NONE && ceph_netfs_issue_op_inline(subreq)) return; ... } ceph_put_cap_refs(ci, Fwb); The ceph_netfs_issue_op_inline() will send a getattr(Fsr) request to mds.1. 4, then the mds.1 will request the rd lock for CInode::filelock from the auth mds.0, the mds.0 will do the CInode::filelock state transation from excl --> sync, but it need to revoke the Fxwb caps back from the clients. While the kernel client has aleady held the Fwb caps and waiting for the getattr(Fsr). It's deadlock! URL: https://tracker.ceph.com/issues/55377
Характеристики атаки
Последствия
Строка CVSS v3.1
Тип уязвимости (CWE)
Уязвимые продукты 1
| Конфигурация | От (включительно) | До (исключительно) |
|---|---|---|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
2.6.34
|
5.18.4
|