Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 592856 - dev-java/oracle-jdk-bin: PaX marking no longer effective since eclass stopped creating header
Summary: dev-java/oracle-jdk-bin: PaX marking no longer effective since eclass stopped...
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: The Gentoo Linux Hardened Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-04 09:13 UTC by Chris Henhawke
Modified: 2017-01-23 22:54 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Henhawke 2016-09-04 09:13:58 UTC
Trying to do a system update, and I'm getting stuck on updating the JDK.

Possibly hardened related, as the machine runs hardened 4.3.4.

(snip)
 * PT_PAX marking -m /var/tmp/portage/dev-java/oracle-jdk-bin-1.8.0.102/image/opt/oracle-jdk-bin-1.8.0.102/jre/bin/pack200 with paxctl-ng
 * PT_PAX marking -m /var/tmp/portage/dev-java/oracle-jdk-bin-1.8.0.102/image/opt/oracle-jdk-bin-1.8.0.102/jre/bin/policytool with paxctl
 * PT_PAX marking -m /var/tmp/portage/dev-java/oracle-jdk-bin-1.8.0.102/image/opt/oracle-jdk-bin-1.8.0.102/jre/bin/policytool with paxctl-ng
 * PT_PAX marking -m /var/tmp/portage/dev-java/oracle-jdk-bin-1.8.0.102/image/opt/oracle-jdk-bin-1.8.0.102/jre/bin/rmid with paxctl
 * PT_PAX marking -m /var/tmp/portage/dev-java/oracle-jdk-bin-1.8.0.102/image/opt/oracle-jdk-bin-1.8.0.102/jre/bin/rmid with paxctl-ng
 * PT_PAX marking -m /var/tmp/portage/dev-java/oracle-jdk-bin-1.8.0.102/image/opt/oracle-jdk-bin-1.8.0.102/jre/bin/rmiregistry with paxctl
 * PT_PAX marking -m /var/tmp/portage/dev-java/oracle-jdk-bin-1.8.0.102/image/opt/oracle-jdk-bin-1.8.0.102/jre/bin/rmiregistry with paxctl-ng
 * PT_PAX marking -m /var/tmp/portage/dev-java/oracle-jdk-bin-1.8.0.102/image/opt/oracle-jdk-bin-1.8.0.102/jre/bin/servertool with paxctl
 * PT_PAX marking -m /var/tmp/portage/dev-java/oracle-jdk-bin-1.8.0.102/image/opt/oracle-jdk-bin-1.8.0.102/jre/bin/servertool with paxctl-ng
 * PT_PAX marking -m /var/tmp/portage/dev-java/oracle-jdk-bin-1.8.0.102/image/opt/oracle-jdk-bin-1.8.0.102/jre/bin/tnameserv with paxctl
 * PT_PAX marking -m /var/tmp/portage/dev-java/oracle-jdk-bin-1.8.0.102/image/opt/oracle-jdk-bin-1.8.0.102/jre/bin/tnameserv with paxctl-ng
 * PT_PAX marking -m /var/tmp/portage/dev-java/oracle-jdk-bin-1.8.0.102/image/opt/oracle-jdk-bin-1.8.0.102/jre/bin/unpack200 with paxctl
 * PT_PAX marking -m /var/tmp/portage/dev-java/oracle-jdk-bin-1.8.0.102/image/opt/oracle-jdk-bin-1.8.0.102/jre/bin/unpack200 with paxctl-ng
 * Creating the Class Data Sharing archives
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000036125000000, 2555904, 1) failed; error='Operation not permitted' (errno=1)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 2555904 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /var/tmp/portage/dev-java/oracle-jdk-bin-1.8.0.102/work/jdk/hs_err_pid6536.log
 * ERROR: dev-java/oracle-jdk-bin-1.8.0.102::gentoo failed (install phase):
 *   (no error message)
 *
 * Call stack:
 *     ebuild.sh, line 133:  Called src_install
 *   environment, line 2580:  Called die
 * The specific snippet of code:
 *               ${ddest}/bin/java -server -Xshare:dump || die
 *

Memory is certainly available, and ZFS arc can also be evicted to free up even more memory (roughly 14gb)

bloomfield ~ # free -m
              total        used        free      shared  buff/cache   available
Mem:          24154       15980        2696          21        5478        3308
Swap:          4095           0        4095


bloomfield ~ # arcstat.py 1
    time  read  miss  miss%  dmis  dm%  pmis  pm%  mmis  mm%  arcsz     c
05:08:50     0     0      0     0    0     0    0     0    0    14G   16G

Thanks
Comment 1 James Le Cuirot gentoo-dev 2016-09-05 20:16:46 UTC
emerge --info please.
Comment 2 Francisco Blas Izquierdo Riera (RETIRED) gentoo-dev 2016-09-05 20:33:54 UTC
Just to make sure you aren't missing a common mistake make sure you have PAX_PT_PAX_FLAGS (and only that i.e. not PAX_XATTR_PAX_FLAGS) enabled on the kernel.

If you want to use XATTR markings instead you can follow blueness' guide at https://wiki.gentoo.org/wiki/Hardened/PaX_flag_migration_from_PT_PAX_to_XATTR_PAX
Comment 3 Chris Henhawke 2016-09-05 22:57:31 UTC
bloomfield ~ # emerge --info
Portage 2.2.28 (python 3.4.3-final-0, hardened/linux/amd64, gcc-4.9.3, glibc-2.22-r4, 4.3.4-hardened x86_64)
=================================================================
System uname: Linux-4.3.4-hardened-x86_64-Intel-R-_Core-TM-_i7_CPU_920_@_2.67GHz-with-gentoo-2.2
KiB Mem:    24734280 total,   2910544 free
KiB Swap:    4194300 total,   4194300 free
Timestamp of repository gentoo: Mon, 05 Sep 2016 04:15:01 +0000
sh bash 4.3_p42-r1
ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1
distcc 3.2rc1 x86_64-pc-linux-gnu [disabled]
app-shells/bash:          4.3_p42-r1::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.20.2::gentoo
dev-lang/python:          2.7.10-r1::gentoo, 3.4.3-r1::gentoo
dev-util/cmake:           3.5.2-r1::gentoo
dev-util/pkgconfig:       0.28-r2::gentoo
sys-apps/baselayout:      2.2::gentoo
sys-apps/openrc:          0.21.3::gentoo
sys-apps/sandbox:         2.10-r1::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69::gentoo
sys-devel/automake:       1.11.6-r1::gentoo, 1.13.4::gentoo, 1.14.1::gentoo, 1.15::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo
sys-devel/gcc:            4.4.6-r1::gentoo, 4.5.4::gentoo, 4.6.4::gentoo, 4.8.3::gentoo, 4.9.3::gentoo
sys-devel/gcc-config:     1.7.3::gentoo
sys-devel/libtool:        2.4.6::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 4.3::gentoo (virtual/os-headers)
sys-libs/glibc:           2.22-r4::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://mirrors.tera-byte.com/gentoo-portage/
    priority: -1000

x-portage
    location: /usr/local/portage
    masters: gentoo
    priority: 0

Installed sets: @zfs
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA dlj-1.1 Oracle-BCLA-JavaSE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=nehalem"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt /var/bind /var/spool/munin-async/.ssh"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.6/ext-active/ /etc/php/cgi-php5.6/ext-active/ /etc/php/cli-php5.
6/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -march=nehalem"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-lo
gs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://gentoo.mirrors.tera-byte.com/"
LANG="en_CA.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j1"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=
/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="acl aim amd64 apache2 berkdb bzip2 cacert cli client-only cracklib crypt cxx dedicated dri gadu gdbm hardened iconv icq imap irc jabber java justify lj mmx mmxext modules msn multilib ncurses 
net nls nptl openmp pam pax_kernel pcre pie qq quota readline rpc rss ruby seccomp session slang sse sse2 ssl ssp tcl unicode urandom vhosts xattr xtpax yahoo zlib" ABI_X86="64" ALSA_CARDS="ali5451
 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="
authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_use
r autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite se
tenvif speling status unique_id userdir usertrack vhost_alias" APACHE2_MPMS="prefork" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLE
CTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv1
8 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="ke
yboard mouse evdev" KERNEL="linux" L10N="en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGU
AS="en en_US en_CA en_UTF-8" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby20 ruby21" USERLAND="GNU" VIDEO_CARDS="amdgpu fbdev intel nouveau radeon radeonsi vesa dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal
 rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

bloomfield ~ # zgrep PAX /proc/config.gz                                                                                                                                                             
CONFIG_PAX_KERNEXEC_PLUGIN=y
CONFIG_PAX_PER_CPU_PGD=y
CONFIG_PAX_USERCOPY_SLABS=y
CONFIG_PAX=y
# CONFIG_PAX_SOFTMODE is not set
CONFIG_PAX_PT_PAX_FLAGS=y
# CONFIG_PAX_XATTR_PAX_FLAGS is not set
CONFIG_PAX_NO_ACL_FLAGS=y
# CONFIG_PAX_HAVE_ACL_FLAGS is not set
# CONFIG_PAX_HOOK_ACL_FLAGS is not set
CONFIG_PAX_NOEXEC=y
CONFIG_PAX_PAGEEXEC=y
CONFIG_PAX_EMUTRAMP=y
CONFIG_PAX_MPROTECT=y
# CONFIG_PAX_MPROTECT_COMPAT is not set
CONFIG_PAX_ELFRELOCS=y
CONFIG_PAX_KERNEXEC=y
CONFIG_PAX_KERNEXEC_PLUGIN_METHOD_BTS=y
# CONFIG_PAX_KERNEXEC_PLUGIN_METHOD_OR is not set
CONFIG_PAX_KERNEXEC_PLUGIN_METHOD="bts"
CONFIG_PAX_ASLR=y
CONFIG_PAX_RANDKSTACK=y
CONFIG_PAX_RANDUSTACK=y
CONFIG_PAX_RANDMMAP=y
# CONFIG_PAX_MEMORY_SANITIZE is not set
# CONFIG_PAX_MEMORY_STACKLEAK is not set
# CONFIG_PAX_MEMORY_STRUCTLEAK is not set
# CONFIG_PAX_MEMORY_UDEREF is not set
# CONFIG_PAX_REFCOUNT is not set
CONFIG_PAX_CONSTIFY_PLUGIN=y
# CONFIG_PAX_USERCOPY is not set
# CONFIG_PAX_SIZE_OVERFLOW is not set
# CONFIG_PAX_LATENT_ENTROPY is not set
Comment 4 James Le Cuirot gentoo-dev 2016-11-04 21:21:51 UTC
Attention blueness! Way back in bug #427642, you told us to pass the C argument to pax-mark in order for marking to be effective on Oracle's binaries. A year later, the C option was stripped out and we didn't notice but it didn't matter because it then attempted to create the header when necessary anyway. However more recently, in bug #590422, you stopped doing this because it sometimes corrupts ELFs.

What are our options? The Oracle ebuilds already note that scanelf doesn't work. Based on the output above, I guess paxctl-ng doesn't either. I think the easiest solution would be to stop stripping the flag so that java-vm-2.eclass can pass the flag like it used to. There would not be any corruption on Oracle's binaries, right?

I haven't reproduced this as such but Chainsaw reported it to me and he helped to diagnose it a little further.
Comment 5 James Le Cuirot gentoo-dev 2017-01-23 22:54:46 UTC
blueness has told me that PT marking is no longer supported so this will not be fixed. Please migrate to XATTR marking.

https://wiki.gentoo.org/wiki/Hardened/PaX_flag_migration_from_PT_PAX_to_XATTR_PAX