Linux X86 Bus Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and sigbus error linux policies of this site About Us Learn more about Stack Overflow the
Bus Error C++
company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags
Linux Bus Error Core Dumped
Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes
Bus Error Vs Segmentation Fault
a minute: Sign up What is a bus error? up vote 156 down vote favorite 49 What does the "bus error" message mean, and how does it differ from a segfault? c unix segmentation-fault bus-error share|improve this question edited Oct 18 '15 at 10:44 Cool Guy 15.7k51952 asked Oct 17 '08 at 14:48 raldi 7,272216178 add a comment| 15 Answers 15 how to solve bus error in linux active oldest votes up vote 151 down vote accepted Bus errors are rare nowadays on x86 and occur when your processor cannot even attempt the memory access requested, typically: using a processor instruction with an address that does not satisfy its alignment requirements. Segmentation faults occur when accessing memory which does not belong to your process, they are very common and are typically the result of: using a pointer to something that was deallocated. using an uninitialized hence bogus pointer. using a null pointer. overflowing a buffer. PS: To be more precise this is not manipulating the pointer itself that will cause issues, it's accessing the memory it points to (dereferencing). share|improve this answer edited Oct 17 '08 at 15:18 answered Oct 17 '08 at 15:12 bltxd 5,72322336 52 They aren't rare; I'm just at Exercise 9 from How to Learn C the Hard Way and already encountered one... –11684 Mar 26 '13 at 20:12 5 Another cause of bus errors (on Linux anyway) is when the operating system can't back a virtual page with physical memory (e.g. low-mem
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more how to debug bus error about Stack Overflow the company Business Learn more about hiring developers or posting ads bus error 10 mac with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow sigbus vs sigsegv is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up When does memory load cause bus error on x86-64 linux? up vote 3 http://stackoverflow.com/questions/212466/what-is-a-bus-error down vote favorite I used to think that x86-64 supports unaligned memory access and invalid memory access always causes segmentation fault (except, perhaps, SIMD instructions like movdqa or movaps). Nevertheless recently I observed bus error with normal mov instruction. Here is a reproducer: void test(void *a) { asm("mov %0, %%rbp\n\t" "mov 0(%%rbp), %%rdx\n\t" : : "r"(a) : "rbp", "rdx"); } int main() { test((void *)0x706a2e3630332d69); return 0; } (must http://stackoverflow.com/questions/35010654/when-does-memory-load-cause-bus-error-on-x86-64-linux be compiled with frame pointer omission, e.g. gcc -O test.c && ./a.out). mov 0(%rbp), %rdx instruction and the address 0x706a2e3630332d69 were copied from a coredump of the buggy program. Changing it to 0 causes segfault, but just aligning to 0x706a2e3630332d60 is still bus error (my guess is that it is related to the fact that address space is 48-bit on x86-64). The question is: which addresses cause bus error (SIGBUS)? Is it determined by architecture or configured by OS kernel (i.e. in page table, control registers or something similar)? c linux assembly x86 share|improve this question asked Jan 26 at 9:32 Mikhail Maltsev 859212 This doesn't take ASLR into account. The address may not be meaningful between executions. –Brett Hale Jan 26 at 17:07 add a comment| 2 Answers 2 active oldest votes up vote 5 down vote accepted SIGBUS is in a sad state. There's no consensus between different operating systems what it should mean and when it is generated varies wildly between operating systems, cpu architectures, configuration and the phase of the moon. Unless you work with a very specific configuration you should just treat it "just like SIGSEGV, but different". I suspect that originally it was supposed to mean "you tried a
challenged and removed. (July 2015) (Learn how and when to remove this template message) In computing, a bus error is a fault raised by hardware, notifying an operating system (OS) that a process is trying to access memory that the CPU cannot physically address: https://en.wikipedia.org/wiki/Bus_error an invalid address for the address bus, hence the name. In modern use on most http://orchistro.tistory.com/206 architectures these are much rarer than segmentation faults, which occur primarily due to memory access violations: problems in the logical address or permissions. On POSIX-compliant platforms, bus errors usually result in the SIGBUS signal being sent to the process that caused the error. SIGBUS can also be caused by any general device fault that the computer detects, though a bus error bus error rarely means that the computer hardware is physically broken—it is normally caused by a bug in a program's source code.[citation needed] Bus errors may also be raised for certain other paging errors; see below. Contents 1 Causes 1.1 Non-existent address 1.2 Unaligned access 1.3 Paging errors 2 Example 3 References Causes[edit] There are at least three main causes of bus errors: Non-existent address[edit] Software instructs the CPU to read or write a specific physical memory address. linux x86 bus Accordingly, the CPU sets this physical address on its address bus and requests all other hardware connected to the CPU to respond with the results, if they answer for this specific address. If no other hardware responds, the CPU raises an exception, stating that the requested physical address is unrecognized by the whole computer system. Note that this only covers physical memory addresses. Trying to access an undefined virtual memory address is generally considered to be a segmentation fault rather than a bus error, though if the MMU is separate, the processor can't tell the difference. Unaligned access[edit] Most CPUs are byte-addressable, where each unique memory address refers to an 8-bit byte. Most CPUs can access individual bytes from each memory address, but they generally cannot access larger units (16 bits, 32 bits, 64 bits and so on) without these units being "aligned" to a specific boundary (the x86 platform being a notable exception). For example, if multi-byte accesses must be 16 bit-aligned, addresses (given in bytes) at 0, 2, 4, 6, and so on would be considered aligned and therefore accessible, while addresses 1, 3, 5, and so on would be considered unaligned. Similarly, if multi-byte accesses must be 32-bit aligned, addresses 0, 4, 8, 12, and so on would be considered aligned and therefore accessible, and all addresses in between would be considered
(6) NBC Meet the Press (4) Computing (81) vim tips (12) Books (8) 아니메, 드라마 (18) 잡동사니 (24) 여행 (9) 사진기 (3) Australia (5) English Writings (0) 메모 (6) Swing (0) Total : 283,753Today : 103Yesterday : 152 How to generate SIGBUS on x86 processors Computing 2011.05.15 01:54 TOC 0. No SIGBUS on x86?! 1. Why? 2. How to tell x86 to warn me an unaligned memory acess? 3. So, what? - A real world application 4. Possible worry 5. When programming for Intel's CPUs, no need to care about alignment? 0. No SIGBUS on x86?! According to wikipedia, there are two cases where a processor generates bus error: 1. non-existent address 2. unaligned memory access. Strangely, you may have never seen such an error on x86 processors. Compile following code and run it on a x86 machine: #include