Re: Dovecot 2.3.6 on Solaris10: build issues, segfaults
Looking further into this segfault at
settings-parser.c:setting_copy():1519
*dest_size = *src_size;
*src_size points to type size_t (typedef unsigned long), a 4-byte aligned value consistent with a 32-bit build. This is mismatched with declared type
(gdb) whatis src_size
type = const uoff_t *
(gdb) whatis uoff_t
type = unsigned long long
(gdb) p sizeof(uoff_t)
$1 = 8
resulting in the segfault when *src_size is dereferened. The implied condition of this code segment is typeof(uoff_t)==typeof(size_t) which is clearly not the case.
I'm not sure how/if uoff_t is defined, but configure reports
checking for uoff_t... no
checking type of off_t... long long
The latter is weird, because if I compile and run using the same compiler flags
#include <stdio.h>
int main(void) { printf("%d %d\n",sizeof(long long),sizeof(off_t)); }
the output is "8 4".
Joseph Tam jtam.home@gmail.com
Ah, okay, I see. submission_max_mail_size should be defined as uoff_t instead of size_t in struct submission_settings and struct submission_settings.
On 20 Jul 2019, at 1.47, Joseph Tam via dovecot dovecot@dovecot.org wrote:
Looking further into this segfault at
settings-parser.c:setting_copy():1519 *dest_size = *src_size;
*src_size points to type size_t (typedef unsigned long), a 4-byte aligned value consistent with a 32-bit build. This is mismatched with declared type
(gdb) whatis src_size type = const uoff_t * (gdb) whatis uoff_t type = unsigned long long (gdb) p sizeof(uoff_t) $1 = 8
resulting in the segfault when *src_size is dereferened. The implied condition of this code segment is typeof(uoff_t)==typeof(size_t) which is clearly not the case.
I'm not sure how/if uoff_t is defined, but configure reports
checking for uoff_t... no checking type of off_t... long long
The latter is weird, because if I compile and run using the same compiler flags
#include
int main(void) { printf("%d %d\n",sizeof(long long),sizeof(off_t)); } the output is "8 4".
Joseph Tam jtam.home@gmail.com
On Mon, 22 Jul 2019, Timo Sirainen wrote:
Ah, okay, I see. submission_max_mail_size should be defined as uoff_t instead of size_t in struct submission_settings and struct submission_settings.
Thanks!
This appears to be the correct diagnosis as this patch (for 2.3.7) got
rid of the segfaults
================================================================================
--- a/src/submission-login/submission-login-settings.h Mon Jul 22 14:37:26 2019
+++ b/src/submission-login/submission-login-settings.h Mon Jul 22 14:38:16 2019
@@ -7,3 +7,3 @@
/* submission: */
- size_t submission_max_mail_size;
+ uoff_t submission_max_mail_size;
const char *submission_backend_capabilities;
--- a/src/submission/submission-settings.h Mon Jul 22 14:37:17 2019
+++ b/src/submission/submission-settings.h Mon Jul 22 14:38:06 2019
@@ -22,3 +22,3 @@
/* submission: */
- size_t submission_max_mail_size;
+ uoff_t submission_max_mail_size;
unsigned int submission_max_recipients;
================================================================================
Joseph Tam
participants (2)
-
Joseph Tam
-
Timo Sirainen