GitHub PushEvent at 2014-03-13 15:44:23
Repository: ceph
Actor: liewegas
Payload: {"shas":[["44aaaaffd5224412d30435c58b399e21ccff19bd","f4e2cff0138e8cd5600e8ca295bf078683584659@tesser.org","Work around race condition in libnss\n\nThis change prevents a segfault in ceph::crypto::init when using NSS and\ncalling rados_connect from multiple threads simultaneously on different\nrados_t objects (and updates the documentation for rados_connect to\nreflect the fix).\n\nIt's pretty simple, just one static mutex wrapping the\nNSS definition of ceph::crypto::init. More details regarding the race\ncondition are in this[0] commit (and pull request #1424).\n\nTo reproduce the race condition in the existing codebase, the below[1]\nC program will work (depending on number of cores and probably other\nthings, the number of threads needed to reliably reproduce varies, but\nthe more the better - in my environment five is sufficient, with four\ncores.\n\n[0]: 377c919088423bafcae92759f8d578438717705c\n\n[1]:\n\n```c\n\nvoid *init(void *p) {\n\tint err;\n\trados_t cluster;\n\terr = rados_create(&cluster, NULL);\n\tif (err < 0) {\n\t\tfprintf(stderr, \"cannot create cluster handle: %s\\n\", strerror(-err));\n\t\treturn NULL;\n\t}\n\terr = rados_conf_read_file(cluster, \"./ceph.conf\");\n\tif (err < 0) {\n\t\tfprintf(stderr, \"error reading config file: %s\\n\", strerror(-err));\n\t\treturn NULL;\n\t}\n\trados_connect(cluster);\n\treturn NULL;\n}\n\nint main() {\n\tpthread_t ts[NTHREAD];\n\tint i;\n\tfor (i = 0; i < NTHREAD; i++) {\n\t\tpthread_create(&ts[i], NULL, init, NULL);\n\t}\n\tfor (i = 0; i < NTHREAD; i++) {\n\t\tint k;\n\t\tvoid *p = (void*)&k;\n\t\tpthread_join(ts[i], p);\n\t}\n\n\treturn 0;\n}\n```\n\nSigned-off-by: Sharif Olorin <sio@tesser.org>","Sharif Olorin",true],["a2784baae16ffdd4932e5b17183efb001ab646b4","f4e2cff0138e8cd5600e8ca295bf078683584659@tesser.org","Add unit test for race condition in libnss\n\nThis isn't in test/crypto.cc because common_init_finish is called prior\nto running any tests. Will not build the test function if Ceph hasn't\nbeen configured with NSS.\n\nSigned-off-by: Sharif Olorin <sio@tesser.org>","Sharif Olorin",true],["0073bc2592964831cf816bea92b20165af0aee50","6dd34506bbd5e58221bbb3e4732d97c91f02277b@inktank.com","Merge pull request #1433 from fractalcat/fix-crypto-init-race-condition\n\nWork around race condition in libnss\r\n\r\nReviewed-by: Sage Weil <sage@inktank.com>","Sage Weil",true]],"size":3,"ref":"refs/heads/master","head":"0073bc2592964831cf816bea92b20165af0aee50"}