Bus error что значит

Что такое ошибка шины?

Что означает сообщение об ошибке шины и чем оно отличается от сегфоута?

В настоящее время ошибки шины встречаются редко на x86 и возникают, когда ваш процессор не может даже попытаться получить доступ к памяти, как правило:

Ошибки сегментации возникают при доступе к памяти, которая не принадлежит вашему процессу, они очень распространены и обычно являются результатом:

PS: если быть более точным, это не манипулирование самим указателем, который вызовет проблемы, это доступ к памяти, на которую он указывает (разыменование).

Ошибка шины пытается получить доступ к памяти, которая не может быть там. Вы использовали адрес, который не имеет смысла для системы, или неправильный адрес для этой операции.

mmap минимальный пример POSIX 7

«Ошибка шины» возникает, когда ядро ​​отправляет SIGBUS процесс.

Минимальный пример, который производит это, потому что ftruncate был забыт:

Протестировано в Ubuntu 14.04.

Доступ к неопределенной части объекта памяти.

Спецификация mmap говорит, что:

Ссылки в пределах диапазона адресов, начинающиеся с pa и продолжающиеся для длинных байтов до целых страниц после конца объекта, должны привести к доставке сигнала SIGBUS.

И shm_open говорит, что генерирует объекты размером 0:

Объект общей памяти имеет нулевой размер.

Таким образом, *map = 0 мы касаемся конца выделенного объекта.

Нераспределенный доступ к памяти стека в ARMv8 aarch64

Это было упомянуто в: Что такое ошибка шины? для SPARC, но здесь я приведу более воспроизводимый пример.

Все, что вам нужно, это отдельная программа aarch64:

К сожалению, я не могу воспроизвести его в пользовательском режиме QEMU v4.0.0, я не уверен почему.

Я полагаю, что ядро ​​вызывает SIGBUS, когда приложение демонстрирует смещение данных на шине данных. Я думаю, что, поскольку большинство [?] Современных компиляторов для большинства процессоров дополняют / выравнивают данные для программистов, проблемы выравнивания в прошлом (по крайней мере) смягчаются, и, следовательно, в наши дни SIGBUS не видят слишком часто (AFAIK).

Вы также можете получить SIGBUS, если по какой-то причине невозможно вставить кодовую страницу.

Один классический случай ошибки шины возникает в некоторых архитектурах, таких как SPARC (по крайней мере, некоторые SPARC, возможно, это было изменено), когда вы делаете неправильный доступ. Например:

Этот фрагмент кода пытается записать 32-разрядное целочисленное значение 0xdeadf00d в адрес, который (скорее всего) не выровнен должным образом, и сгенерирует ошибку шины на архитектурах, которые «разборчивы» в этом отношении. Intel x86, кстати, не такая архитектура, она позволила бы доступ (хотя и выполнял его медленнее).

Конкретный пример ошибки шины, с которой я только что столкнулся при программировании C на OS X:

В случае, если вы не помните, документы strcat добавляют второй аргумент к первому, изменяя первый аргумент (переверните аргументы, и все работает нормально). В Linux это дает ошибку сегментации (как и ожидалось), но в OS X это дает ошибку шины. Зачем? Я действительно не знаю.

Это зависит от вашей ОС, процессора, компилятора и, возможно, других факторов.

В общем, это означает, что шина ЦП не смогла выполнить команду или столкнулась с конфликтом, но это может означать целый ряд вещей, зависящих от среды и выполняемого кода.

Обычно это означает неприсоединенный доступ.

Я получал ошибку шины, когда корневой каталог был на 100%.

Я согласен со всеми ответами выше. Вот мои 2 цента относительно ошибки шины:

Ошибка BUS не должна возникать из инструкций в коде программы. Это может произойти, когда вы запускаете двоичный файл и во время выполнения двоичный файл изменяется (перезаписывается сборкой или удаляется и т. Д.).

Основная причина: это происходит потому, что ОС меняет страницы памяти, и в некоторых случаях двоичный файл может загружаться не полностью в память, и эти сбои происходят, когда ОС пытается извлечь следующую страницу из того же двоичного файла, но двоичный файл изменился с момента последнего прочитай это.

Заметили « непреднамеренное » использование переменной «i» в первом «цикле for»? Вот что в этом случае вызывает ошибку шины.

Я использую кросс-компилятор GCC ARM gnueabihf из Ubuntu 64 бит.

Типичное переполнение буфера, которое приводит к ошибке шины,

Здесь, если размер строки в двойных кавычках («») больше размера буфера, это дает ошибку шины.

Источник

What is a bus error? Is it different from a segmentation fault?

What does the «bus error» message mean, and how does it differ from a segmentation fault?

Bus error что значит. Смотреть фото Bus error что значит. Смотреть картинку Bus error что значит. Картинка про Bus error что значит. Фото Bus error что значит

18 Answers 18

Bus errors are rare nowadays on x86 and occur when your processor cannot even attempt the memory access requested, typically:

Segmentation faults occur when accessing memory which does not belong to your process. They are very common and are typically the result of:

PS: To be more precise, it is not manipulating the pointer itself that will cause issues. It’s accessing the memory it points to (dereferencing).

Bus error что значит. Смотреть фото Bus error что значит. Смотреть картинку Bus error что значит. Картинка про Bus error что значит. Фото Bus error что значит

A segfault is accessing memory that you’re not allowed to access. It’s read-only, you don’t have permission, etc.

A bus error is trying to access memory that can’t possibly be there. You’ve used an address that’s meaningless to the system, or the wrong kind of address for that operation.

mmap minimal POSIX 7 example

«Bus error» happens when the kernel sends SIGBUS to a process.

A minimal example that produces it because ftruncate was forgotten:

Tested in Ubuntu 14.04.

Access to an undefined portion of a memory object.

References within the address range starting at pa and continuing for len bytes to whole pages following the end of an object shall result in delivery of a SIGBUS signal.

And shm_open says that it generates objects of size 0:

The shared memory object has a size of zero.

So at *map = 0 we are touching past the end of the allocated object.

Unaligned stack memory accesses in ARMv8 aarch64

This was mentioned at: What is a bus error? for SPARC, but here I will provide a more reproducible example.

All you need is a freestanding aarch64 program:

That program then raises SIGBUS on Ubuntu 18.04 aarch64, Linux kernel 4.15.0 in a ThunderX2 server machine.

Unfortunately, I can’t reproduce it on QEMU v4.0.0 user mode, I’m not sure why.

The fault appears to be optional and controlled by the SCTLR_ELx.SA and SCTLR_EL1.SA0 fields, I have summarized the related docs a bit further here.

Bus error что значит. Смотреть фото Bus error что значит. Смотреть картинку Bus error что значит. Картинка про Bus error что значит. Фото Bus error что значит

I believe the kernel raises SIGBUS when an application exhibits data misalignment on the data bus. I think that since most[?] modern compilers for most processors pad / align the data for the programmers, the alignment troubles of yore (at least) mitigated, and hence one does not see SIGBUS too often these days (AFAIK).

On POSIX systems, you can also get the SIGBUS signal when a code page cannot be paged in for some reason.

Bus error что значит. Смотреть фото Bus error что значит. Смотреть картинку Bus error что значит. Картинка про Bus error что значит. Фото Bus error что значит

Bus error что значит. Смотреть фото Bus error что значит. Смотреть картинку Bus error что значит. Картинка про Bus error что значит. Фото Bus error что значит

I agree with all the answers above. Here are my 2 cents regarding the BUS error:

A BUS error need not arise from the instructions within the program’s code. This can happen when you are running a binary and during the execution, the binary is modified (overwritten by a build or deleted, etc.).

Verifying if this is the case

A simple way to check if this is the cause is by launching a couple of instances of the same binary form a build output directory, and running a build after they start. Both the running instances would crash with a SIGBUS error shortly after the build has finished and replaced the binary (the one that both the instances are currently running).

Underlying Reason

This is because OS swaps memory pages and in some cases, the binary might not be entirely loaded in memory. These crashes would occur when the OS tries to fetch the next page from the same binary, but the binary has changed since the last time it was read.

Bus error что значит. Смотреть фото Bus error что значит. Смотреть картинку Bus error что значит. Картинка про Bus error что значит. Фото Bus error что значит

One classic instance of a bus error is on certain architectures, such as the SPARC (at least some SPARCs, maybe this has been changed), is when you do a misaligned access. For instance:

This snippet tries to write the 32-bit integer value 0xdeadf00d to an address that is (most likely) not properly aligned, and will generate a bus error on architectures that are «picky» in this regard. The Intel x86 is, by the way, not such an architecture. It would allow the access (albeit execute it more slowly).

Bus error что значит. Смотреть фото Bus error что значит. Смотреть картинку Bus error что значит. Картинка про Bus error что значит. Фото Bus error что значит

A specific example of a bus error I just encountered while programming C on OS X:

In case you don’t remember the docs strcat appends the second argument to the first by changing the first argument(flip the arguments and it works fine). On linux this gives a segmentation fault(as expected), but on OS X it gives a bus error. Why? I really don’t know.

I was getting a bus error when the root directory was at 100%.

Bus error что значит. Смотреть фото Bus error что значит. Смотреть картинку Bus error что значит. Картинка про Bus error что значит. Фото Bus error что значит

It normally means an un-aligned access.

An attempt to access memory that isn’t physically present would also give a bus error, but you won’t see this if you’re using a processor with an MMU and an OS that’s not buggy, because you won’t have any non-existent memory mapped to your process’s address space.

It depends on your OS, CPU, compiler, and possibly other factors.

In general, it means the CPU bus could not complete a command, or suffered a conflict, but that could mean a whole range of things, depending on the environment and code being run.

Bus error что значит. Смотреть фото Bus error что значит. Смотреть картинку Bus error что значит. Картинка про Bus error что значит. Фото Bus error что значит

My reason for bus error on Mac OS X was that I tried to allocate about 1Mb on the stack. This worked well in one thread, but when using openMP this drives to bus error, because Mac OS X has very limited stack size for non-main threads.

Firstly SIGBUS and SIGSEGV are not a specific type of error but are groups or families of errors. This is why you typically see a signal number(si_no) and a signal code(si_code).

They also depend on the os and architecture as to what can cause them exactly.

Источник

bus error

ошибка на шине
Ошибка в электронном канале или устройстве, передающем сигналы от одной части компьютера к другой.
[http://www.lexikon.ru/dict/net/index.html]

Тематики

Смотреть что такое «bus error» в других словарях:

Bus error — In computing, a bus error is generally an attempt to access memory that the CPU cannot physically address. Bus errors can also be caused by any general device fault that the computer detects. A bus error rarely means that computer hardware is… … Wikipedia

Bus CAN — CAN (acrónimo del inglés Controller Area Network) es un protocolo de comunicaciones desarrollado por la firma alemana Robert Bosch GmbH, basado en una topología bus para la transmisión de mensajes en entornos distribuidos. Además ofrece una… … Wikipedia Español

Bus analyzer — A bus analyzer is a computer bus analysis tool, often a combination of hardware and software, used during development of hardware or device drivers for a specific bus, diagnosing bus or device failures, or reverse engineering. A bus analyzer is a … Wikipedia

CAN-Bus — CAN Logo Der CAN Bus (Controller Area Network) ist ein asynchrones, serielles Bussystem und gehört zu den Feldbussen. Um die Kabelbäume (bis zu 2 km pro Fahrzeug) zu reduzieren und dadurch Gewicht zu sparen, wurde der CAN Bus 1983 von Bosch für… … Deutsch Wikipedia

CAN Bus — CAN Logo Der CAN Bus (Controller Area Network) ist ein asynchrones, serielles Bussystem und gehört zu den Feldbussen. Um die Kabelbäume (bis zu 2 km pro Fahrzeug) zu reduzieren und dadurch Gewicht zu sparen, wurde der CAN Bus 1983 von Bosch für… … Deutsch Wikipedia

Can-bus — CAN Logo Der CAN Bus (Controller Area Network) ist ein asynchrones, serielles Bussystem und gehört zu den Feldbussen. Um die Kabelbäume (bis zu 2 km pro Fahrzeug) zu reduzieren und dadurch Gewicht zu sparen, wurde der CAN Bus 1983 von Bosch für… … Deutsch Wikipedia

Newport (Isle of Wight) bus station — For other uses, see Newport station. Newport Bus Station Location Loc … Wikipedia

PCI-Bus — Ein PCI Steckplatz (32 Bit) 64 Bit PCI X Steckplätze. Peripheral Component Interconnect, meist PCI abgekürzt, ist ein Bus Standard zur Verbindung von Peripheriegeräten mit dem … Deutsch Wikipedia

Front side bus — In personal computers, the Front Side Bus (FSB) is the bus that carries data between the CPU and the northbridge.Depending on the processor used, some computers may also have a back side bus which connects the CPU to the cache. This bus and the… … Wikipedia

LIN-Bus — LIN Logo Das Local Interconnect Network (LIN) gehört zu den Feldbussen und wurde speziell für die kostengünstige Kommunikation von intelligenten Sensoren und Aktuatoren in Kraftfahrzeugen entwickelt. Typische Anwendungsbeispiele sind die… … Deutsch Wikipedia

LIN Bus — LIN Logo Das Local Interconnect Network (LIN) gehört zu den Feldbussen und wurde speziell für die kostengünstige Kommunikation von intelligenten Sensoren und Aktuatoren in Kraftfahrzeugen entwickelt. Typische Anwendungsbeispiele sind die… … Deutsch Wikipedia

Источник

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *