[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1024169: csound breaks csound-plugins autopkgtest: *** stack smashing detected ***: terminated



Dear Maintainer,
this looks like caused by a disaggrement about the size of type OPARMS.
In libcsound64-6.0 it has 264 bytes, but in csound-plugins
only 260 bytes.

This difference is caused by the last member "mp3_mode", that is missing
in the OPARMS type used in csound-plugins.
It got introduced in commit [1] and caused this ABI break.

Attached are relevant parts of the debugging.

Kind regards,
Bernhard

[1] https://github.com/csound/csound/commit/11df83f60d6afa51e5e0d25dc5efe5b2beec621e

(rr) bt
#0  0xb7a1e4f6 in memcpy (__len=264, __src=0x10d3de0, __dest=0xbfb5aee8) at /usr/include/i386-linux-gnu/bits/string_fortified.h:29
#1  csoundGetOParms (csound=<optimized out>, p=0xbfb5aee8) at ./Top/csound.c:230
#2  0xb51310c0 in csoundModuleInit (csound=0x10c61a0) at ./widgets/winFLTK.c:73
#3  0xb7b6388a in csoundInitModule (csound=csound@entry=0x10c61a0, m=m@entry=0x11baed8) at ./Top/csmodule.c:249
#4  0xb7b63a51 in csoundInitModules (csound=0x10c61a0) at ./Top/csmodule.c:825
#5  0xb7a233f5 in csoundReset (csound=<optimized out>) at ./Top/csound.c:3554
#6  0xb7a23af4 in csoundCreate (hostdata=0x0) at ./Top/csound.c:1361
#7  0x004c24c7 in main (argc=3, argv=0xbfb5b224) at ./Frontends/csound/csound_main.c:322
# Unstable i386 qemu VM 2022-11-15

apt update
apt dist-upgrade

apt install systemd-coredump gdb rr autopkgtest dpkg-dev csound csound-plugins python3-csound csound-plugins-dbgsym libcsound64-6.0-dbgsym csound-dbgsym





$ autopkgtest csound-plugins --shell-fail -- null
autopkgtest [23:05:23]: starting date and time: 2022-11-15 23:05:23+0100
autopkgtest [23:05:23]: version 5.27
autopkgtest [23:05:23]: host debian; command line: /usr/bin/autopkgtest csound-plugins --shell-fail -- null
autopkgtest [23:05:23]: testbed dpkg architecture: i386
autopkgtest [23:05:23]: testbed running kernel: Linux 6.0.0-4-686-pae #1 SMP PREEMPT_DYNAMIC Debian 6.0.8-1 (2022-11-11)
autopkgtest [23:05:23]: @@@@@@@@@@@@@@@@@@@@ apt-source csound-plugins
gpgv: unknown type of key resource 'trustedkeys.kbx'
gpgv: Schlüsselblockhilfsmittel`/tmp/dpkg-verify-sig.OC9zItqO/trustedkeys.kbx': General error
gpgv: Signatur vom Mi 28 Sep 2022 09:29:57 CEST
gpgv:                mittels RSA-Schlüssel 7405E745574809734800156DB65019C47F7A36F8
gpgv: Signatur kann nicht geprüft werden: No public key
dpkg-source: Warnung: Signatur ./csound-plugins_1.0.2~dfsg1-2.dsc kann nicht überprüft werden
autopkgtest [23:05:24]: testing package csound-plugins version 1.0.2~dfsg1-2
autopkgtest [23:05:24]: build not needed
autopkgtest [23:05:24]: test command1: preparing testbed
autopkgtest [23:05:24]: test command1: csound --nosound py/examples/embeddedCtcsound.csd
autopkgtest [23:05:24]: test command1: [-----------------------
*** stack smashing detected ***: terminated

csound command: Aborted

csound command: Segmentation fault
autopkgtest [23:05:25]: test command1: -----------------------]
autopkgtest [23:05:25]: test command1:  - - - - - - - - - - results - - - - - - - - - -
command1             FAIL non-zero exit status 1
autopkgtest [23:05:25]:  - - - - - - - - - - running shell - - - - - - - - - -
benutzer@debian:/tmp/autopkgtest.2VfrCV/build.Tvx/src$ rr record csound --nosound py/examples/embeddedCtcsound.csd
rr: Saving execution to trace directory `/home/benutzer/.local/share/rr/csound-0'.
*** stack smashing detected ***: terminated

csound command: Aborted

csound command: Segmentation fault
$ rr replay -o -q csound-0
Reading symbols from /usr/bin/csound...
(No debugging symbols found in /usr/bin/csound)
Really redefine built-in command "restart"? (y or n) [answered Y; input not from terminal]
Really redefine built-in command "jump"? (y or n) [answered Y; input not from terminal]
Remote debugging using 127.0.0.1:3587
Reading symbols from /lib/ld-linux.so.2...
Reading symbols from /usr/lib/debug/.build-id/9b/f5ef863480886a4c2159e109d63c656ca30739.debug...
BFD: warning: system-supplied DSO at 0x6fffd000 has a section extending past end of file
0xb7f40450 in _start () from /lib/ld-linux.so.2
(rr) cont
Continuing.
*** stack smashing detected ***: terminated

Program received signal SIGABRT, Aborted.
0x70000002 in syscall_traced ()
(rr) bt
#0  0x70000002 in syscall_traced ()
#1  0xb7f1513d in _raw_syscall () at /build/rr-Rm2x32/rr-5.6.0/src/preload/raw_syscall.S:34
#2  0xb7f10b33 in traced_raw_syscall (call=0x681fffd8) at ./src/preload/syscallbuf.c:338
#3  0xb7f12c4d in sys_recvfrom (call=<optimized out>) at ./src/preload/syscallbuf.c:2952
#4  syscall_hook_internal (call=0x681fffd8) at ./src/preload/syscallbuf.c:3843
#5  syscall_hook (call=0x681fffd8) at ./src/preload/syscallbuf.c:3949
#6  syscall_hook (call=<optimized out>) at ./src/preload/syscallbuf.c:3933
#7  0xb7f10361 in _syscall_hook_trampoline () at /build/rr-Rm2x32/rr-5.6.0/src/preload/syscall_hook.S:131
#8  0xb7f103d2 in _syscall_hook_trampoline_90_90_90 () at /build/rr-Rm2x32/rr-5.6.0/src/preload/syscall_hook.S:211
#9  0x6ffff005 in __kernel_vsyscall ()
#10 0xb768a1d7 in __pthread_kill_implementation (threadid=threadid@entry=3084027648, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:43
#11 0xb768a24b in __pthread_kill_internal (signo=6, threadid=3084027648) at ./nptl/pthread_kill.c:78
#12 0xb76390d1 in __GI_raise (sig=6) at ../sysdeps/posix/raise.c:26
#13 0xb762226a in __GI_abort () at ./stdlib/abort.c:79
#14 0xb767cb76 in __libc_message (action=<optimized out>, fmt=<optimized out>) at ../sysdeps/posix/libc_fatal.c:155
#15 0xb7732eac in __GI___fortify_fail (msg=0xb77b8725 "stack smashing detected") at ./debug/fortify_fail.c:26
#16 0xb7732e79 in __stack_chk_fail () at ./debug/stack_chk_fail.c:24
#17 0xb514aba4 in ?? () from /usr/lib/i386-linux-gnu/csound/plugins64-6.0/libwidgets.so
#18 0xb513139d in csoundModuleInit () from /usr/lib/i386-linux-gnu/csound/plugins64-6.0/libwidgets.so
#19 0xb7b6388a in ?? () from /lib/i386-linux-gnu/libcsound64.so.6.0
#20 0xb7b63a51 in ?? () from /lib/i386-linux-gnu/libcsound64.so.6.0
#21 0xb7a233f5 in csoundReset () from /lib/i386-linux-gnu/libcsound64.so.6.0
#22 0xb7a23af4 in csoundCreate () from /lib/i386-linux-gnu/libcsound64.so.6.0
#23 0x004c24c7 in ?? ()
#24 0xb7623295 in __libc_start_call_main (main=main@entry=0x4c22c0, argc=argc@entry=3, argv=argv@entry=0xbfb5b224) at ../sysdeps/nptl/libc_start_call_main.h:58
#25 0xb7623358 in __libc_start_main_impl (main=0x4c22c0, argc=3, argv=0xbfb5b224, init=0x0, fini=0x0, rtld_fini=0xb7f29820 <_dl_fini>, stack_end=0xbfb5b21c) at ../csu/libc-start.c:381
#26 0x004c2687 in ?? ()







$ rr replay -o -q csound-0
Reading symbols from /usr/bin/csound...
Reading symbols from /usr/lib/debug/.build-id/d9/3fccaaa99735bd67f19675010c76c97a69dd87.debug...
Really redefine built-in command "restart"? (y or n) [answered Y; input not from terminal]
Really redefine built-in command "jump"? (y or n) [answered Y; input not from terminal]
Remote debugging using 127.0.0.1:4305
Reading symbols from /lib/ld-linux.so.2...
Reading symbols from /usr/lib/debug/.build-id/9b/f5ef863480886a4c2159e109d63c656ca30739.debug...
BFD: warning: system-supplied DSO at 0x6fffd000 has a section extending past end of file
0xb7f40450 in _start () from /lib/ld-linux.so.2
(rr) b __GI___fortify_fail
Function "__GI___fortify_fail" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (__GI___fortify_fail) pending.
(rr) cont
Continuing.

Breakpoint 1, __GI___fortify_fail (msg=0xb77b8725 "stack smashing detected") at ./debug/fortify_fail.c:23
23      ./debug/fortify_fail.c: Datei oder Verzeichnis nicht gefunden.
(rr) bt
#0  __GI___fortify_fail (msg=0xb77b8725 "stack smashing detected") at ./debug/fortify_fail.c:23
#1  0xb7732e79 in __stack_chk_fail () at ./debug/stack_chk_fail.c:24
#2  0xb514aba4 in __stack_chk_fail_local () from /usr/lib/i386-linux-gnu/csound/plugins64-6.0/libwidgets.so
#3  0xb513139d in csoundModuleInit (csound=0x10c61a0) at ./widgets/winFLTK.c:146
#4  0xb7b6388a in csoundInitModule (csound=csound@entry=0x10c61a0, m=m@entry=0x11baed8) at ./Top/csmodule.c:249
#5  0xb7b63a51 in csoundInitModules (csound=0x10c61a0) at ./Top/csmodule.c:825
#6  0xb7a233f5 in csoundReset (csound=<optimized out>) at ./Top/csound.c:3554
#7  0xb7a23af4 in csoundCreate (hostdata=0x0) at ./Top/csound.c:1361
#8  0x004c24c7 in main (argc=3, argv=0xbfb5b224) at ./Frontends/csound/csound_main.c:322
(rr) b csoundModuleInit
Breakpoint 2 at 0xb4331640: csoundModuleInit. (24 locations)
(rr) reverse-cont
Continuing.

Breakpoint 2, csoundModuleInit (csound=0x10c61a0) at ./widgets/winFLTK.c:67
67      {
(rr) display/i $pc
1: x/i $pc
=> 0xb5131080 <csoundModuleInit>:       push   %ebp
(rr) stepi
0xb5131081      67      {
1: x/i $pc
=> 0xb5131081 <csoundModuleInit+1>:     push   %edi
(rr) 
0xb5131082      67      {
1: x/i $pc
=> 0xb5131082 <csoundModuleInit+2>:     call   0xb5130fc8 <__x86.get_pc_thunk.di>
(rr) 
0xb5130fc8 in __x86.get_pc_thunk.di () from /usr/lib/i386-linux-gnu/csound/plugins64-6.0/libwidgets.so
1: x/i $pc
=> 0xb5130fc8 <__x86.get_pc_thunk.di>:  mov    (%esp),%edi
(rr) 
0xb5130fcb in __x86.get_pc_thunk.di () from /usr/lib/i386-linux-gnu/csound/plugins64-6.0/libwidgets.so
1: x/i $pc
=> 0xb5130fcb <__x86.get_pc_thunk.di+3>:        ret    
(rr) 
0xb5131087 in csoundModuleInit (csound=0x10c61a0) at ./widgets/winFLTK.c:67
67      {
1: x/i $pc
=> 0xb5131087 <csoundModuleInit+7>:     add    $0x23c2d,%edi
(rr) 
0xb513108d      67      {
1: x/i $pc
=> 0xb513108d <csoundModuleInit+13>:    push   %esi
(rr) 
0xb513108e      67      {
1: x/i $pc
=> 0xb513108e <csoundModuleInit+14>:    push   %ebx
(rr) 
0xb513108f      67      {
1: x/i $pc
=> 0xb513108f <csoundModuleInit+15>:    sub    $0x134,%esp
(rr) 
0xb5131095      67      {
1: x/i $pc
=> 0xb5131095 <csoundModuleInit+21>:    mov    0x148(%esp),%esi
(rr) 
0xb513109c      67      {
1: x/i $pc
=> 0xb513109c <csoundModuleInit+28>:    mov    %edi,0x14(%esp)
(rr) 
0xb51310a0      75          if (csound->QueryGlobalVariable(csound,
1: x/i $pc
=> 0xb51310a0 <csoundModuleInit+32>:    lea    -0x9ca4(%edi),%ebx
(rr) 
0xb51310a6      75          if (csound->QueryGlobalVariable(csound,
1: x/i $pc
=> 0xb51310a6 <csoundModuleInit+38>:    xor    %edi,%edi
(rr) 
0xb51310a8      67      {
1: x/i $pc
=> 0xb51310a8 <csoundModuleInit+40>:    mov    %gs:0x14,%eax
(rr) 
0xb51310ae      67      {
1: x/i $pc
=> 0xb51310ae <csoundModuleInit+46>:    mov    %eax,0x124(%esp)
(rr) print/x $esp + 0x124
$1 = 0xbfb5afec
(rr) x/1xg 0xbfb5afec
0xbfb5afec:     0xb43759d07c4e7300
(rr) stepi
0xb51310b5      67      {
1: x/i $pc
=> 0xb51310b5 <csoundModuleInit+53>:    xor    %eax,%eax
(rr) x/1xg 0xbfb5afec
0xbfb5afec:     0xb43759d07c4e7300
(rr) watch *0xbfb5afec
Hardware watchpoint 3: *0xbfb5afec
(rr) cont
Continuing.

Hardware watchpoint 3: *0xbfb5afec

Old value = 2085516032
New value = 0
0xb7a1e4f6 in memcpy (__len=264, __src=0x10d3de0, __dest=0xbfb5aee8) at /usr/include/i386-linux-gnu/bits/string_fortified.h:29
warning: Source file is more recent than executable.
29        return __builtin___memcpy_chk (__dest, __src, __len,
1: x/i $pc
=> 0xb7a1e4f6 <csoundGetOParms+38>:     sub    %edi,%ecx
(rr) bt
#0  0xb7a1e4f6 in memcpy (__len=264, __src=0x10d3de0, __dest=0xbfb5aee8) at /usr/include/i386-linux-gnu/bits/string_fortified.h:29
#1  csoundGetOParms (csound=<optimized out>, p=0xbfb5aee8) at ./Top/csound.c:230
#2  0xb51310c0 in csoundModuleInit (csound=0x10c61a0) at ./widgets/winFLTK.c:73
#3  0xb7b6388a in csoundInitModule (csound=csound@entry=0x10c61a0, m=m@entry=0x11baed8) at ./Top/csmodule.c:249
#4  0xb7b63a51 in csoundInitModules (csound=0x10c61a0) at ./Top/csmodule.c:825
#5  0xb7a233f5 in csoundReset (csound=<optimized out>) at ./Top/csound.c:3554
#6  0xb7a23af4 in csoundCreate (hostdata=0x0) at ./Top/csound.c:1361
#7  0x004c24c7 in main (argc=3, argv=0xbfb5b224) at ./Frontends/csound/csound_main.c:322

(rr) up
#1  csoundGetOParms (csound=<optimized out>, p=0xbfb5aee8) at ./Top/csound.c:230
230     memcpy(p, csound->oparms, sizeof(OPARMS));
(rr) print sizeof(OPARMS)
$2 = 264
(rr) ptype /o OPARMS
type = struct {
/*      0      |       4 */    int odebug;
/*      4      |       4 */    int sfread;
/*      8      |       4 */    int sfwrite;
/*     12      |       4 */    int sfheader;
/*     16      |       4 */    int filetyp;
/*     20      |       4 */    int inbufsamps;
/*     24      |       4 */    int outbufsamps;
/*     28      |       4 */    int informat;
/*     32      |       4 */    int outformat;
/*     36      |       4 */    int sfsampsize;
/*     40      |       4 */    int displays;
/*     44      |       4 */    int graphsoff;
/*     48      |       4 */    int postscript;
/*     52      |       4 */    int msglevel;
/*     56      |       4 */    int Beatmode;
/*     60      |       4 */    int oMaxLag;
/*     64      |       4 */    int usingcscore;
/*     68      |       4 */    int Linein;
/*     72      |       4 */    int RTevents;
/*     76      |       4 */    int Midiin;
/*     80      |       4 */    int FMidiin;
/*     84      |       4 */    int RMidiin;
/*     88      |       4 */    int ringbell;
/*     92      |       4 */    int termifend;
/*     96      |       4 */    int rewrt_hdr;
/*    100      |       4 */    int heartbeat;
/*    104      |       4 */    int gen01defer;
/*    108      |       8 */    double cmdTempo;
/*    116      |       4 */    float sr_override;
/*    120      |       4 */    float kr_override;
/*    124      |       4 */    int nchnls_override;
/*    128      |       4 */    int nchnls_i_override;
/*    132      |       4 */    char *infilename;
/*    136      |       4 */    char *outfilename;
/*    140      |       4 */    CORFIL *playscore;
/*    144      |       4 */    char *Linename;
/*    148      |       4 */    char *Midiname;
/*    152      |       4 */    char *FMidiname;
/*    156      |       4 */    char *Midioutname;
/*    160      |       4 */    char *FMidioutname;
/*    164      |       4 */    int midiKey;
/*    168      |       4 */    int midiKeyCps;
/*    172      |       4 */    int midiKeyOct;
/*    176      |       4 */    int midiKeyPch;
/*    180      |       4 */    int midiVelocity;
/*    184      |       4 */    int midiVelocityAmp;
/*    188      |       4 */    int noDefaultPaths;
/*    192      |       4 */    int numThreads;
/*    196      |       4 */    int syntaxCheckOnly;
/*    200      |       4 */    int useCsdLineCounts;
/*    204      |       4 */    int sampleAccurate;
/*    208      |       4 */    int realtime;
/*    212      |       8 */    double e0dbfs_override;
/*    220      |       4 */    int daemon;
/*    224      |       8 */    double quality;
/*    232      |       4 */    int ksmps_override;
/*    236      |       4 */    int fft_lib;
/*    240      |       4 */    int echo;
/*    244      |       8 */    double limiter;
/*    252      |       4 */    float sr_default;
/*    256      |       4 */    float kr_default;
/*    260      |       4 */    int mp3_mode;

                               /* total size (bytes):  264 */
                             }
(rr) 


https://sources.debian.org/src/csound/1%3A6.18.0%2Bdfsg-2/Top/csound.c/#L230

(rr) up
#2  0xb51310c0 in csoundModuleInit (csound=0x10c61a0) at ./widgets/winFLTK.c:73
73           csound->GetOParms(csound, &oparms);
(rr) print &oparms
$3 = (OPARMS *) 0xbfb5aee8
(rr) print sizeof(oparms)
$4 = 260
(rr) list
68          const OENTRY  *ep = &(widgetOpcodes_[0]);
69          int           initFlags = 0;
70          int           *fltkFlags;
71          int           enableDisplays = 0;
72          OPARMS oparms;
73           csound->GetOParms(csound, &oparms);
74
75          if (csound->QueryGlobalVariable(csound,
76                                          "FLTK_Flags") == (void*) 0) {
77            if (UNLIKELY(csound->CreateGlobalVariable(csound,

(rr) ptype /o oparms
type = struct {
/*      0      |       4 */    int odebug;
/*      4      |       4 */    int sfread;
/*      8      |       4 */    int sfwrite;
/*     12      |       4 */    int sfheader;
/*     16      |       4 */    int filetyp;
/*     20      |       4 */    int inbufsamps;
/*     24      |       4 */    int outbufsamps;
/*     28      |       4 */    int informat;
/*     32      |       4 */    int outformat;
/*     36      |       4 */    int sfsampsize;
/*     40      |       4 */    int displays;
/*     44      |       4 */    int graphsoff;
/*     48      |       4 */    int postscript;
/*     52      |       4 */    int msglevel;
/*     56      |       4 */    int Beatmode;
/*     60      |       4 */    int oMaxLag;
/*     64      |       4 */    int usingcscore;
/*     68      |       4 */    int Linein;
/*     72      |       4 */    int RTevents;
/*     76      |       4 */    int Midiin;
/*     80      |       4 */    int FMidiin;
/*     84      |       4 */    int RMidiin;
/*     88      |       4 */    int ringbell;
/*     92      |       4 */    int termifend;
/*     96      |       4 */    int rewrt_hdr;
/*    100      |       4 */    int heartbeat;
/*    104      |       4 */    int gen01defer;
/*    108      |       8 */    double cmdTempo;
/*    116      |       4 */    float sr_override;
/*    120      |       4 */    float kr_override;
/*    124      |       4 */    int nchnls_override;
/*    128      |       4 */    int nchnls_i_override;
/*    132      |       4 */    char *infilename;
/*    136      |       4 */    char *outfilename;
/*    140      |       4 */    CORFIL *playscore;
/*    144      |       4 */    char *Linename;
/*    148      |       4 */    char *Midiname;
/*    152      |       4 */    char *FMidiname;
/*    156      |       4 */    char *Midioutname;
/*    160      |       4 */    char *FMidioutname;
/*    164      |       4 */    int midiKey;
/*    168      |       4 */    int midiKeyCps;
/*    172      |       4 */    int midiKeyOct;
/*    176      |       4 */    int midiKeyPch;
/*    180      |       4 */    int midiVelocity;
/*    184      |       4 */    int midiVelocityAmp;
/*    188      |       4 */    int noDefaultPaths;
/*    192      |       4 */    int numThreads;
/*    196      |       4 */    int syntaxCheckOnly;
/*    200      |       4 */    int useCsdLineCounts;
/*    204      |       4 */    int sampleAccurate;
/*    208      |       4 */    int realtime;
/*    212      |       8 */    double e0dbfs_override;
/*    220      |       4 */    int daemon;
/*    224      |       8 */    double quality;
/*    232      |       4 */    int ksmps_override;
/*    236      |       4 */    int fft_lib;
/*    240      |       4 */    int echo;
/*    244      |       8 */    double limiter;
/*    252      |       4 */    float sr_default;
/*    256      |       4 */    float kr_default;

                               /* total size (bytes):  260 */
                             }
(rr) 

https://sources.debian.org/src/csound-plugins/1.0.2~dfsg1-2/widgets/winFLTK.c/#L73

https://github.com/csound/csound/issues/1651


Reply to: