Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Jul 2018 14:25:18 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r336906 - in head/sys: kern net
Message-ID:  <201807301425.w6UEPIVP078629@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Mon Jul 30 14:25:17 2018
New Revision: 336906
URL: https://svnweb.freebsd.org/changeset/base/336906

Log:
  Ensure the DPCPU and VNET module spaces are aligned to hold a pointer.
  Previously they may have been aligned to a char, leading to misaligned
  DPCPU and VNET variables.
  
  Sponsored by:	DARPA, AFRL

Modified:
  head/sys/kern/subr_pcpu.c
  head/sys/net/vnet.c

Modified: head/sys/kern/subr_pcpu.c
==============================================================================
--- head/sys/kern/subr_pcpu.c	Mon Jul 30 14:21:49 2018	(r336905)
+++ head/sys/kern/subr_pcpu.c	Mon Jul 30 14:25:17 2018	(r336906)
@@ -72,7 +72,7 @@ struct dpcpu_free {
 	TAILQ_ENTRY(dpcpu_free) df_link;
 };
 
-DPCPU_DEFINE_STATIC(char, modspace[DPCPU_MODMIN]);
+DPCPU_DEFINE_STATIC(char, modspace[DPCPU_MODMIN] __aligned(__alignof(void *)));
 static TAILQ_HEAD(, dpcpu_free) dpcpu_head = TAILQ_HEAD_INITIALIZER(dpcpu_head);
 static struct sx dpcpu_lock;
 uintptr_t dpcpu_off[MAXCPU];

Modified: head/sys/net/vnet.c
==============================================================================
--- head/sys/net/vnet.c	Mon Jul 30 14:21:49 2018	(r336905)
+++ head/sys/net/vnet.c	Mon Jul 30 14:25:17 2018	(r336906)
@@ -178,7 +178,7 @@ static MALLOC_DEFINE(M_VNET_DATA, "vnet_data", "VNET d
  * Space to store virtualized global variables from loadable kernel modules,
  * and the free list to manage it.
  */
-VNET_DEFINE_STATIC(char, modspace[VNET_MODMIN]);
+VNET_DEFINE_STATIC(char, modspace[VNET_MODMIN] __aligned(__alignof(void *)));
 
 /*
  * Global lists of subsystem constructor and destructors for vnets.  They are



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201807301425.w6UEPIVP078629>