Stack Clash fix breaks JVM when launched from C

Bug #1700270 reported by Kim Nguyễn
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

I have tested only with linux 4.10.0-24-generic on amd64. The attached repro case:

- compiles a java class
- compiles a C program that initialises the JVM and calls a static method from the java class
- launch the compiled C program.

Expected result:
the c program should execute the Java method and print some numbers in the terminal

Actual result:
the c program segfaults while initialising the JVM

reverting to linux 4.10.0-22-generic amd64 fixes the problem. Since the only change in the changelog is the Stack Clash fix and since I remember reading that the JVM does tricky stuff with the stack, this is a natural culprit.

It touches any program that initialises a JVM (so for instance Java bindings in Postgresql or Java applets in firefox although the latter have been deprecated and are only supported in firefox ESR now).

I attach the repro-case.
The issue happens with both openjdk-8-jdk from the repository and the standard jdk 8 from oracle.

[note: edited after initial submission to fix some typos]

---
ApportVersion: 2.20.4-0ubuntu4.1
Architecture: amd64
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC0: kim 1928 F.... pulseaudio
 /dev/snd/controlC1: kim 1928 F.... pulseaudio
CurrentDesktop: Unity:Unity7
DistroRelease: Ubuntu 17.04
EcryptfsInUse: Yes
HibernationDevice: RESUME=UUID=4d246142-b56c-4cc6-b9cf-dad9c592bca0
InstallationDate: Installed on 2016-10-19 (248 days ago)
InstallationMedia: Ubuntu 16.10 "Yakkety Yak" - Release amd64 (20161012.2)
MachineType: Hewlett-Packard HP EliteBook 820 G2
Package: linux (not installed)
ProcFB: 0 inteldrmfb
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-4.10.0-22-generic.efi.signed root=UUID=de40f805-aa69-464b-8c59-022276f8b381 ro resume=UUID=4d246142-b56c-4cc6-b9cf-dad9c592bca0 i915.enable_rc6=7 i915.enable_dc=2 i915.enable_psr=1 quiet splash
ProcVersionSignature: Ubuntu 4.10.0-22.24-generic 4.10.15
RelatedPackageVersions:
 linux-restricted-modules-4.10.0-22-generic N/A
 linux-backports-modules-4.10.0-22-generic N/A
 linux-firmware 1.164.1
Tags: zesty
Uname: Linux 4.10.0-22-generic x86_64
UnreportableReason: The report belongs to a package that is not installed.
UpgradeStatus: Upgraded to zesty on 2017-06-23 (1 days ago)
UserGroups: adm cdrom dip lpadmin plugdev sambashare src sudo vboxusers
_MarkForUpload: False
dmi.bios.date: 04/10/2017
dmi.bios.vendor: Hewlett-Packard
dmi.bios.version: M71 Ver. 01.19
dmi.board.name: 225A
dmi.board.vendor: Hewlett-Packard
dmi.board.version: KBC Version 96.5B
dmi.chassis.asset.tag: 5CG52931PR
dmi.chassis.type: 10
dmi.chassis.vendor: Hewlett-Packard
dmi.modalias: dmi:bvnHewlett-Packard:bvrM71Ver.01.19:bd04/10/2017:svnHewlett-Packard:pnHPEliteBook820G2:pvrA3008E510003:rvnHewlett-Packard:rn225A:rvrKBCVersion96.5B:cvnHewlett-Packard:ct10:cvr:
dmi.product.name: HP EliteBook 820 G2
dmi.product.version: A3008E510003
dmi.sys.vendor: Hewlett-Packard

CVE References

Revision history for this message
Kim Nguyễn (kim.nguyen) wrote :
Revision history for this message
Kim Nguyễn (kim.nguyen) wrote :
Revision history for this message
Kim Nguyễn (kim.nguyen) wrote :
Revision history for this message
Kim Nguyễn (kim.nguyen) wrote :

I forgot to mention that I'm on Zesty 17.04, but I have reports from colleague saying this also happens on 16.04 and 16.10.

Revision history for this message
Joseph Salisbury (jsalisbury) wrote : Missing required logs.

This bug is missing log files that will aid in diagnosing the problem. While running an Ubuntu kernel (not a mainline or third-party kernel) please enter the following command in a terminal window:

apport-collect 1700270

and then change the status of the bug to 'Confirmed'.

If, due to the nature of the issue you have encountered, you are unable to run this command, please add a comment stating that fact and change the bug status to 'Confirmed'.

This change has been made by an automated script, maintained by the Ubuntu Kernel Team.

Changed in linux (Ubuntu):
status: New → Incomplete
tags: added: zesty
Revision history for this message
Kim Nguyễn (kim.nguyen) wrote : AlsaInfo.txt

apport information

tags: added: apport-collected
description: updated
Revision history for this message
Kim Nguyễn (kim.nguyen) wrote : CRDA.txt

apport information

Revision history for this message
Kim Nguyễn (kim.nguyen) wrote : CurrentDmesg.txt

apport information

Revision history for this message
Kim Nguyễn (kim.nguyen) wrote : IwConfig.txt

apport information

Revision history for this message
Kim Nguyễn (kim.nguyen) wrote : JournalErrors.txt

apport information

Revision history for this message
Kim Nguyễn (kim.nguyen) wrote : Lspci.txt

apport information

Revision history for this message
Kim Nguyễn (kim.nguyen) wrote : Lsusb.txt

apport information

Revision history for this message
Kim Nguyễn (kim.nguyen) wrote : ProcCpuinfoMinimal.txt

apport information

Revision history for this message
Kim Nguyễn (kim.nguyen) wrote : ProcEnviron.txt

apport information

Revision history for this message
Kim Nguyễn (kim.nguyen) wrote : ProcInterrupts.txt

apport information

Revision history for this message
Kim Nguyễn (kim.nguyen) wrote : ProcModules.txt

apport information

Revision history for this message
Kim Nguyễn (kim.nguyen) wrote : PulseList.txt

apport information

Revision history for this message
Kim Nguyễn (kim.nguyen) wrote : RfKill.txt

apport information

Revision history for this message
Kim Nguyễn (kim.nguyen) wrote : UdevDb.txt

apport information

Revision history for this message
Kim Nguyễn (kim.nguyen) wrote : WifiSyslog.txt

apport information

Changed in linux (Ubuntu):
status: Incomplete → Confirmed
description: updated
Revision history for this message
Rostislav Stříbrný (rstribrn) wrote :

THIS COMMENT ALSO ADDED TO (PARENT) BUG
    https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1699772

However, that bug has FixReleased (at least for 64-bit JVMs). I guess it should be also fixed for 32-bit JVMs launched from C on 64-bit kernel.

I'm not sure, whether it would be better adding this comment just to Bug 1699772, or just to this ("duplicate") Bug 1700270, or creating just another bug ID.
I have chosen adding it to Bug 1699772 and also here, since my code example is based on previously-provided test.c which I downloaded from Bug 1700270.

ORIGINAL COMMENT:

Rostislav Stříbrný (rstribrn) wrote 2 hours ago:
Hi,
problem still present on linux-image-4.8.0-58-generic with these conditions:
    - while executing JVM launched from >>32-bit<< C (on 64-bit kernel)
    - defining "higher" JVM stack size (eg. -Xss2048k JVM argument)

=> causes JVM segmentation fault

Attached test case (sources + binary + output logs): Bug1699772_i386_jvm_segfault_problem.tgz
test_case1.c (32-bit) => using -Xss1024k => RUNS OK.
test_case2.c (32-bit) => using -Xss2048k => Segmentation fault.
test_case1.c (64-bit) => using -Xss1024k => RUNS OK.
test_case2.c (64-bit) => using -Xss2048k => RUNS OK.

My system:
cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.2 LTS"

with linux-generic-hwe-16.04

uname -a
Linux L34001100621 4.8.0-58-generic #63~16.04.1-Ubuntu SMP Mon Jun 26 18:08:51 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Revision history for this message
Rostislav Stříbrný (rstribrn) wrote :
tags: added: id-599af6610f9a304e95fd9796
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.