Hi @piyawith demon ,
Thank you for the detailed question. I reviewed the relevant Win32 documentation for each of your points. Several parts can be answered from the documentation. The exact access mask and the multi-job failure semantics are not defined in the public API contract. Below is what the documentation establishes, in the order of your questions.
To begin with, regarding the access rights required on each job handle
The UpdateProcThreadAttribute reference describes PROC_THREAD_ATTRIBUTE_JOB_LIST only as a list of job handles assigned to the child process in the order specified. It does not state a required access right. By comparison, the same page explicitly requires PROCESS_CREATE_PROCESS for PROC_THREAD_ATTRIBUTE_PARENT_PROCESS. Job Object Security and Access Rights maps JOB_OBJECT_ASSIGN_PROCESS to AssignProcessToJobObject only. As you noted, that requirement should not be treated as the documented minimum for this attribute. The public documentation does not define a minimum access mask for JOB_LIST.
In addition, as for whether the requirement differs between UpdateProcThreadAttribute and CreateProcessW
The documentation does not split access checking between the two calls. UpdateProcThreadAttribute only reports whether the attribute was added to the attribute list. It does not state that the job handles or their access are validated at that point.
Furthermore, regarding a handle returned directly by CreateJobObjectW(NULL, NULL)
CreateJobObjectW returns a handle with JOB_OBJECT_ALL_ACCESS, which combines all valid job object access rights. From an access-mask perspective, this handle is sufficient. Process creation can still fail for other reasons, such as session or hierarchy conditions.
Moreover, in terms of version, session, and nesting requirements
According to the UpdateProcThreadAttribute reference, PROC_THREAD_ATTRIBUTE_JOB_LIST is supported on Windows 10 and Windows Server 2016 and later.
The CreateJobObjectW documentation states that all processes associated with a job must run in the same session, and that a job is associated with the session of the first process assigned to it.
Membership in multiple jobs requires a valid nested-job hierarchy. As described in Nested Jobs, this is supported starting with Windows 8 and Windows Server 2012, and jobs nest only if the system can form a valid hierarchy and neither job sets UI limits.
I could not find any additional caller privilege documented specifically for this attribute.
On top of that, regarding atomic assignment or rollback when multiple job handles are supplied
The documentation states only that jobs are assigned in the order specified**.** It does not guarantee all-or-nothing assignment or rollback, and it does not state whether partial assignment can occur**.** Neither outcome should be relied on as a supported behavior.
Last but not least, as for the lifetime of the job handles and the handle array, and what happens if the creator is interrupted
According to the UpdateProcThreadAttribute reference, the value passed through lpValue must persist until the attribute list is destroyed with DeleteProcThreadAttributeList. The job handles should therefore stay open for at least that long. A job is destroyed when its last handle is closed and all associated processes have exited. If JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE is set, closing the last handle terminates the associated processes (Job Objects). The documentation does not describe the outcome if the creator process is interrupted while CreateProcessW is still running.
In conclusion, for the points the public documentation does not cover
Points 1, 2, 5, and the interruption part of 6 depend on internal implementation behavior that is not covered in the public documentation, so this is as far as I can go here on Q&A. Since you need an authoritative, version-specific answer, I recommend opening a case with Microsoft Support. They can engage the Windows engineering team to confirm the exact access requirements and failure semantics for your target builds.
I hope this helps clarify what is and isn't covered by the current documentation.
If you found this helpful, you can refer to this guidance to confirm it and help others with similar questions.
Thank you.