mirror of
https://github.com/ceph/ceph
synced 2024-12-17 00:46:05 +00:00
2cc76bcd12
For cephx, build_authorizer reads a bunch of state (especially the current session_key) which can be updated by the MonClient. With no locks held, Pipe::connect() calls SimpleMessenger::get_authorizer() which ends up calling RadosClient::get_authorizer() and then AuthClientHandler::bulid_authorizer(). This unsafe usage can lead to crashes like: Program terminated with signal 11, Segmentation fault. 0x00007fa0d2ddb7cb in ceph::buffer::ptr::release (this=0x7f987a5e3070) at common/buffer.cc:370 370 common/buffer.cc: No such file or directory. in common/buffer.cc (gdb) bt 0x00007fa0d2ddb7cb in ceph::buffer::ptr::release (this=0x7f987a5e3070) at common/buffer.cc:370 0x00007fa0d2ddec00 in ~ptr (this=0x7f989c03b830) at ./include/buffer.h:171 ceph::buffer::list::rebuild (this=0x7f989c03b830) at common/buffer.cc:817 0x00007fa0d2ddecb9 in ceph::buffer::list::c_str (this=0x7f989c03b830) at common/buffer.cc:1045 0x00007fa0d2ea4dc2 in Pipe::connect (this=0x7fa0c4307340) at msg/Pipe.cc:907 0x00007fa0d2ea7d73 in Pipe::writer (this=0x7fa0c4307340) at msg/Pipe.cc:1518 0x00007fa0d2eb44dd in Pipe::Writer::entry (this=<value optimized out>) at msg/Pipe.h:59 0x00007fa0e0f5f9d1 in start_thread (arg=0x7f987a5e4700) at pthread_create.c:301 0x00007fa0de560b6d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115 and Error in `qemu-system-x86_64': invalid fastbin entry (free): 0x00007ff12887ff20 *** ======= Backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(+0x80a46)[0x7ff3dea1fa46] /usr/lib/librados.so.2(+0x29eb03)[0x7ff3e3d43b03] /usr/lib/librados.so.2(_ZNK9CryptoKey7encryptEP11CephContextRKN4ceph6buffer4listERS4_RSs+0x71)[0x7ff3e3d42661] /usr/lib/librados.so.2(_Z21encode_encrypt_enc_blIN4ceph6buffer4listEEvP11CephContextRKT_RK9CryptoKeyRS2_RSs+0xfe)[0x7ff3e3d417de] /usr/lib/librados.so.2(_Z14encode_encryptIN4ceph6buffer4listEEiP11CephContextRKT_RK9CryptoKeyRS2_RSs+0xa2)[0x7ff3e3d41912] /usr/lib/librados.so.2(_ZN19CephxSessionHandler12sign_messageEP7Message+0x242)[0x7ff3e3d40de2] /usr/lib/librados.so.2(_ZN4Pipe6writerEv+0x92b)[0x7ff3e3e61b2b] /usr/lib/librados.so.2(_ZN4Pipe6Writer5entryEv+0xd)[0x7ff3e3e6c7fd] /lib/x86_64-linux-gnu/libpthread.so.0(+0x7f8e)[0x7ff3ded6ff8e] /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7ff3dea99a0d] Fix this by adding an rwlock to AuthClientHandler. A simpler fix would be to move RadosClient::get_authorizer() into the MonClient() under the MonClient lock, but this would not catch all uses of other Authorizer, e.g. for verify_authorizer() and it would serialize independent connection attempts. This mainly matters for cephx, but none and unknown can have the global_id reset as well. Partially-fixes: #6480 Backport: dumpling, emperor Signed-off-by: Josh Durgin <josh.durgin@inktank.com> |
||
---|---|---|
.. | ||
arch | ||
auth | ||
bash_completion | ||
brag | ||
civetweb@041bebf7a3 | ||
client | ||
cls | ||
common | ||
crush | ||
doc | ||
erasure-code | ||
global | ||
gtest | ||
include | ||
java | ||
jobs | ||
json_spirit | ||
key_value_store | ||
librados | ||
librbd | ||
libs3@9dc3a9c683 | ||
log | ||
mds | ||
messages | ||
mon | ||
mount | ||
msg | ||
objclass | ||
objsync | ||
ocf | ||
os | ||
osd | ||
osdc | ||
perfglue | ||
pybind | ||
rbd_fuse | ||
rgw | ||
script | ||
test | ||
tools | ||
upstart | ||
.gitignore | ||
btrfs_ioc_test.c | ||
ceph_common.sh | ||
ceph_fuse.cc | ||
ceph_mds.cc | ||
ceph_mon.cc | ||
ceph_osd.cc | ||
ceph_syn.cc | ||
ceph_ver.c | ||
ceph-clsinfo | ||
ceph-coverage.in | ||
ceph-create-keys | ||
ceph-crush-location.in | ||
ceph-debugpack.in | ||
ceph-disk | ||
ceph-disk-activate | ||
ceph-disk-prepare | ||
ceph-disk-udev | ||
ceph-post-file.in | ||
ceph-rbdnamer | ||
ceph-rest-api | ||
ceph-run | ||
ceph.conf.twoosds | ||
ceph.in | ||
cephfs.cc | ||
check_version | ||
cls_acl.cc | ||
cls_crypto.cc | ||
cmonctl | ||
fetch_config | ||
init-ceph.in | ||
init-radosgw | ||
init-radosgw.sysv | ||
init-rbdmap | ||
libcephfs.cc | ||
librados-config.cc | ||
loadclass.sh | ||
logrotate.conf | ||
make_version | ||
Makefile-env.am | ||
Makefile.am | ||
mkcephfs.in | ||
mount.fuse.ceph | ||
multi-dump.sh | ||
ps-ceph.pl | ||
push_to_qemu.pl | ||
rbd.cc | ||
rbdmap | ||
README | ||
sample.ceph.conf | ||
stop.sh | ||
TODO | ||
unittest_bufferlist.sh | ||
valgrind.supp | ||
verify-mds-journal.sh | ||
vstart.sh | ||
yasm-wrapper |
Sage Weil <sage@newdream.net> Ceph - scalable distributed storage system