linux 段错误错误码为14是什么原因呢?

现在错误码是:
segfault at bfbdd69b ip 00000000bfbdd69b sp 00007fff77a5f368 error 14 in zero (deleted)[7f65bfbdd000+7a2000]

这是什么原因造成的呢,看到了错误码的定义但还是不太明白
/*

  • Page fault error code bits: *
  • bit 0 == 0: no page found 1: protection fault
  • bit 1 == 0: read access 1: write access
  • bit 2 == 0: kernel-mode access 1: user-mode access
  • bit 3 == 1: use of reserved bit detected
  • bit 4 == 1: fault was an instruction fetch
    */
    enum x86_pf_error_code {

    PF_PROT = 1 << 0,
    PF_WRITE = 1 << 1,
    PF_USER = 1 << 2,
    PF_RSVD = 1 << 3,
    PF_INSTR = 1 << 4,
    };
    有大佬能细讲一下吗?

执行这个addr2line -e main(你的代码文件名) bfbdd69b
你就找到问题了

Trap 为 0xe,即 14,也就是 Page Fault。

而 arch/x86/mm/fault.c 则详细解释了错误码(Error):

/*

  • Page fault error code bits: *
  • bit 0 == 0: no page found 1: protection fault
  • bit 1 == 0: read access 1: write access
  • bit 2 == 0: kernel-mode access 1: user-mode access
  • bit 3 == 1: use of reserved bit detected
  • bit 4 == 1: fault was an instruction fetch
    */
    enum x86_pf_error_code {

    PF_PROT         =               1 << 0,
    PF_WRITE        =               1 << 1,
    PF_USER         =               1 << 2,
    PF_RSVD         =               1 << 3,
    PF_INSTR        =               1 << 4,