':class:`bool`: Whether the current binary uses NX protections.
Specifically, we are checking for ``READ_IMPLIES_EXEC`` being set
by the kernel, as a result of honoring ``PT_GNU_STACK`` in the kernel.
The **Linux kernel** directly honors ``PT_GNU_STACK`` to `mark the
stack as executable.`__
.. __: https://github.com/torvalds/linux/blob/v4.9/fs/binfmt_elf.c#L784-L789
.. code-block:: c
case PT_GNU_STACK:
if (elf_ppnt->p_flags & PF_X)
executable_stack = EXSTACK_ENABLE_X;
else
executable_stack = EXSTACK_DISABLE_X;
break;
Additionally, it then sets ``read_implies_exec``, so that `all readable pages
are executable`__.
.. __: https://github.com/torvalds/linux/blob/v4.9/fs/binfmt_elf.c#L849-L850
.. code-block:: c
if (elf_read_implies_exec(loc->elf_ex, executable_stack))
current->personality |= READ_IMPLIES_EXEC;'

@property
def nx(self):

    if (not self.executable):
        return True
    for seg in self.iter_segments_by_type('GNU_STACK'):
        return (not bool((seg.header.p_flags & P_FLAGS.PF_X)))
    return False
