Commit eec7e23
drm/panthor: Prevent potential UAF in group creation
This commit prevents the possibility of a use after free issue in the
GROUP_CREATE ioctl function, which arose as pointer to the group is
accessed in that ioctl function after storing it in the Xarray.
A malicious userspace can second guess the handle of a group and try
to call GROUP_DESTROY ioctl from another thread around the same time
as GROUP_CREATE ioctl.
To prevent the use after free exploit, this commit uses a mark on an
entry of group pool Xarray which is added just before returning from
the GROUP_CREATE ioctl function. The mark is checked for all ioctls
that specify the group handle and so userspace won't be abe to delete
a group that isn't marked yet.
v2: Add R-bs and fixes tags
Fixes: de85488 ("drm/panthor: Add the scheduler logical block")
Co-developed-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Akash Goel <akash.goel@arm.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: https://patch.msgid.link/20251127164912.3788155-1-akash.goel@arm.com1 parent 31d3354 commit eec7e23
1 file changed
Lines changed: 15 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
776 | 776 | | |
777 | 777 | | |
778 | 778 | | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
779 | 785 | | |
780 | 786 | | |
781 | 787 | | |
| |||
2906 | 2912 | | |
2907 | 2913 | | |
2908 | 2914 | | |
2909 | | - | |
| 2915 | + | |
2910 | 2916 | | |
2911 | 2917 | | |
2912 | 2918 | | |
| |||
3591 | 3597 | | |
3592 | 3598 | | |
3593 | 3599 | | |
| 3600 | + | |
| 3601 | + | |
3594 | 3602 | | |
3595 | 3603 | | |
3596 | 3604 | | |
| |||
3608 | 3616 | | |
3609 | 3617 | | |
3610 | 3618 | | |
| 3619 | + | |
| 3620 | + | |
| 3621 | + | |
3611 | 3622 | | |
3612 | 3623 | | |
3613 | 3624 | | |
| |||
3633 | 3644 | | |
3634 | 3645 | | |
3635 | 3646 | | |
3636 | | - | |
| 3647 | + | |
3637 | 3648 | | |
3638 | 3649 | | |
3639 | 3650 | | |
3640 | 3651 | | |
3641 | | - | |
| 3652 | + | |
3642 | 3653 | | |
3643 | 3654 | | |
3644 | 3655 | | |
| |||
3725 | 3736 | | |
3726 | 3737 | | |
3727 | 3738 | | |
3728 | | - | |
| 3739 | + | |
3729 | 3740 | | |
3730 | 3741 | | |
3731 | 3742 | | |
| |||
0 commit comments