]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
cmake: remove osdc/error_code.cc from osdc to fix ODR violation 64259/head
authorKefu Chai <tchaikov@gmail.com>
Mon, 30 Jun 2025 07:54:14 +0000 (15:54 +0800)
committerKefu Chai <tchaikov@gmail.com>
Mon, 14 Jul 2025 01:27:42 +0000 (09:27 +0800)
commit291b40ee9a6a032b04ec0ee58f45b04a0e674ce7
tree6e3c8038f9d4f919adaf83a853de022747b218d3
parentd35e1b5f4a8139766cf3647a290cf5a12219acb9
cmake: remove osdc/error_code.cc from osdc to fix ODR violation

Fix AddressSanitizer ODR (One Definition Rule) violation caused by
osdc/error_code.cc being compiled into both the osdc library and
ceph-common library.

The violation occurred because osdc_error_category was defined in
both the rbd binary (via osdc) and libceph-common.so, creating
duplicate symbols at runtime.

Since all targets that link against osdc also link against
ceph-common, removing osdc/error_code.cc from osdc doesn't break the
build while eliminating the duplicate definition.

ASan error sample:

```
  ==857433==ERROR: AddressSanitizer: odr-violation (0x5612ad665760):
    [1] size=22 'typeinfo name for osdc_error_category' /home/jenkins-build/build/workspace/ceph-pull-requests/src/osdc/error_code.cc in /home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/rbd
    [2] size=22 'typeinfo name for osdc_error_category' /home/jenkins-build/build/workspace/ceph-pull-requests/src/osdc/error_code.cc in /home/jenkins-build/build/workspace/ceph-pull-requests/build/lib/libceph-common.so.2
  These globals were registered at these points:
    [1]:
      #0 0x5612acd62c88 in __asan_register_globals (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/rbd+0x815c88) (BuildId: 62a02cbbf3426e5470e16372e3b53a18cb18ce0f)
      #1 0x5612acd63d59 in __asan_register_elf_globals (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/rbd+0x816d59) (BuildId: 62a02cbbf3426e5470e16372e3b53a18cb18ce0f)
      #2 0x7f28d3b02eba in call_init csu/../csu/libc-start.c:145:3
      #3 0x7f28d3b02eba in __libc_start_main csu/../csu/libc-start.c:379:5
```

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
src/osdc/CMakeLists.txt