Export to GitHub

google-coredumper - issue #18

Coredumper library dumps 2 core files and crashes the system on x86 32 bit platform


Posted on Jun 16, 2015 by Swift Bear

What steps will reproduce the problem? 1. Build the coredump library for 32 bit system ./configure "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32" make make install

  1. call WriteCoreDump("core.test") in signal handler int main(void) { struct sigaction sa; sigfillset(&sa.sa_mask); sa.sa_flags = SA_SIGINFO; sa.sa_sigaction = coredump_signal_handler;

    if( sigaction( SIGABRT, &sa, NULL ) == -1 ) { fprintf(stderr, "core dump signal handler failed %s.\n", strerror(errno)); } }

void coredump_signal_handler(int signum, siginfo_t *info, void *data) { const char *core_test = "core.test";

    WriteCoreDump(core_test);
    /* Keep going, we generated a core file,
    ** but we didn't crash.
    **/

}

  1. program the code to call abort() in some other function.

  2. Run the process.

Expected Output: core.test should be generated and the process should continue after dumping core.

Observed output: 2 core files are generated: core.test and core.tScriptTerm.5031.6. And the system crashes after dumping the core files.

What version of the product are you using? On what operating system? I am using 1.2.1 version of core dumper library on linux Centos OS 6.6.

Please provide any additional information below. To fix the run time issue with the library, I modified the fpxregs structure in ./src/elfcore.c line # 87 as follows

if defined(i386) || defined(x86_64)

#if !defined(x86_64) typedef struct fpregs { /* FPU registers / uint32_t cwd; uint32_t swd; uint32_t twd; uint32_t fip; uint32_t fcs; uint32_t foo; uint32_t fos; uint32_t st_space[20]; / 8*10 bytes for each FP-reg = 80 bytes / } fpregs; typedef struct fpxregs { / SSE registers / #define FPREGS fpxregs #else typedef struct fpxregs { / x86-64 stores FPU registers in SSE struct / } fpxregs; typedef struct fpregs { / FPU registers */ #define FPREGS fpregs #endif

ifdef KM15062015

uint16_t  cwd;
uint16_t  swd;
uint16_t  twd;
uint16_t  fop;
uint32_t  fip;
uint32_t  fcs;
uint32_t  foo;
uint32_t  fos;
uint32_t  mxcsr;
uint32_t  mxcsr_mask;
uint32_t  st_space[32];     /*  8*16 bytes for each FP-reg  = 128 bytes  */
uint32_t  xmm_space[64];    /* 16*16 bytes for each XMM-reg = 128 bytes  */
uint32_t  padding[24];

endif

} FPREGS; #undef FPREGS #define regs i386_regs /* General purpose regi

Please let me know if you need any other information.

Thanks Kshitij

Status: New

Labels:
Type-Defect Priority-Medium