Hi Joonas,

On 11/17/26 09:20, Joonas Lahtinen wrote:
> Quoting Christian König (2026-11-16 15:17:02)
>> On 11/9/26 14:55, Mika Kuoppala wrote:
>>> Implement debugger vm access for userptrs.
>>>
>>> When bind is done, take a ref to the current task so that
>>> we know from which vm the address was bound. Then during
>>> debugger pread/pwrite we use this target task as
>>> parameter to access the debuggee vm with access_process_vm().
>>>
>>> This is based on suggestions from Simona, Thomas and Joonas.
>>
>> At AMD we had a legthly discussion if such an interface would be necessary 
>> for AMDs debugger interface and came to the conclusion that it is *NOT* a 
>> good idea to have this.
> 
> I'd like to refer to our 2024 December discussion on review of v3 of
> this series[1].
> 
> Quoting myself from the end:
> 
>       "It seems like the peek/poke access to userptr is the big remaining open
>       where opinions differ, so maybe we should first focus on aligning on it.
>       It impacts both core dumping and interactive debugging."
> 
> Then from same series review, we took Sima's suggestions[2] to be
> implemented. About one year later in 2025 December we got your
> review comments[3] for series v6:
> 
>       "But from a ten mile high view it looks sane to me now."
> 
> And quoting myself:
> 
>       "Understandable and thanks for the high level check, we'll continue 
> with the
>       current direction then."
> 
> So given v4 (which you gave above "looks sane to me" included pretty much
> exactly this patch [4], I'm bit surprised to be starting to reiterate what
> feels like our discussion from [1].
> 
> I'm hoping we can agree to a disagree here. ROCm maybe doesn't need
> interface like this due to requirement of ptrace_attach(), GPU address
> == CPU address and no kernel initiated core dumps. We want to avoid
> those limitations in our architecture as discussed in [1].
> 
> After you very much seemed to agree in the direction on [3], we've
> spent 2 years incrementally addressing all the other comments in 7 new
> series versions. Thus I'm not really a big fan of reiterating the original
> discussion, so excuse me for being bit irritated here.

I'm mostly just explaining our AMD internal discussion results with our 
debugger people where we found after a lot of arguing that ptrace_attach() can 
be avoided even without adding complicated new interfaces.

>> process_vm_readv() and process_vm_writev() interfaces already allow a 
>> debugger to access userptr resources completely without the need of 
>> PTRACE_ATTACH.
> 
> That is correct. However as discussed earlier the access implemented
> here is for reading memory from ppGTT, not the CPU address space. For
> readv/writev userspace driver would have to maintain all ppGTT layouts
> in CPU address space and that'll simply not fit as discussed in [1]
> amongst the other reasons.

Yes, that argument came up before as well. I kind of agree with that, but I 
think that this is not the point. See below for more explanation.

> This exact same access will be needed when doing core dumps and capturing
> the ppGTT contents during crash by kernel, when there is no GDB involved.
> I don't see any value in diverging the memory access path for interactive
> debug and core dumps.
> 
> I don't know if ROCm has plans for supporting core dumps without GDB
> involved, but we definitely want to have that ability. And in [1] we
> seemed to agree on the usefulness.
> 
>> Especially since this interface here allows to bypass all the extra security 
>> checks otherwise applied to such an action it should probably not be 
>> something allowed upstream.
> 
> To recap. No security is bypassed, access happens as if GPU did the
> access. If the address is not in ppGTT, there's no access to it. So
> access given here is equal to access gained submitting a blitter copy
> command to copy the data using a context with the same ppGTT. Code
> comments were added to explain to eliminate Sashiko false positives.
> 
> Unfortunately, we can't actually rely on the RCS/CCS/BCS engines
> making forward progress on current gen hardware as hardware may be
> stalled due to numerous pending page-faults. Especially when doing
> core dumps.

Yes, I agree as well.

The core point is that David Hildebrand just recently restricted the 
vm_ops->access() rules which also results in more ttm_bo_access() restrictions.

The problem is now when you access the buffers from the GPU point of view and 
using the HW/driver specific security rules instead then you are bypassing all 
those SW checks again.

I clearly see the use case as well why you want to do that, I'm just not sure 
if core memory management people will also agree.

Adding David Hildebrand to comment.

Regards,
Christian.

> 
> Regards, Joonas
> 
> [1] 
> https://lore.kernel.org/intel-xe/173392197322.40386.12252741494998606...@jlahtine-mobl.ger.corp.intel.com/
> [2] https://lore.kernel.org/intel-xe/[email protected]/
> [3] 
> https://lore.kernel.org/intel-xe/176520185138.24350.8954844301177099832@jlahtine-mobl/
> [4] 
> https://lore.kernel.org/intel-xe/[email protected]/

Reply via email to