virtualbox modules do not compile with gcc constify plugin
Posted: Sun Aug 14, 2011 9:29 pm
The title is pretty descriptive. If those modules, needed for virtualbox to work, are build against grsecurity headers, gcc fails to compile it.
I am using vanilla kernel 2.6.39-4 with the latest grsecurity-pax patchset, and virtualbox 4.1.0.
The error produced is
here is the offending function:
The first error is on "pReq->u.Out.pfnSymbol = g_aFunctions[i].pfn;" and the second on "pReq->u.Out.pfnSymbol = (PFNRT)((uint8_t *)pImage->pvImage + (int32_t)paSyms[i].offSymbol);"
I am not really sure where 'u' and 'Out' are defined, have to dig some more. I imagine something is defined as const?
I can report this to virtualbox, but first need to gather more info about it - why does it happen, as I am not really sure what exactly this plugin does.
I am using vanilla kernel 2.6.39-4 with the latest grsecurity-pax patchset, and virtualbox 4.1.0.
The error produced is
- Code: Select all
/var/lib/dkms/vboxhost/4.1.0/build/vboxdrv/SUPDrv.c: In function ‘supdrvIDC_LdrGetSymbol’:
/var/lib/dkms/vboxhost/4.1.0/build/vboxdrv/SUPDrv.c:4346:17: error: assignment of read-only member ‘Out’
/var/lib/dkms/vboxhost/4.1.0/build/vboxdrv/SUPDrv.c:4377:21: error: assignment of read-only member ‘Out’
here is the offending function:
- Code: Select all
/**
* Gets the address of a symbol in an open image or the support driver.
*
* @returns VINF_SUCCESS on success.
* @returns
* @param pDevExt Device globals.
* @param pSession Session data.
* @param pReq The request buffer.
*/
static int supdrvIDC_LdrGetSymbol(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPDRVIDCREQGETSYM pReq)
{
int rc = VINF_SUCCESS;
const char *pszSymbol = pReq->u.In.pszSymbol;
const char *pszModule = pReq->u.In.pszModule;
size_t cbSymbol;
char const *pszEnd;
uint32_t i;
/*
* Input validation.
*/
AssertPtrReturn(pszSymbol, VERR_INVALID_POINTER);
pszEnd = RTStrEnd(pszSymbol, 512);
AssertReturn(pszEnd, VERR_INVALID_PARAMETER);
cbSymbol = pszEnd - pszSymbol + 1;
if (pszModule)
{
AssertPtrReturn(pszModule, VERR_INVALID_POINTER);
pszEnd = RTStrEnd(pszModule, 64);
AssertReturn(pszEnd, VERR_INVALID_PARAMETER);
}
Log3(("supdrvIDC_LdrGetSymbol: pszModule=%p:{%s} pszSymbol=%p:{%s}\n", pszModule, pszModule, pszSymbol, pszSymbol));
if ( !pszModule
|| !strcmp(pszModule, "SupDrv"))
{
/*
* Search the support driver export table.
*/
for (i = 0; i < RT_ELEMENTS(g_aFunctions); i++)
if (!strcmp(g_aFunctions[i].szName, pszSymbol))
{
pReq->u.Out.pfnSymbol = g_aFunctions[i].pfn;
break;
}
}
else
{
/*
* Find the loader image.
*/
PSUPDRVLDRIMAGE pImage;
supdrvLdrLock(pDevExt);
for (pImage = pDevExt->pLdrImages; pImage; pImage = pImage->pNext)
if (!strcmp(pImage->szName, pszModule))
break;
if (pImage && pImage->uState == SUP_IOCTL_LDR_LOAD)
{
/*
* Search the symbol strings.
*/
const char *pchStrings = pImage->pachStrTab;
PCSUPLDRSYM paSyms = pImage->paSymbols;
for (i = 0; i < pImage->cSymbols; i++)
{
if ( paSyms[i].offName + cbSymbol <= pImage->cbStrTab
&& !memcmp(pchStrings + paSyms[i].offName, pszSymbol, cbSymbol))
{
/*
* Found it! Calc the symbol address and add a reference to the module.
*/
pReq->u.Out.pfnSymbol = (PFNRT)((uint8_t *)pImage->pvImage + (int32_t)paSyms[i].offSymbol);
rc = supdrvLdrAddUsage(pSession, pImage);
break;
}
}
}
else
rc = pImage ? VERR_WRONG_ORDER : VERR_MODULE_NOT_FOUND;
supdrvLdrUnlock(pDevExt);
}
return rc;
}
The first error is on "pReq->u.Out.pfnSymbol = g_aFunctions[i].pfn;" and the second on "pReq->u.Out.pfnSymbol = (PFNRT)((uint8_t *)pImage->pvImage + (int32_t)paSyms[i].offSymbol);"
I am not really sure where 'u' and 'Out' are defined, have to dig some more. I imagine something is defined as const?
I can report this to virtualbox, but first need to gather more info about it - why does it happen, as I am not really sure what exactly this plugin does.