Skip to content

library: Make ProcThreadAttributeListBuilder more unsafe#158712

Open
workingjubilee wants to merge 1 commit into
rust-lang:mainfrom
workingjubilee:make-procthreadattributelist-unsafer
Open

library: Make ProcThreadAttributeListBuilder more unsafe#158712
workingjubilee wants to merge 1 commit into
rust-lang:mainfrom
workingjubilee:make-procthreadattributelist-unsafer

Conversation

@workingjubilee

@workingjubilee workingjubilee commented Jul 3, 2026

Copy link
Copy Markdown
Member

Honestly, I took the "make it all unsafe" approach in this draft because it wasn't clear to me what exactly was the best to do and I figured we'd find out in review.

r? @ChrisDenton cc @PaulDance
Resolves #158601

@rustbot rustbot added O-windows Operating system: Windows S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jul 3, 2026
@rustbot

rustbot commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

ChrisDenton is not on the review rotation at the moment.
They may take a while to respond.

@workingjubilee workingjubilee changed the title library: Make windows::process::ProcThreadAttributeListBuilder more unsafe library: Make ProcThreadAttributeListBuilder more unsafe Jul 3, 2026
@ChrisDenton

Copy link
Copy Markdown
Member

This one I'll need to think a bit about. Honestly I've gone back and forth, though I fear this is ultimately a libs-api question.

@rust-log-analyzer

This comment has been minimized.

@workingjubilee workingjubilee force-pushed the make-procthreadattributelist-unsafer branch from 0ce091b to 6f0901e Compare July 3, 2026 02:46
@PaulDance

Copy link
Copy Markdown
Contributor

Having at least one marked unsafe is better. Having all of them as such could be a bit overkill, though. In any case, I don't have too strong of an opinion on this and the current state is OK I guess.

@ChrisDenton

ChrisDenton commented Jul 4, 2026

Copy link
Copy Markdown
Member

Ok, I do think this is a libs-api decision so I'm going to nominate libs-api.

There are two options:

  • make Command::spawn_with_attributes unsafe
  • make ProcThreadAttributeListBuilder::attribute unsafe

The argument for the former is that generally we say pointers are totally safe right up until the point you do something with them. In this case ProcThreadAttribute should be essentially an opaque key/value store and doesn't dereference anything itself (although this technically isn't guaranteed by the MS documentation I'm not sure there's any practical reason for it to do so).

The argument for the latter is that it'd be nice if ProcThreadAttribute could immediately encapsulate the unsafety so it's the user's job to ensure any pointers inside structs points to memory that lives at least as long as the ProcThreadAttribute's lifetime.

@ChrisDenton ChrisDenton added the I-libs-api-nominated Nominated for discussion during a libs-api team meeting. label Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

I-libs-api-nominated Nominated for discussion during a libs-api team meeting. O-windows Operating system: Windows S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ProcThreadAttributeListBuilder::attribute should be unsafe

5 participants