Public bug reported:

I was wondering about a crash when building dovecot 2.2.25 on latest Ubuntu.
I wondered as I've had the same source building on Debian just fine.

Some debugging led me to this weird behavior:
Using this gdb command file called autoreportissue in my case:
break dcrypt_initialize
  commands
    p dcrypt_vfs
    p &dcrypt_vfs
    watch dcrypt_vfs
    c
  end
break dcrypt_set_vfs
  commands
    p dcrypt_vfs
    p &dcrypt_vfs
    c
  end
r

Running test-crypto on Debian and Ubuntu reported those two behaviours:
gdb -d /root/dovecot-2.2.25/src/ -x autoreportissue ./test-crypto

Good:
Breakpoint 1, dcrypt_initialize (backend=0x555555587c02 "openssl", set=0x0, 
error_r=0x0) at dcrypt.c:15
15              if (dcrypt_vfs != NULL) {
$1 = (struct dcrypt_vfs *) 0x0
$2 = (struct dcrypt_vfs **) 0x555555796370 <dcrypt_vfs>
Hardware watchpoint 3: dcrypt_vfs
Breakpoint 2, dcrypt_set_vfs (vfs=0x7ffff7835020 <dcrypt_openssl_vfs>) at 
dcrypt.c:56
56              dcrypt_vfs = vfs;
$3 = (struct dcrypt_vfs *) 0x0
$4 = (struct dcrypt_vfs **) 0x555555796370 <dcrypt_vfs>
Hardware watchpoint 3: dcrypt_vfs
Old value = (struct dcrypt_vfs *) 0x0
New value = (struct dcrypt_vfs *) 0x7ffff7835020 <dcrypt_openssl_vfs>
dcrypt_set_vfs (vfs=0x7ffff7835020 <dcrypt_openssl_vfs>) at dcrypt.c:57
57      }

Bad:
Breakpoint 1, dcrypt_initialize (backend=0x555555589f02 "openssl", set=0x0, 
error_r=0x0) at dcrypt.c:11
11      {
$1 = (struct dcrypt_vfs *) 0x0
$2 = (struct dcrypt_vfs **) 0x555555798370 <dcrypt_vfs>
Hardware watchpoint 3: dcrypt_vfs
Breakpoint 2, dcrypt_set_vfs (vfs=0x7ffff780a020 <dcrypt_openssl_vfs>) at 
dcrypt.c:56
56              dcrypt_vfs = vfs;
$3 = (struct dcrypt_vfs *) 0x0
$4 = (struct dcrypt_vfs **) 0x7ffff780a890 <dcrypt_vfs>
Panic: file dcrypt.c: line 34 (dcrypt_initialize): assertion failed: 
(dcrypt_vfs != NULL)
Error: Raw backtrace: /root/dovecot-2.2.25/src/lib-dcrypt/test-crypto(+0x15f7c) 
[0x555555569f7c] -> 
/root/dovecot-2.2.25/src/lib-dcrypt/test-crypto(default_error_handler+0) 
[0x55555556a030] -> /root/dovecot-2.2.25/src/lib-dcrypt/test-crypto(i_fatal+0) 
[0x55555556a2ff] -> 
/root/dovecot-2.2.25/src/lib-dcrypt/test-crypto(dcrypt_initialize+0x140) 
[0x55555555f030] -> /root/dovecot-2.2.25/src/lib-dcrypt/test-crypto(main+0x23) 
[0x55555556706d] -> /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf1) 
[0x7ffff782d3f1] -> 
/root/dovecot-2.2.25/src/lib-dcrypt/test-crypto(_start+0x2a) [0x55555555edea]
Program received signal SIGABRT, Aborted.

One can see that in the bad case the pointer of dcrypt_vfs is pointing
to something of the scope of the .libs/libdcrypt_openssl.so file and not
the dcrypt_initialize of test-crypto.

That made me wonder even more - where would this issue of variable scope
come from. After more debugging I found that the linker flag
"-Bsymbolic-functions" is the reason. This is default on recent Ubuntu,
but not on Debian (?yet?).

Eventually what happens is that the dcrypt_vfs becomes part of the 
.libs/libdcrypt_openssl.so. So the call from there to dcrypt_set_vfs ends up 
setting not the expected variable.
I was unable to come up with a reasonable fix since I'm not enough into your 
sublib structure.

For now - on the merge - I'm adding a workaround to strip this flag in
Ubuntu as other packages with the same issue did the same.

I'll write it in a way to make it Debian includeable if they are willing
to accept to reduce more delta later on.

** Affects: dovecot (Ubuntu)
     Importance: High
     Assignee: ChristianEhrhardt (paelzer)
         Status: Triaged

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1636781

Title:
  FTBFS of Dovecot 2.2.25 in Ubuntu due to -Bsymbolic-functions

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dovecot/+bug/1636781/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to