git: 4628957c9ca4 - stable/12 - cpuset: Fix the KASAN and KMSAN builds

From: Justin Hibbits <jhibbits_at_FreeBSD.org>
Date: Mon, 23 May 2022 22:11:37 UTC
The branch stable/12 has been updated by jhibbits:

URL: https://cgit.FreeBSD.org/src/commit/?id=4628957c9ca45e1a39d5d9593f232e561f18230a

commit 4628957c9ca45e1a39d5d9593f232e561f18230a
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-05-20 14:11:31 +0000
Commit:     Justin Hibbits <jhibbits@FreeBSD.org>
CommitDate: 2022-05-23 19:16:09 +0000

    cpuset: Fix the KASAN and KMSAN builds
    
    Rename the "copyin" and "copyout" fields of struct cpuset_copy_cb to
    something less generic, since sanitizers define interceptors for
    copyin() and copyout() using #define.
    
    Reported by:    syzbot+2db5d644097fc698fb6f@syzkaller.appspotmail.com
    Fixes:  47a57144af25 ("cpuset: Byte swap cpuset for compat32 on big endian architectures")
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 4a3e51335e86cee02569c04b9f1e95ca9abcb170)
---
 sys/compat/freebsd32/freebsd32_misc.c |  4 ++--
 sys/compat/linux/linux_misc.c         |  4 ++--
 sys/kern/kern_cpuset.c                | 10 +++++-----
 sys/sys/cpuset.h                      |  4 ++--
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c
index 438004f4a088..9294150db9f7 100644
--- a/sys/compat/freebsd32/freebsd32_misc.c
+++ b/sys/compat/freebsd32/freebsd32_misc.c
@@ -3062,8 +3062,8 @@ copyout32_set(const void *k, void *u, size_t size)
 }
 
 static const struct cpuset_copy_cb cpuset_copy32_cb = {
-	.copyin = copyin32_set,
-	.copyout = copyout32_set
+	.cpuset_copyin = copyin32_set,
+	.cpuset_copyout = copyout32_set
 };
 
 int
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index 547f3fe7a22c..22e2df08a947 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -2024,8 +2024,8 @@ linux_sched_getparam(struct thread *td,
 }
 
 static const struct cpuset_copy_cb copy_set = {
-	.copyin = copyin,
-	.copyout = copyout
+	.cpuset_copyin = copyin,
+	.cpuset_copyout = copyout
 };
 
 /*
diff --git a/sys/kern/kern_cpuset.c b/sys/kern/kern_cpuset.c
index f8176256aee2..ca20b2d43b3c 100644
--- a/sys/kern/kern_cpuset.c
+++ b/sys/kern/kern_cpuset.c
@@ -1648,8 +1648,8 @@ cpuset_check_capabilities(struct thread *td, cpulevel_t level, cpuwhich_t which,
 }
 
 static const struct cpuset_copy_cb copy_set = {
-	.copyin = copyin,
-	.copyout = copyout
+	.cpuset_copyin = copyin,
+	.cpuset_copyout = copyout
 };
 
 #ifndef _SYS_SYSPROTO_H_
@@ -1885,7 +1885,7 @@ kern_cpuset_getaffinity(struct thread *td, cpulevel_t level, cpuwhich_t which,
 	if (p)
 		PROC_UNLOCK(p);
 	if (error == 0)
-		error = cb->copyout(mask, maskp, size);
+		error = cb->cpuset_copyout(mask, maskp, size);
 out:
 	free(mask, M_TEMP);
 	return (error);
@@ -2136,7 +2136,7 @@ kern_cpuset_getdomain(struct thread *td, cpulevel_t level, cpuwhich_t which,
 	}
 	DOMAINSET_COPY(&outset.ds_mask, mask);
 	if (error == 0)
-		error = cb->copyout(mask, maskp, domainsetsize);
+		error = cb->cpuset_copyout(mask, maskp, domainsetsize);
 	if (error == 0)
 		if (suword32(policyp, outset.ds_policy) != 0)
 			error = EFAULT;
@@ -2187,7 +2187,7 @@ kern_cpuset_setdomain(struct thread *td, cpulevel_t level, cpuwhich_t which,
 		return (error);
 	memset(&domain, 0, sizeof(domain));
 	mask = malloc(domainsetsize, M_TEMP, M_WAITOK | M_ZERO);
-	error = cb->copyin(maskp, mask, domainsetsize);
+	error = cb->cpuset_copyin(maskp, mask, domainsetsize);
 	if (error)
 		goto out;
 	/*
diff --git a/sys/sys/cpuset.h b/sys/sys/cpuset.h
index 697e220a70df..7a3a6753acc2 100644
--- a/sys/sys/cpuset.h
+++ b/sys/sys/cpuset.h
@@ -136,8 +136,8 @@ struct thread;
  * ABIs, like compat32.
  */
 struct cpuset_copy_cb {
-	int (*copyin)(const void *, void *, size_t);
-	int (*copyout)(const void *, void *, size_t);
+	int (*cpuset_copyin)(const void *, void *, size_t);
+	int (*cpuset_copyout)(const void *, void *, size_t);
 };
 
 struct cpuset *cpuset_thread0(void);