سؤال

I'm working on an embedded ARM Linux system, and occasionally (but not always) I get a bus error in my app when the page at virtual address 0x2b200000 is accessed. Depending on whether the compiler/linker put code or data at that address, I either get the bus error when reading variables, or when an instruction is fetched from that page. After the bus error I cat /proc/self/maps and confirm that the page is indeed mapped for something valid in my process.

It does just seem to be that one page. Pages 0x2b201000 and 0x2b1ff000 are always ok (obviously there might be another bad address somewhere totally different and I just haven't happened to access it for anything).

I realise there are a million unknowns here, but was wondering if anyone could point me in some direction of investigation. The system has custom driver .kos that use physical memory that is reserved or hidden from the rest of the kernel, but I don't get how that affects virtual addresses.

Any nuggets of insight greatly appreciated.

هل كانت مفيدة؟

المحلول

Thanks for the help all. I found the issue - badly-behaved driver expecting certain user addresses to be 2MB-aligned. So eg if the valid mapped address was actually 0x2b3cc000, it would get incorrectly aligned to 0x2b200000, and trample over my app!

نصائح أخرى

Depending on your system you may have the same virtual->physical mapping. If you have another working device, I'd try running on that. That way you can immediately determine if it's a software or hardware problem.

Does the bus error happen when running user code or driver code?

You say the error doesn't always occur. When it happens with a particular build, does it always happens with that build or is it still sporadic?

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top