Bug 279418 - databases/sqlite3 crashes with SIGSEGV in dspam
Summary: databases/sqlite3 crashes with SIGSEGV in dspam
Status: Closed DUPLICATE of bug 279417
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-05-31 01:38 UTC by vova
Modified: 2024-12-02 14:33 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (pavelivolkov)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description vova 2024-05-31 01:38:27 UTC
sqlite3-3.45.1,1 badly break dspam - now it died with SIGSEGV:

exim -d -d -M 1sCqf4-00000000HJz-3K8x
...
LOG: MAIN
  ** <email> R=dspam_spamscan_router T=dspam_spamcheck_transport: Child process of dspam_spamcheck_transport transport (running command "/usr/local/bin/dspam --deliver=innocent --user "${lookup{$local_part} lsearch,ret=key {/etc/passwd}}" -- %u") was terminated by signal 11 (segmentation fault)
...

if start debugger while it not yet crashed:

# lldb -n dspam
(lldb) c
Process 91463 resuming
Process 91463 stopped
* thread #1, name = 'dspam', stop reason = signal SIGSEGV: invalid address (fault address: 0x121668)
    frame #0: 0x0000000824cbdfd4 libc.so.7`___lldb_unnamed_symbol5326 + 164
libc.so.7`___lldb_unnamed_symbol5326:
->  0x824cbdfd4 <+164>: movq   (%rax), %rax
    0x824cbdfd7 <+167>: movq   %rax, %r13
    0x824cbdfda <+170>: shrq   $0x30, %r13
    0x824cbdfde <+174>: leaq   0x28685b(%rip), %rcx
(lldb) bt
* thread #1, name = 'dspam', stop reason = signal SIGSEGV: invalid address (fault address: 0x121668)
  * frame #0: 0x0000000824cbdfd4 libc.so.7`___lldb_unnamed_symbol5326 + 164
    frame #1: 0x00000008242d002e libsqlite3_drv.so`_sqlite_drv_query_error(error="_ds_set_signature: sqlite3_prepare() failed", query="INSERT INTO dspam_signature_data (signature,created_on,data) VALUES (\"6659280d914632013293170\",date('now'),?)") at sqlite3_drv.c:1339:3
    frame #2: 0x00000008242d284d libsqlite3_drv.so`_ds_set_signature(CTX=0x000018d77d45a100, SIG=0x000018d77d4ba280, signature="6659280d914632013293170") at sqlite3_drv.c:974:5
    frame #3: 0x000000000020c51b dspam`process_message(ATX=0x000000082112e210, message=0x000018d77d45c0e0, username="vova", result_string=0x000000082112d7a8) at dspam.c:641:17
    frame #4: 0x000000000020a975 dspam`process_users(ATX=0x000000082112e210, message=0x000018d77d45c0a0) at dspam.c:1892:16
    frame #5: 0x0000000000209484 dspam`main(argc=6, argv=0x000000082112f148) at dspam.c:263:14
    frame #6: 0x0000000824bcbafa libc.so.7`__libc_start1 + 298
    frame #7: 0x0000000000208ea0 dspam`_start + 48
(lldb)


if rollback to previous sqlite3-3.45.0_1,1 - everything goes fine:
LOG: MAIN
  => vova <vova@domain...> R=dspam_spamscan_router T=dspam_spamcheck_transport


FreeBSD srv 14.0-RELEASE FreeBSD 14.0-RELEASE #16 f9716eee8ab4: Fri Apr  5 13:43:53 MSK 2024     root@srv:/usr/obj/usr/src/amd64.amd64/sys/SRV amd64
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2024-05-31 01:47:24 UTC

*** This bug has been marked as a duplicate of bug 279417 ***
Comment 2 commit-hook freebsd_committer freebsd_triage 2024-12-02 14:28:38 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=9655fa3e957a034ffca3780d87116cbdcc3fdbc9

commit 9655fa3e957a034ffca3780d87116cbdcc3fdbc9
Author:     Pavel Volkov <pavelivolkov@gmail.com>
AuthorDate: 2024-11-30 11:04:15 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2024-12-02 14:27:32 +0000

    mail/dspam: fix with sqlite3 with DQS option enabled

    Use single quotes for strings in SQL statements to avoid them failing.

    PR:             279418
    Approved by:    portmgr (build fix blanket)
    MFH:            2024Q4

 mail/dspam/Makefile                             |  2 +-
 mail/dspam/files/patch-src_sqlite3__drv.c (new) | 38 +++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 1 deletion(-)
Comment 3 commit-hook freebsd_committer freebsd_triage 2024-12-02 14:33:51 UTC
A commit in branch 2024Q4 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=df3b689197893f41375bee6c6bb93820560cb072

commit df3b689197893f41375bee6c6bb93820560cb072
Author:     Pavel Volkov <pavelivolkov@gmail.com>
AuthorDate: 2024-11-30 11:04:15 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2024-12-02 14:32:26 +0000

    mail/dspam: fix with sqlite3 with DQS option enabled

    Use single quotes for strings in SQL statements to avoid them failing.

    PR:             279418
    Approved by:    portmgr (build fix blanket)
    MFH:            2024Q4

    (cherry picked from commit 9655fa3e957a034ffca3780d87116cbdcc3fdbc9)

 mail/dspam/Makefile                             |  2 +-
 mail/dspam/files/patch-src_sqlite3__drv.c (new) | 38 +++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 1 deletion(-)