开发者

trap invalid opcode rip rsp

开发者 https://www.devze.com 2023-01-17 10:40 出处:网络
We see a couple of below mentioned messages in /var/log/messages for one of our application: Sep 18 03:24:23 <machine_name> kernel: application_name[14682] trap invalid opcode rip:f6c6e3ce rsp:

We see a couple of below mentioned messages in /var/log/messages for one of our application:

Sep 18 03:24:23 <machine_name> kernel: application_name[14682] trap invalid opcode rip:f6c6e3ce rsp:ffc366bc error:0
...
Sep 18 03:19:35 <machine_name> kernel: application_name[4434] general protection rip:f6cd43a2 rsp:ffdfab0c error:7b2

I am not able to make what’s these output means a开发者_如何学Pythonnd how we can track the function / code that is causing the issue. Further what is 'trap invalid opcode' and 'general protection' means?


Usually that means that your program's instruction pointer points to data or garbage. That's commonly caused by writing to stray pointers and such.

One scenario would be that your code writes (through a stray pointer) over some class' virtual table, replacing the member function addresses with nonsense. The next time you call one of the class' virtual functions, your program will interpret the garbage as an address and jump to that address. If whatever data lies at this address happens to not to be a valid machine code instruction for your processor, you would see this error.


There is another possibility that can cause 'invalid' op codes, that would be hardware not supporting newer opcode/instruction sets(SSE 4/5) or it not being from the right manufacturer(both AMD and Intel have some specific opcodes that work only on their processors) or just not having permission to exectute certain ops(though this would probably show up as something else).

From the above I would take RIP to be 'register(?) instruction pointer' and RSP to be 'register stack pointer', in which case you could use a debugger and set an execution hardware breakpoint on the specified address(RIP) and trace back what is calling it.(it seems your using linux or unix, so this is quite vague). if you are on windows, try using a custom exception filter to capture the EXCEPTION_ILLEGAL_INSTRUCTION event to get a little more information

0

精彩评论

暂无评论...
验证码 换一张
取 消