Commit 8f8d9fe6 authored by ZhangPeng's avatar ZhangPeng Committed by Peng Zhang
Browse files

mm/userswap: provide cpu info in userfault msg

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I8KESX


CVE: NA

--------------------------------

The uffd_msg.reserved3 field is used to transfer the CPU information of
the PF.

Signed-off-by: default avatarZhangPeng <zhangpeng362@huawei.com>
parent 0214feb8
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -269,6 +269,9 @@ static inline struct uffd_msg userfault_msg(unsigned long address,
		msg.arg.pagefault.flags |= UFFD_PAGEFAULT_FLAG_MINOR;
	if (features & UFFD_FEATURE_THREAD_ID)
		msg.arg.pagefault.feat.ptid = task_pid_vnr(current);
#ifdef CONFIG_USERSWAP
	uswap_get_cpu_id(reason, &msg);
#endif
	return msg;
}

+6 −0
Original line number Diff line number Diff line
@@ -50,5 +50,11 @@ static inline bool uswap_check_copy(struct vm_area_struct *vma,
	return true;
}

static inline void uswap_get_cpu_id(unsigned long reason, struct uffd_msg *msg)
{
	if (reason & VM_USWAP)
		msg->reserved3 = smp_processor_id();
}

#endif /* CONFIG_USERSWAP */
#endif /* _LINUX_USERSWAP_H */