[SOLVED] __no_const & rtl8192c_hal_init.c

Discuss usability issues, general maintenance, and general support issues for a grsecurity-enabled system.

[SOLVED] __no_const & rtl8192c_hal_init.c

Postby NaN » Wed Dec 04, 2013 4:41 pm

Hi,

I'm trying to compile 3.11.6 kernel with grsecurity&pax and probably due to constify plugin the compilations fails with this:

drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c: In function ‘rtl8192c_set_hal_ops’:
drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c:3599:2: error: assignment of member ‘free_hal_data’ in read-only object
drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c:3601:2: error: assignment of member ‘dm_init’ in read-only object
drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c:3602:2: error: assignment of member ‘dm_deinit’ in read-only object
drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c:3603:2: error: assignment of member ‘read_chip_version’ in read-only object
drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c:3605:2: error: assignment of member ‘set_bwmode_handler’ in read-only object
drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c:3606:2: error: assignment of member ‘set_channel_handler’ in read-only object
drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c:3608:2: error: assignment of member ‘hal_dm_watchdog’ in read-only object
drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c:3610:2: error: assignment of member ‘Add_RateATid’ in read-only object
drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c:3613:2: error: assignment of member ‘SwAntDivBeforeLinkHandler’ in read-only object
drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c:3614:2: error: assignment of member ‘SwAntDivCompareHandler’ in read-only object
drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c:3617:2: error: assignment of member ‘read_bbreg’ in read-only object
drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c:3618:2: error: assignment of member ‘write_bbreg’ in read-only object
drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c:3619:2: error: assignment of member ‘read_rfreg’ in read-only object
drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c:3620:2: error: assignment of member ‘write_rfreg’ in read-only object
drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c:3623:2: error: assignment of member ‘EfusePowerSwitch’ in read-only object
drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c:3624:2: error: assignment of member ‘ReadEFuse’ in read-only object
drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c:3625:2: error: assignment of member ‘EFUSEGetEfuseDefinition’ in read-only object
drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c:3626:2: error: assignment of member ‘EfuseGetCurrentSize’ in read-only object
drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c:3627:2: error: assignment of member ‘Efuse_PgPacketRead’ in read-only object
drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c:3628:2: error: assignment of member ‘Efuse_PgPacketWrite’ in read-only object
drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c:3629:2: error: assignment of member ‘Efuse_WordEnableDataWrite’ in read-only object
drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c:3632:2: error: assignment of member ‘sreset_init_value’ in read-only object
drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c:3633:2: error: assignment of member ‘sreset_reset_value’ in read-only object
drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c:3634:2: error: assignment of member ‘silentreset’ in read-only object
drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c:3635:2: error: assignment of member ‘sreset_xmit_status_check’ in read-only object
drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c:3636:2: error: assignment of member ‘sreset_linked_status_check’ in read-only object
drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c:3637:2: error: assignment of member ‘sreset_get_wifi_status’ in read-only object
drivers/net/wireless/rtl8192cu/hal/rtl8192c/rtl8192c_hal_init.c:3641:2: error: assignment of member ‘IOL_exec_cmds_sync’ in read-only object


and the resposible code is:

Code: Select all
void rtl8192c_set_hal_ops (struct hal_ops *pHalFunc)
{
   pHalFunc->free_hal_data = &rtl8192c_free_hal_data;

   pHalFunc->dm_init = &rtl8192c_init_dm_priv;
   pHalFunc->dm_deinit = &rtl8192c_deinit_dm_priv;
   pHalFunc->read_chip_version = &rtl8192c_read_chip_version;

   pHalFunc->set_bwmode_handler = &PHY_SetBWMode8192C;
   pHalFunc->set_channel_handler = &PHY_SwChnl8192C;

   pHalFunc->hal_dm_watchdog = &rtl8192c_HalDmWatchDog;

   pHalFunc->Add_RateATid = &rtl8192c_Add_RateATid;

#ifdef CONFIG_ANTENNA_DIVERSITY
   pHalFunc->SwAntDivBeforeLinkHandler = &SwAntDivBeforeLink8192C;
   pHalFunc->SwAntDivCompareHandler = &SwAntDivCompare8192C;
#endif

   pHalFunc->read_bbreg = &rtl8192c_PHY_QueryBBReg;
   pHalFunc->write_bbreg = &rtl8192c_PHY_SetBBReg;
   pHalFunc->read_rfreg = &rtl8192c_PHY_QueryRFReg;
   pHalFunc->write_rfreg = &rtl8192c_PHY_SetRFReg;

   //Efuse related function
   pHalFunc->EfusePowerSwitch = &rtl8192c_EfusePowerSwitch;
   pHalFunc->ReadEFuse = &rtl8192c_ReadEFuse;
   pHalFunc->EFUSEGetEfuseDefinition = &rtl8192c_EFUSE_GetEfuseDefinition;
   pHalFunc->EfuseGetCurrentSize = &rtl8192c_EfuseGetCurrentSize;
   pHalFunc->Efuse_PgPacketRead = &rtl8192c_Efuse_PgPacketRead;
   pHalFunc->Efuse_PgPacketWrite = &rtl8192c_Efuse_PgPacketWrite;
   pHalFunc->Efuse_WordEnableDataWrite = &rtl8192c_Efuse_WordEnableDataWrite;

#ifdef DBG_CONFIG_ERROR_DETECT
   pHalFunc->sreset_init_value = &rtl8192c_sreset_init_value;
   pHalFunc->sreset_reset_value = &rtl8192c_sreset_reset_value;
   pHalFunc->silentreset = &rtl8192c_silentreset_for_specific_platform;
   pHalFunc->sreset_xmit_status_check = &rtl8192c_sreset_xmit_status_check;
   pHalFunc->sreset_linked_status_check  = &rtl8192c_sreset_linked_status_check;
   pHalFunc->sreset_get_wifi_status  = &rtl8192c_sreset_get_wifi_status;
#endif

#ifdef CONFIG_IOL
   pHalFunc->IOL_exec_cmds_sync = &rtl8192c_IOL_exec_cmds_sync;
#endif
}


Anyone have an idea how to apply __no_const on this peace of code?

Thanks in advance,
NaN
Last edited by NaN on Tue Dec 10, 2013 5:11 pm, edited 1 time in total.
NaN
 
Posts: 2
Joined: Wed Dec 04, 2013 4:29 pm

Re: __no_const & rtl8192c_hal_init.c

Postby PaX Team » Wed Dec 04, 2013 5:37 pm

this driver isn't part of any vanilla kernel i looked at so i can only guess. in general, if the ops structure is never statically allocated then you'd put __no_const on the type declaration.
PaX Team
 
Posts: 2310
Joined: Mon Mar 18, 2002 4:35 pm

Re: __no_const & rtl8192c_hal_init.c

Postby NaN » Tue Dec 10, 2013 4:39 pm

Ok, nice, patched with __no_const all files successfully.

Now I'm encountering another issue - in the kernel source there is no driver rtl8188eu, so I have downloaded the source and began with compilation. However, when I'll try to load the module I'm gettin:

8188eu: version magic '3.11.6-modded-grsec mod_unload modversions ARMv6 p2v8 REFCOUNT GRSEC ' should be '3.11.6-modded-grsec mod_unload modversions ARMv6 p2v8 REFCOUNT CONSTIFY_PLUGIN GRSEC '


I can notice the "CONSTIFT_PLUGIN" string - do I need to patch this driver somehow?

Thanks,
NaN

EDIT:
Ok, problem solved. Added to makefile -DCONSTIFY_PLUGIN. This topic can be closed.
NaN
 
Posts: 2
Joined: Wed Dec 04, 2013 4:29 pm

Re: [SOLVED] __no_const & rtl8192c_hal_init.c

Postby PaX Team » Wed Dec 11, 2013 6:55 am

if you have a modversion mismatch then you must have compiled your module against a different kernel build tree (which has .config among others) than the kernel itself, so the proper fix is not to manually define whatever makes the modversions match but to (re)compile the module in question against the proper kernel build tree.
PaX Team
 
Posts: 2310
Joined: Mon Mar 18, 2002 4:35 pm


Return to grsecurity support