Use UMA_ALIGN_PTR instead of sizeof(void *) for zone alignment.

uma_zcreate()'s alignment argument is supposed to be sizeof(foo) - 1,
and uma.h provides a set of helper macros for common types.  Passing
sizeof(void *) results in all of the members being misaligned triggering
unaligned access faults on certain architectures (notably MIPS).

Reported by:	brooks
Obtained from:	CheriBSD
MFC after:	3 days
Sponsored by:	DARPA / AFRL
This commit is contained in:
John Baldwin 2017-03-15 18:23:32 +00:00
parent a393b6c82f
commit 03f7f17878
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=315323

View File

@ -153,7 +153,7 @@ nameiinit(void *dummy __unused)
namei_zone = uma_zcreate("NAMEI", MAXPATHLEN, NULL, NULL, NULL, NULL,
UMA_ALIGN_PTR, 0);
nt_zone = uma_zcreate("rentr", sizeof(struct nameicap_tracker),
NULL, NULL, NULL, NULL, sizeof(void *), 0);
NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
getnewvnode("crossmp", NULL, &crossmp_vnodeops, &vp_crossmp);
}
SYSINIT(vfs, SI_SUB_VFS, SI_ORDER_SECOND, nameiinit, NULL);