Date Tags Gentoo

On Hardened Gentoo Linux usb_inst.sh script fails because it attempts to run binaries which use RWX mmap and thus they are killed by the kernel due to PaX mprotect:

/mnt/iso # bash ./usb_inst.sh 
Device [/dev/sde] detected as [ Patriot Memory ] is removable and size=15258MB
* Device [/dev/sde] is not mounted
PROT_EXEC|PROT_WRITE failed.
PROT_EXEC|PROT_WRITE failed.

To work around this we need to run paxctl-ng -m on a few binaries:

--- /tmp/usb_inst.sh   2014-06-22 18:33:26.000000000 -0700
+++ /mnt/cdrom/usb_inst.sh  2013-03-24 11:53:05.000000000 -0700
@@ -565,6 +565,9 @@
         PROG_MKVFATFS="${TMPDIR}/mkfs.vfat"
         PROG_SYSLINUX="${TMPDIR}/syslinux"
         PROG_DIALOG="${TMPDIR}/dialog"
+        paxctl-ng -m ${PROG_DIALOG}
+        paxctl-ng -m ${PROG_INSTMBR}
+        paxctl-ng -m ${PROG_MKVFATFS}
         # syslinux requires mtools
         ln -s mtools ${TMPDIR}/mcopy
         ln -s mtools ${TMPDIR}/mmove

Either patch the script in place ( mount RW first ), or copy the script to e.g. /tmp:

/mnt/iso # bash -c '. /tmp/usb_inst.sh' usb_inst.sh