RFR: 8343618: Stack smashing in awt_InputMethod.c on Linux s390x
Zdenek Zambersky
zzambers at openjdk.org
Tue May 20 14:45:57 UTC 2025
On Mon, 24 Mar 2025 13:41:44 GMT, Zdenek Zambersky <zzambers at openjdk.org> wrote:
> This fixes stack smashing issue in awt library on linux s390x. (jdk compiled with `-fstack-protector-strong`)
>
> Fix is based on patch [submitted](https://mail.openjdk.org/pipermail/awt-dev/2019-July/015337.html) 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.)
Attaching jdk_awt results with `XMODIFIERS=@im=local`:
[jdk-awt-results-im-local.tar.gz](https://github.com/user-attachments/files/20349889/jdk-awt-results-im-local.tar.gz)
-------------
PR Comment: https://git.openjdk.org/jdk/pull/24197#issuecomment-2894695574
More information about the client-libs-dev
mailing list