From f72d10d279509c6488976067844330b135b4c812 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20L=C3=BCtke=20Dreimann?= Date: Tue, 26 Aug 2025 14:19:00 +0200 Subject: [PATCH] check shmid access --- repos/dde_uos-intel-gpgpu/src/virt/rpc.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/repos/dde_uos-intel-gpgpu/src/virt/rpc.cc b/repos/dde_uos-intel-gpgpu/src/virt/rpc.cc index 34ca1932ca..881d958855 100644 --- a/repos/dde_uos-intel-gpgpu/src/virt/rpc.cc +++ b/repos/dde_uos-intel-gpgpu/src/virt/rpc.cc @@ -87,7 +87,21 @@ void Session_component::start_task(unsigned long kconf) } else // for pointer set phys addr { - const Genode::addr_t addrBase = kc->buffConfigs[i].shmid == -1 ? base : SHM_manager::getInstance().getBase(kc->buffConfigs[i].shmid); + const int shmid = kc->buffConfigs[i].shmid; + Genode::addr_t addrBase; + if(shmid == -1) // no shm + { + addrBase = base; + } + else + { + if(!vgpu.hasSHM(shmid)) { + Genode::error("Invalid GPU SHM access: ", shmid); + _global_sched->trigger(); + return; + } + addrBase = SHM_manager::getInstance().getBase(shmid); + } kc->buffConfigs[i].buffer = (void*)((Genode::addr_t)kc->buffConfigs[i].buffer + addrBase); } }