RFR: 8343618: Stack smashing in awt_InputMethod.c on Linux s390x
Zdenek Zambersky
zzambers at openjdk.org
Mon Mar 24 13:46:16 UTC 2025
This fixes stack smashing issue in awt library on linux s390x. (jdk compiled with `-fstack-protector-strong`)
Fix is based on [patch](https://mail.openjdk.org/pipermail/awt-dev/2019-July/015337.html) submitted in JDK-8227919 review thread, rebased to master. They decided to go for Solaris only fix there, with [expected follow-up](https://mail.openjdk.org/pipermail/awt-dev/2019-July/015347.html) for linux/s390x. But that never happened.
I was not able to get response from original author for this issue, so I am creating PR myself.
**Testing:**
I tested jdk with and without this fix on linux/s390x (using Xvfb). It fixes the issue (reproducer for this bug no longer crashes the JVM). I have also tried to run `jdk_awt` tests, where lot of tests was also affected by this. With this patch amount of failures dropped by ~100.
Without fix:
TEST TOTAL PASS FAIL ERROR SKIP
>> jtreg:test/jdk:jdk_awt 2171 1063 415 6 687 <<
With fix
TEST TOTAL PASS FAIL ERROR SKIP
>> jtreg:test/jdk:jdk_awt 2171 1162 316 6 687 <<
Many tests are no longer crashing the VM:
-java/awt/Choice/ChoiceKeyEventReaction/ChoiceKeyEventReaction.java Failed. Unexpected exit from test [exit code: 134]
+java/awt/Choice/ChoiceKeyEventReaction/ChoiceKeyEventReaction.java Passed. Execution successful
There seem to be few unstable tests in jdk_awt. (Ones that fail in one or another run, but seem unrelated to this fix)
I have not done any additional manual testing of XIM as did original author (in review thread mentioned higher), as I am not at all familiar with input method for Japanese (or other Asian characters), or how that supposed to work. (So I cannot verify that input of Asian characters works as expected on linux/s390x, but at least JVM no longer crashes.)
-------------
Commit messages:
- Fix for stack smashing issue on linux s390x
Changes: https://git.openjdk.org/jdk/pull/24197/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24197&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8343618
Stats: 20 lines in 1 file changed: 10 ins; 10 del; 0 mod
Patch: https://git.openjdk.org/jdk/pull/24197.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/24197/head:pull/24197
PR: https://git.openjdk.org/jdk/pull/24197
More information about the client-libs-dev
mailing list