We need to protect us from recycled PIDs here like everywhere else: once
we read data from /proc/$PID/ we need to validate that $PID still points
to the original pidfd.
(cherry picked from commit
3c70cbae0ff15d3dc5877173015187db81e004be)
if (uid_range != (uid_t) gid_range)
return -ENXIO;
+ r = pidref_verify(&m->leader);
+ if (r < 0)
+ return r;
+
*ret = uid_shift;
return 0;
}
if (!uid_is_valid(converted))
return -EINVAL;
+ r = pidref_verify(&machine->leader);
+ if (r < 0)
+ return r;
+
if (ret_internal_uid)
*ret_internal_uid = converted;
if (!uid_is_valid(converted))
return -EINVAL;
+ r = pidref_verify(&machine->leader);
+ if (r < 0)
+ return r;
+
if (ret_host_uid)
*ret_host_uid = converted;