#asahi-gpu · 2022-10-02 14:12
alyssaHow is that different from any other invalid cmdbuf that userspace can prepare and that GPU will fault on#asahi-gpu · 2022-10-02 14:12
alyssaIs that actually a security issue though? Why does kernel need to sanitize?#asahi-gpu · 2022-10-02 14:12
alyssalina: Oh. Delight.#asahi-gpu · 2022-10-02 14:12
alyssa(all render pass config)#asahi-gpu · 2022-10-02 14:11
alyssaour submit ioctl has fields for the registers that userspace is allowed to set#asahi-gpu · 2022-10-02 14:11
alyssakarolherbst: Nothing to sanitize#asahi-gpu · 2022-10-02 13:41
alyssalina: also assuming the panfrost code is correct... brave#asahi-gpu · 2022-10-02 13:41
alyssagiggle#asahi-gpu · 2022-10-02 12:48
alyssathe modifiers thing is the most fundamental breakage here but yeah#asahi-gpu · 2022-10-02 12:47
alyssa---#asahi-gpu · 2022-10-02 12:46
alyssathough I don't think that last part will actually matter because winsys will be NULL on linux#asahi-gpu · 2022-10-02 12:40
alyssathis should only be for DISPLAY_TARGET, it can and will break for SCANOUT and SHARED which can't go through the displaytarget path#asahi-gpu · 2022-10-02 12:40
alyssahttps://gitlab.freedesktop.org/asahilina/mesa/-/blob/omg-it-works/src/gallium/drivers/asahi/agx_pipe.c#L277#asahi-gpu · 2022-10-02 12:39
alyssa(DISPLAY_TARGET is mostly for software rasterizers but we can't delete it because reasons, SCANOUT is for buffers shared with the display/dcp, SHARED is for buffers shared across processes like window surfaces, LINEAR is an old hack that won't die)#asahi-gpu · 2022-10-02 12:38
alyssafor PIPE_BIND_SHARED, we can and should twiddle#asahi-gpu · 2022-10-02 12:38
alyssa!(pres->base.bind & (PIPE_BIND_DISPLAY_TARGET | PIPE_BIND_SCANOUT | PIPE_BIND_LINEAR))#asahi-gpu · 2022-10-02 12:37
alyssaagx_twiddled_allowed should then have#asahi-gpu · 2022-10-02 12:37
alyssathis if-stmt is way too late#asahi-gpu · 2022-10-02 12:37
alyssahttps://gitlab.freedesktop.org/asahilina/mesa/-/blob/omg-it-works/src/gallium/drivers/asahi/agx_pipe.c#L277#asahi-gpu · 2022-10-02 12:36
alyssathe second case is when the CLIENT selects the modifier, in which case we have to pick from that set conditional on those allowed checks#asahi-gpu · 2022-10-02 12:36
alyssaagx_twiddled_allowed || modifer != TWIDDLED#asahi-gpu · 2022-10-02 12:36
alyssaagx_linear_allowed || modifer != LINEAR#asahi-gpu · 2022-10-02 12:36
alyssaand at the end can assert#asahi-gpu · 2022-10-02 12:36
alyssathe first is when WE select the modifier, in which case it's just the logic without the for loop on top#asahi-gpu · 2022-10-02 12:35
alyssaand then there are two distinct cases#asahi-gpu · 2022-10-02 12:35
alyssaok i guess the second function isn't needed#asahi-gpu · 2022-10-02 12:35
alyssa}#asahi-gpu · 2022-10-02 12:35
alyssa return true;#asahi-gpu · 2022-10-02 12:35
alyssabool agx_twiddled_allowed(const struct agx_resource *pres) {#asahi-gpu · 2022-10-02 12:35
alyssa}#asahi-gpu · 2022-10-02 12:35
alyssa return pres->base.target == PIPE_BUFFER || agx_is_2d(pres->base.target);#asahi-gpu · 2022-10-02 12:34
alyssabool agx_linear_allowed(const struct agx_resource *pres) {#asahi-gpu · 2022-10-02 12:34
alyssaneed to split out 2 functions:#asahi-gpu · 2022-10-02 12:34
alyssathis loop is fundamentally bogus and will return modifiers that aren't actually valid#asahi-gpu · 2022-10-02 12:33
alyssahttps://gitlab.freedesktop.org/asahilina/mesa/-/blob/omg-it-works/src/gallium/drivers/asahi/agx_pipe.c#L277#asahi-gpu · 2022-10-02 12:32
alyssamissing assert(level == 0) here#asahi-gpu · 2022-10-02 12:32
alyssahttps://gitlab.freedesktop.org/asahilina/mesa/-/blob/omg-it-works/src/gallium/drivers/asahi/agx_pipe.c#L256#asahi-gpu · 2022-10-02 12:32
alyssaalso seemingly missing "handle->size = rsrc->layout.size_B;"#asahi-gpu · 2022-10-02 12:30
alyssa(I think no because you can't share depth/stencil targets across process boundaries so we should be ok)#asahi-gpu · 2022-10-02 12:30
alyssaor maybe "handle->format = rsrc->base.format;" ... would need to think for a bit to figure out whether the difference matters#asahi-gpu · 2022-10-02 12:30
alyssaalso seemingly missing "handle->format = rsrc->layout.format;" there#asahi-gpu · 2022-10-02 12:29
alyssathis depends on (handle->layer == 0)#asahi-gpu · 2022-10-02 12:28
alyssahttps://gitlab.freedesktop.org/asahilina/mesa/-/blob/omg-it-works/src/gallium/drivers/asahi/agx_pipe.c#L231#asahi-gpu · 2022-10-02 12:26
alyssaI don't think it's uncommon, I'd just like to know if that's causing people's problems ;)#asahi-gpu · 2022-10-02 12:24
alyssafor debug I would "assert(whandle->offset == 0);" there to see if that's causing any issue#asahi-gpu · 2022-10-02 12:24
alyssathis is wrong#asahi-gpu · 2022-10-02 12:24
alyssahttps://gitlab.freedesktop.org/asahilina/mesa/-/blob/omg-it-works/src/gallium/drivers/asahi/agx_pipe.c#L177#asahi-gpu · 2022-10-02 12:17
alyssathat's... novel...#asahi-gpu · 2022-10-02 12:17
alyssadaniels: sorry what#asahi-gpu · 2022-10-02 12:17
alyssaobviously there's no DRM modifiers on macOS so that code is all untested up until now