Skip to content

[BoundsSafety] Partially Upstream support for BS_CHK_LibCAttributes for Apple platforms #10544

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

Conversation

delcypher
Copy link

This adds the compiler side implementation of the new BS_CHK_LibCAttributes bounds check for the Darwin toolchain. When -fbounds-safety-bringup-missing-checks=libc_attributes is enabled and when compiling for Apple platforms with a userspace Libc the __LIBC_STAGED_BOUNDS_SAFETY_ATTRIBUTES macro is enabled. This macro communicates to Libc that it should switch on the new -fbounds-safety annotations.

rdar://149243724
(cherry picked from commit 6829d4a)

… for Apple platforms

This adds the compiler side implementation of the new
`BS_CHK_LibCAttributes` bounds check for the Darwin toolchain. When
`-fbounds-safety-bringup-missing-checks=libc_attributes` is enabled and when
compiling for Apple platforms with a userspace Libc the
`__LIBC_STAGED_BOUNDS_SAFETY_ATTRIBUTES` macro is enabled. This macro
communicates to Libc that it should switch on the new `-fbounds-safety`
annotations.

rdar://149243724
(cherry picked from commit 6829d4a)
@delcypher delcypher requested a review from a team as a code owner April 24, 2025 17:05
@delcypher
Copy link
Author

@swift-ci test llvm

@delcypher
Copy link
Author

@swift-ci test

@delcypher delcypher requested a review from rapidsna April 24, 2025 17:06
@delcypher
Copy link
Author

This is a prerequisite for implementing rdar://148623233.

@delcypher
Copy link
Author

macOS LLVM testing failed with:

Resolving deltas:  54% (3768670/6938742)
error: inflate: data stream error (incorrect data check)
fatal: packed object 626036e3cda8aa8621a94399c990c4c376836561 (stored in .git/objects/pack/pack-aed502d313b6b9fb1a7e84d479d19f285da4681d.pack) is corrupt
fatal: fetch-pack: invalid index-pack output

	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2846)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2185)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:635)
	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:170)
	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:161)
	at hudson.remoting.UserRequest.perform(UserRequest.java:211)
	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
	at hudson.remoting.Request$2.run(Request.java:377)
	at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
	Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to macos-node-i-0acee461ffa311514
		at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1787)
		at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356)
		at hudson.remoting.Channel.call(Channel.java:1003)
		at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:153)
		at jdk.internal.reflect.GeneratedMethodAccessor430.invoke(Unknown Source)
		at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
		at java.base/java.lang.reflect.Method.invoke(Method.java:566)
		at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:138)
		at com.sun.proxy.$Proxy87.execute(Unknown Source)
		at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:997)
		at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1241)
		at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1305)
		at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:136)
		at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:101)
		at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:88)
		at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
		at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
		at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
		at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
		at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
		at java.base/java.lang.Thread.run(Thread.java:829)
ERROR: Error fetching remote repo 'origin'
ERROR: Maximum checkout retry attempts reached, aborting

@delcypher
Copy link
Author

@swift-ci test llvm

@delcypher delcypher added the clang:bounds-safety Issue relating to the experimental -fbounds-safety feature in Clang label Apr 25, 2025
@devincoughlin devincoughlin merged commit 21a2aaa into swiftlang:swift/release/6.2 Apr 25, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:bounds-safety Issue relating to the experimental -fbounds-safety feature in Clang
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants