[Devel] [PATCH RH9 08/22] ve/fs/ioprio: Confine ioprio_{set, get}(IOPRIO_WHO_USER) to current ve

Andrey Zhadchenko andrey.zhadchenko at virtuozzo.com
Thu Oct 7 13:57:32 MSK 2021


From: Vladimir Davydov <vdavydov at parallels.com>

As long as we don't use user namespaces, we have to force
iorpio_{set,get}(IOPRIO_WHO_USER) to iterate over processes of the
current ve only.

Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>

=====================================================================

VZ 8 rebase part https://jira.sw.ru/browse/PSBM-127782
vz7 commit: b74a04f ("ve/fs/ioprio: confine ioprio_{set, get}(IOPRIO_WHO_USER)
to current ve")

Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalitsyn at virtuozzo.com>

(cherry picked from vz8 commit fa7b729a219b88afdf96f0a14a0ac5bc2d6cf7b8)
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
---
 block/ioprio.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/block/ioprio.c b/block/ioprio.c
index 6820e2f..0fb87c2 100644
--- a/block/ioprio.c
+++ b/block/ioprio.c
@@ -160,6 +160,10 @@ int ioprio_check_cap(int ioprio)
 				break;
 
 			for_each_process_thread(g, p) {
+#ifdef CONFIG_VE
+				if (p->task_ve != get_exec_env())
+					continue;
+#endif
 				if (!uid_eq(task_uid(p), uid) ||
 				    !task_pid_vnr(p))
 					continue;
@@ -251,6 +255,10 @@ int ioprio_best(unsigned short aprio, unsigned short bprio)
 				break;
 
 			for_each_process_thread(g, p) {
+#ifdef CONFIG_VE
+				if (p->task_ve != get_exec_env())
+					continue;
+#endif
 				if (!uid_eq(task_uid(p), user->uid) ||
 				    !task_pid_vnr(p))
 					continue;
-- 
1.8.3.1



More information about the Devel mailing list