Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8299378: sprintf is deprecated in Xcode 14 #11793

Closed
wants to merge 3 commits into from

Conversation

XueleiFan
Copy link
Member

@XueleiFan XueleiFan commented Dec 28, 2022

The sprintf is deprecated in Xcode 14 because of security concerns. The issue was addressed in JDK-8296812, but the test was not covered. The failure was reported later, while gtest is enabled for building.

This patch is just to make sure the building could pass. Other than that, the use of sprintf in other places are not touched.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/11793/head:pull/11793
$ git checkout pull/11793

Update a local copy of the PR:
$ git checkout pull/11793
$ git pull https://git.openjdk.org/jdk pull/11793/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 11793

View PR using the GUI difftool:
$ git pr show -t 11793

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/11793.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 28, 2022

👋 Welcome back xuelei! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Dec 28, 2022
@openjdk
Copy link

openjdk bot commented Dec 28, 2022

@XueleiFan The following label will be automatically applied to this pull request:

  • hotspot

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the hotspot hotspot-dev@openjdk.org label Dec 28, 2022
@mlbridge
Copy link

mlbridge bot commented Dec 28, 2022

Webrevs

@XueleiFan XueleiFan marked this pull request as draft December 28, 2022 06:02
@openjdk openjdk bot removed the rfr Pull request is ready for review label Dec 28, 2022
@XueleiFan XueleiFan marked this pull request as ready for review December 28, 2022 18:43
@openjdk openjdk bot added the rfr Pull request is ready for review label Dec 28, 2022
Copy link

@kimbarrett kimbarrett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@openjdk
Copy link

openjdk bot commented Jan 2, 2023

@XueleiFan This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8299378: sprintf is deprecated in Xcode 14

Reviewed-by: kbarrett, dholmes

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 28 new commits pushed to the master branch:

  • ea25a56: 8299520: TestPrintXML.java output error messages in case compare fails
  • 92dfc73: 8294526: sun/security/provider/SubjectCodeSource.java no longer referenced
  • 3d0db02: Merge
  • a6a903d: 8288204: GVN Crash: assert() failed: correct memory chain
  • 37f8b05: 8298592: Add java man page documentation for ChaCha20 and Poly1305 intrinsics
  • 245f0cf: 8291302: ARM32: nmethod entry barriers support
  • a9ce772: 8299437: Make InetSocketAddressHolder shallowly immutable
  • 8afd665: 8299395: Remove metaprogramming/removeCV.hpp
  • 3757433: 8295974: jni_FatalError and Xcheck:jni warnings should print the native stack when there are no Java frames
  • 417d01e: 8299441: Fix typos in some test files under core-libs component
  • ... and 18 more: https://git.openjdk.org/jdk/compare/11fd651ab1820770e3c65cd49589416098987a87...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jan 2, 2023
Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine. Thanks. One nit below.

test/hotspot/gtest/utilities/test_unsigned5.cpp Outdated Show resolved Hide resolved
@XueleiFan
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Jan 3, 2023

Going to push as commit 38cfc59.
Since your change was applied there have been 28 commits pushed to the master branch:

  • ea25a56: 8299520: TestPrintXML.java output error messages in case compare fails
  • 92dfc73: 8294526: sun/security/provider/SubjectCodeSource.java no longer referenced
  • 3d0db02: Merge
  • a6a903d: 8288204: GVN Crash: assert() failed: correct memory chain
  • 37f8b05: 8298592: Add java man page documentation for ChaCha20 and Poly1305 intrinsics
  • 245f0cf: 8291302: ARM32: nmethod entry barriers support
  • a9ce772: 8299437: Make InetSocketAddressHolder shallowly immutable
  • 8afd665: 8299395: Remove metaprogramming/removeCV.hpp
  • 3757433: 8295974: jni_FatalError and Xcheck:jni warnings should print the native stack when there are no Java frames
  • 417d01e: 8299441: Fix typos in some test files under core-libs component
  • ... and 18 more: https://git.openjdk.org/jdk/compare/11fd651ab1820770e3c65cd49589416098987a87...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jan 3, 2023
@openjdk openjdk bot closed this Jan 3, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jan 3, 2023
@openjdk
Copy link

openjdk bot commented Jan 3, 2023

@XueleiFan Pushed as commit 38cfc59.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@XueleiFan XueleiFan deleted the JDK-8299378 branch January 3, 2023 22:45
@Siedlerchr
Copy link
Contributor

Siedlerchr commented Jan 4, 2023

@XueleiFan Unfortunately I still get the same error even after this PR was merged.

/Users/christophs/workspace/jdk/test/hotspot/jtreg/runtime/Thread/libAsyncExceptionOnMonitorEnter.cpp:37:3: error: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations]
  sprintf(name, "MyRawMonitor");
  ^

And looking at the file I still see the usage of sprintf:
https://github.com/openjdk/jdk/blob/master/test/hotspot/jtreg/runtime/Thread/libAsyncExceptionOnMonitorEnter.cpp

Edit::
Another section:

/Users/christophs/workspace/jdk/test/hotspot/jtreg/serviceability/jvmti/events/ThreadEnd/threadend01/libthreadend01.cpp:59:5: error: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations]
    sprintf(name, "%s%d", prefix, eventsCount);
    ^
 

@XueleiFan
Copy link
Member Author

@XueleiFan Unfortunately I still get the same error even after this PR was merged.

@Siedlerchr Would you please share the platform information? Thanks!

@Siedlerchr
Copy link
Contributor

Siedlerchr commented Jan 4, 2023

Ventura 13.1 (22C65)
SDK: MacOSX13.1.sdk (XCode 14.2)
macosx-aarch64-server-release

Full log (I commented out that line in libAsyncExceptionOnMonitorEnter, therefore the following came up)
I am happy to test any further fixes.

I run make run-test tier1 and did a clean before

=== Output from failing command(s) repeated here ===
* For target support_test_hotspot_jtreg_native_support_libthreadend01_libthreadend01.o:
/Users/christophs/workspace/jdk/test/hotspot/jtreg/serviceability/jvmti/events/ThreadEnd/threadend01/libthreadend01.cpp:59:5: error: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations]
    sprintf(name, "%s%d", prefix, eventsCount);
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
1 error generated.
* For target support_test_hotspot_jtreg_native_support_libthreadstart01_libthreadstart01.o:
/Users/christophs/workspace/jdk/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart01/libthreadstart01.cpp:58:5: error: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations]
    sprintf(name, "%s%d", prefix, eventsCount);
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
1 error generated.

@dholmes-ora
Copy link
Member

We have developers reporting the same, and other issues. I don't know what builds you used to test this but there are issues with at least opto code in hotspot and JVMTI tests (as above).

@Siedlerchr
Copy link
Contributor

@dholmes-ora I am using the latest master branch from earlier today 82deb5c

@XueleiFan
Copy link
Member Author

Ventura 13.1 (22C65) SDK: MacOSX13.1.sdk (XCode 14.2) macosx-aarch64-server-release

Full log (I commented out that line in libAsyncExceptionOnMonitorEnter, therefore the following came up) I am happy to test any further fixes.

I run make run-test tier1 and did a clean before

I could reproduce the issue. A new bug was filed: https://bugs.openjdk.org/browse/JDK-8299635. Thank you!

@SWinxy
Copy link
Contributor

SWinxy commented Jan 5, 2023

Oddly, this PR didn't solve it for me either. 8299635 should include the failure of libAsyncExceptionOnMonitorEnter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot hotspot-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

5 participants