sigbus

Catch SIGBUS in C and C++

别来无恙 提交于 2021-02-11 16:41:23
问题 I want to catch SIGBUS, my code is shown below: #include <stdlib.h> #include <signal.h> #include <iostream> #include <stdio.h> void catch_sigbus (int sig) { //std::cout << "SIGBUS" << std::endl; printf("SIGBUS\n"); exit(-1); } int main(int argc, char **argv) { signal (SIGBUS, catch_sigbus); int *iptr; char *cptr; #if defined(__GNUC__) # if defined(__i386__) /* Enable Alignment Checking on x86 */ __asm__("pushf\norl $0x40000,(%esp)\npopf"); # elif defined(__x86_64__) /* Enable Alignment

Catch SIGBUS in C and C++

左心房为你撑大大i 提交于 2021-02-11 16:40:35
问题 I want to catch SIGBUS, my code is shown below: #include <stdlib.h> #include <signal.h> #include <iostream> #include <stdio.h> void catch_sigbus (int sig) { //std::cout << "SIGBUS" << std::endl; printf("SIGBUS\n"); exit(-1); } int main(int argc, char **argv) { signal (SIGBUS, catch_sigbus); int *iptr; char *cptr; #if defined(__GNUC__) # if defined(__i386__) /* Enable Alignment Checking on x86 */ __asm__("pushf\norl $0x40000,(%esp)\npopf"); # elif defined(__x86_64__) /* Enable Alignment

SIGBUS while doing memcpy from mmap ed buffer which is in RAM as identified by mincore

寵の児 提交于 2020-02-02 09:59:16
问题 I am mmapping a block as: mapAddr = mmap((void*) 0, curMapSize, PROT_NONE, MAP_LOCKED|MAP_SHARED, fd, curMapOffset); if this does not fail (mapAddr != MAP_FAILED) I query mincore as: err = mincore((char*) mapAddr, pageSize, &mincoreRet); to find out whether it is in RAM. In case it is in RAM (err == 0 && mincoreRet & 0x01) I mmap it again for reading as: copyAddr = mmap((void*) 0, curMapSize, PROT_READ, MAP_LOCKED|MAP_SHARED, fd, curMapOffset); and then I try to copy it out to my buffer as:

SIGBUS while doing memcpy from mmap ed buffer which is in RAM as identified by mincore

|▌冷眼眸甩不掉的悲伤 提交于 2020-02-02 09:54:39
问题 I am mmapping a block as: mapAddr = mmap((void*) 0, curMapSize, PROT_NONE, MAP_LOCKED|MAP_SHARED, fd, curMapOffset); if this does not fail (mapAddr != MAP_FAILED) I query mincore as: err = mincore((char*) mapAddr, pageSize, &mincoreRet); to find out whether it is in RAM. In case it is in RAM (err == 0 && mincoreRet & 0x01) I mmap it again for reading as: copyAddr = mmap((void*) 0, curMapSize, PROT_READ, MAP_LOCKED|MAP_SHARED, fd, curMapOffset); and then I try to copy it out to my buffer as:

Android Fatal Signal 7 (SIGBUS)

寵の児 提交于 2019-12-21 07:58:14
问题 I'm getting a few SIGBUS (7) and SIGSEGV (11) crashes that I am having difficult tracking down. The thread that appears to be causing the crash is primarily used for loading images to be displayed which makes sense since the logs indicate something failing with the SkJPEGImageDecoder. I re-use memory for Bitmaps in accordance with this guide Could it have something to do with that? LogCat output: 05-20 13:46:09.775: A/libc(419): Fatal signal 7 (SIGBUS) at 0x0000001e (code=1), thread 520

Structure assignment in Linux fails in ARM but succeeds in x86

只愿长相守 提交于 2019-12-19 09:49:26
问题 I've noticed something really strange. say I've got the following structure defined typedef struct { uint32_t a; uint16_t b; uint32_t c; } foo; This structure is contained in a big buffer I receive from network. The following code works in x86, but I receive SIGBUS on ARM. extern void * buffer; foo my_foo; my_foo = (( foo * ) buffer)[0]; replacing the pointer dereferencing with memcpy solved the issue. Searching about SIGBUS in ARM pointed me to the fact that this is related to memory

Diagnosing SIGBUS error on OS X Yosemite

懵懂的女人 提交于 2019-12-11 23:52:23
问题 I'm attempting to convert some code to run on OS X and having problems with some of the low-level memory writing code (which works on Linux/Windows platforms). Specifically the method being called is: void Dset_mem_write_i1B(void* ptr,int val) { unsigned char* p=(unsigned char*)ptr; *p=(val)&0xFF; } The relevant test code (GTest) is: TEST(DsetMemIoTest, test_write) { const char mem[4] = ""; void* vmem = (void*)mem; int mem_read = 0; int to_write = 0; to_write = 'a'; Dset_mem_write_i1B(vmem,

call stack shows SIGBUS, what does that mean

人盡茶涼 提交于 2019-12-11 05:17:59
问题 My call stack shows the following: --- called from signal handler with signal 10 (SIGBUS) --- 001301b8 allocate__t24__default_alloc_template2b0i0Ui (20, 20, 309940, 36, fc55 1a00, 0) + a4 0011dcb8 __nw__Q2t12basic_string3ZcZt18string_char_traits1ZcZt24__default_alloc _template2b0i0_3RepUiUi (10, 10, 7773e8, 0, 0, 0) + 14 0011dcf8 create__Q2t12basic_string3ZcZt18string_char_traits1ZcZt24__default_all oc_template2b0i0_3RepUi (a, a, 7773e8, a, 0, 0) + 24 0011e0bc replace__t12basic

R ffdfappend SIGBUS error

你说的曾经没有我的故事 提交于 2019-12-11 03:59:06
问题 I have an R script which uses the ffbase and ff packages. In Windows the script runs fine. In Linux (different box, higher RAM though) it crashes with a bus (SIGBUS) error. Windows (Version 6.1.7601) session info: R version 3.1.0 (2014-04-10) Platform: x86_64-w64-mingw32/x64 (64-bit) attached packages: ffbase_0.11.3 ff_2.2-13 bit_1.1-12 Linux (Linux xenja 3.5.0-54-generic #81~precise1-Ubuntu SMP Tue Jul 15 04:02:22 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux) session info: R version 3.1.1 (2014

SIGBUS while doing memcpy from mmap ed buffer which is in RAM as identified by mincore

丶灬走出姿态 提交于 2019-12-05 21:45:18
I am mmapping a block as: mapAddr = mmap((void*) 0, curMapSize, PROT_NONE, MAP_LOCKED|MAP_SHARED, fd, curMapOffset); if this does not fail (mapAddr != MAP_FAILED) I query mincore as: err = mincore((char*) mapAddr, pageSize, &mincoreRet); to find out whether it is in RAM. In case it is in RAM (err == 0 && mincoreRet & 0x01) I mmap it again for reading as: copyAddr = mmap((void*) 0, curMapSize, PROT_READ, MAP_LOCKED|MAP_SHARED, fd, curMapOffset); and then I try to copy it out to my buffer as: memcpy(data, copyAddr, pageSize); everything works fine except in the last memcpy once in a while I get