Integrated: 8339331: GCC fortify error in vm_version_linux_aarch64.cpp

SendaoYan syan at openjdk.org
Wed Dec 18 06:38:42 UTC 2024


On Tue, 10 Dec 2024 03:44:03 GMT, SendaoYan <syan at openjdk.org> wrote:

> Hi all,
> The file src/hotspot/os_cpu/linux_aarch64/vm_version_linux_aarch64.cpp reported nullptr compile warning by gcc14 with fastdebug configure. I think it's false positive, since the statement 'assert(buf != nullptr, "invalid argument");' has make sure the `buf` should not be nullptr before execute '::read(int, void*, int)'. The call chain is `void VM_Version::initialize_cpu_information(void)` -> `void VM_Version::get_compatible_board(char *buf, int buflen)` -> `static bool read_fully(const char *fname, char *buf, size_t buflen)`, `*buf` is defined as `char  Abstract_VM_Version::_cpu_desc[4096] = {0};` and then right shift 8 bytes, so `*buf` should not be nullptr.
> This PR use `PRAGMA_NONNULL_IGNORED` suppress false positive gcc compile warning to make fastdebug configure make success on linux-aarch64 by gcc14.2.0.
> Risk is low.
> 
> Additional testing:
> 
> - [x]  jtreg tests(include tier1/2/3 etc.) on linux-x64 with release build
> - [x]  jtreg tests(include tier1/2/3 etc.) on linux-x64 with fastdebug build
> - [x]  jtreg tests(include tier1/2/3 etc.) on linux-aarch64 with release build
> - [x]  jtreg tests(include tier1/2/3 etc.) on linux-aarch64 with fastdebug build

This pull request has now been integrated.

Changeset: 842f801c
Author:    SendaoYan <syan at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/842f801c845ec4bb6a3433fa2790f98864ca330b
Stats:     8 lines in 1 file changed: 7 ins; 0 del; 1 mod

8339331: GCC fortify error in vm_version_linux_aarch64.cpp

Reviewed-by: dholmes

-------------

PR: https://git.openjdk.org/jdk/pull/22655


More information about the hotspot-runtime-dev mailing list