Opened 5 years ago

Closed 5 years ago

#78 closed defect (fixed)

Sigaction in enquiry mode causes unexpected error while checking

Reported by: Lukáš Zaoral Owned by:
Priority: major Milestone: 4.3
Component: DiOS Keywords:
Cc: kdudka@…, jamartis@…, lzaoral@…


Hello, I was trying to check gzip 1.10, but Divine always failed with a memory error in the DiOS kernel. The following code is a minimal example of this issue:

#include <signal.h>
#include <stddef.h>

int main(void) {
    struct sigaction act;
    sigaction(SIGINT, NULL, &act);

The result of divine check is:

compiling signal.c
loading bitcode … DiOS … LART … RR … constants … done
booting … done
states per second: 86.9565                                                        
state count: 2
mips: 0.43

error found: yes
error trace: |
  FAULT: null pointer dereference: [global* 0 0 ddn]
  [0] FATAL: memory error in kernel

active stack:
  - symbol: void __dios::FaultBase::handler<__dios::Upcall<__dios::fs::VFS<__dios::ProcessManager<__dios::Fault<__dios::Scheduler<__dios::Base> > > > > >(_VM_Fault, _VM_Frame*, void (*)())
    location: /dios/include/dios/sys/fault.hpp:118
  - symbol: __dios::Scheduler<__dios::Base>::sigaction(int, sigaction const*, sigaction*)
    location: /dios/include/dios/sys/sched_base.hpp:258
  - symbol: __dios::Scheduler<__dios::Base>::rt_sigaction(int, sigaction const*, sigaction*, unsigned long)
    location: /dios/include/dios/sys/sched_base.hpp:265
  - symbol: __dios::SysProxy::rt_sigaction(int, sigaction const*, sigaction*, unsigned long)
    location: /dios/include/sys/argpad.hpp:35
  - symbol: __libc_rt_sigaction
    location: /dios/include/sys/argpad.hpp:95
  - symbol: __libc_sigaction
    location: /dios/src/libc/signal/sigaction.c:9
  - symbol: main
    location: signal.c:6
  - symbol: __dios_start
    location: /dios/src/libc/sys/start.cpp:102
a report was written to

Even though being possible by the POSIX standard, the implementation in the sched_base.hpp file never expects the second argument of sigaction to be NULL. The enclosed patch should address this issue.

After patching, both the code above and gzip 1.10 are checked successfully.

Attachments (1)

sigaction.patch (390 bytes) - added by Lukáš Zaoral 5 years ago.

Download all attachments as: .zip

Change History (2)

Changed 5 years ago by Lukáš Zaoral

Attachment: sigaction.patch added

comment:1 Changed 5 years ago by mornfall

Resolution: fixed
Status: newclosed

Thanks! Should be resolved in next now.

Note: See TracTickets for help on using tickets.