How can I change the CONFIG_ARCH_OPTIONAL_KERNEL_RWX value? by changing arch/Kconfig file directly? - linux

I had asked a quesion at kernelnewbies email list and later I thought I found the answer (I thought I can put it in my defconfig). But then later found it was my mistake. So I still have the question and I ask it here to get answer.
This is what I see when I search “KERNEL_RWX” during “make menuconfig” for arm64 kernel(5-10.0-rc5).
The Kconfig file says CONFIG_STRICT_KERNEL_RWX is for setting text and rodata read-only.
Symbol: ARCH_OPTIONAL_KERNEL_RWX [=n]
Type : bool
Defined at arch/Kconfig:928
Symbol: ARCH_OPTIONAL_KERNEL_RWX_DEFAULT [=n]
Type : bool
Defined at arch/Kconfig:931
Symbol: STRICT_KERNEL_RWX [=y]
Type : bool
Defined at arch/Kconfig:937
Prompt: Make kernel text and rodata read-only
Depends on: ARCH_HAS_STRICT_KERNEL_RWX [=y]
Visible if: ARCH_HAS_STRICT_KERNEL_RWX [=y] && ARCH_OPTIONAL_KERNEL_RWX [=n]
Location:
(1) -> General architecture-dependent options
I wanted to try setting STRICT_KERNEL_RWX to =n. The 'Visible if' descriptionn says this option is visible when ARCH_OPTIONAL_KERNEL_RWX is =y which is now =n. (The STRICT_KERNEL_RWX menu didn't appear as a configurable menu in the menuconfig at this time). This is the lines in arch/Kconfig.
config ARCH_OPTIONAL_KERNEL_RWX
def_bool n
So I modified to ARCH_OPTIONAL_KERNEL_RWX=y in arch/Kconfig line 928. (BTW, This is question : is it correct to modify this Kconfig file directly? I’m not sure at the moment)
Then I could see the STRICT_KERNEL_RWX menu in the menuconfig and I set it to =n as I wanted.
But when I build the kernel, I see this errors.
ckim#ckim-ubuntu:~/ProjX/LinuxDevDrv/kernel-release-RD-INFRA-2020.11.30$ makeit
CALL scripts/atomic/check-atomics.sh
CALL scripts/checksyscalls.sh
CHK include/generated/compile.h
CC arch/arm64/mm/mmu.o
arch/arm64/mm/mmu.c: In function 'parse_rodata':
arch/arm64/mm/mmu.c:595:28: error: 'rodata_enabled' undeclared (first use in this function)
595 | int ret = strtobool(arg, &rodata_enabled);
| ^~~~~~~~~~~~~~
arch/arm64/mm/mmu.c:595:28: note: each undeclared identifier is reported only once for each function it appears in
arch/arm64/mm/mmu.c: In function 'map_entry_trampoline':
arch/arm64/mm/mmu.c:614:18: error: 'rodata_enabled' undeclared (first use in this function)
614 | pgprot_t prot = rodata_enabled ? PAGE_KERNEL_ROX : PAGE_KERNEL_EXEC;
| ^~~~~~~~~~~~~~
arch/arm64/mm/mmu.c: In function 'map_kernel':
arch/arm64/mm/mmu.c:669:23: error: 'rodata_enabled' undeclared (first use in this function)
669 | pgprot_t text_prot = rodata_enabled ? PAGE_KERNEL_ROX : PAGE_KERNEL_EXEC;
| ^~~~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:283: arch/arm64/mm/mmu.o] Error 1
make[1]: *** [scripts/Makefile.build:500: arch/arm64/mm] Error 2
make: *** [Makefile:1799: arch/arm64] Error 2
variable “rodata_enabled” is defined in init/main.c as below.
#if defined(CONFIG_STRICT_KERNEL_RWX) || defined(CONFIG_STRICT_MODULE_RWX)
bool rodata_enabled __ro_after_init = true;
static int __init set_debug_rodata(char *str)
{
return strtobool(str, &rodata_enabled);
}
__setup("rodata=", set_debug_rodata);
#endif
But now that CONFIG_STRICT_KERNEL_RWX=n, the above lines are not compiled here (CONFIG_STRICT_MODULE_RWX=n too). However, arch/arm64/mm/mmu.c code is still using rodata_enabled. Is this a bug of the code? Or am I missing something?
I can modify init/main.c and include/linux/init.h so that this rodata_enabled and related functions be defined regardless of these CONFIG values and make the errors go away, but I’m curious if this a kind of kernel bug raising compiler error.
So again my question is how should I change ARCH_OPTIONAL_KERNEL_RWX value? I tried setting it in my defconfig file but when I do make xxx_defonfig, the .config file shows still ARCH_OPTIONAL_KERNEL_RWX=n. Should I edit the arch/Kconfig file really?

Related

How to implement a TBB input_node?

Apparently in tbb::flow the source_node has been deprecated, and starting in the 2021.1 version we are only supposed to use input_node. Simply replacing the class does not seem to work, though. I have a working code using source_node in version 2020.3. If I try using input_node I get a cryptic message.
It seems input_node expects Body to implement a function that takes a flow_control object. Is this the case? Otherwise what is wrong here?
I cannot seem to be able to run any example codes with input_body.
====================[ Build | capybara | Debug-System ]==========================
/home/nicolau/bin/clion-2020.1.1/bin/cmake/linux/bin/cmake --build /home/nicolau/src/capybara/cmake-build-debug-system --target capybara -- -j 9
Scanning dependencies of target capybara
[ 50%] Building CXX object CMakeFiles/capybara.dir/main.cpp.o
In file included from /home/nicolau/src/oneapi-tbb-2021.1-beta08/include/tbb/flow_graph.h:345:0,
from /home/nicolau/src/capybara/main.cpp:9:
/home/nicolau/src/oneapi-tbb-2021.1-beta08/include/tbb/detail/_flow_graph_body_impl.h: In instantiation of ‘Output tbb::detail::d1::input_body_leaf<Output, Body>::operator()(tbb::detail::d1::flow_control&) [with Output = std::tuple<cv::Mat, std::chrono::time_point<std::chrono::_V2::system_clock, std::chrono::duration<long int, std::ratio<1, 1000000000> > > >; Body = main(int, char**)::<lambda(imgtv&)>]’:
/home/nicolau/src/capybara/main.cpp:424:1: required from here
/home/nicolau/src/oneapi-tbb-2021.1-beta08/include/tbb/detail/_flow_graph_body_impl.h:88:66: error: no match for call to ‘(main(int, char**)::<lambda(imgtv&)>) (tbb::detail::d1::flow_control&)’
Output operator()(flow_control& fc) override { return body(fc); }
^
/home/nicolau/src/capybara/main.cpp:350:58: note: candidate: main(int, char**)::<lambda(imgtv&)>
tbb::flow::input_node<imgtv> src(g, [&](imgtv &v) -> bool {
^~~~
/home/nicolau/src/capybara/main.cpp:350:58: note: no known conversion for argument 1 from ‘tbb::detail::d1::flow_control’ to ‘imgtv& {aka std::tuple<cv::Mat, std::chrono::time_point<std::chrono::_V2::system_clock, std::chrono::duration<long int, std::ratio<1, 1000000000> > > >&}’
CMakeFiles/capybara.dir/build.make:82: recipe for target 'CMakeFiles/capybara.dir/main.cpp.o' failed
make[3]: *** [CMakeFiles/capybara.dir/main.cpp.o] Error 1
CMakeFiles/Makefile2:95: recipe for target 'CMakeFiles/capybara.dir/all' failed
make[2]: *** [CMakeFiles/capybara.dir/all] Error 2
CMakeFiles/Makefile2:102: recipe for target 'CMakeFiles/capybara.dir/rule' failed
make[1]: *** [CMakeFiles/capybara.dir/rule] Error 2
Makefile:138: recipe for target 'capybara' failed
make: *** [capybara] Error 2
Apparently the interface has changed compared to source_node, and the function is now supposed to take a flow_control reference and return the new input object as output.
https://github.com/oneapi-src/oneTBB/issues/270#issuecomment-683645172

How do I fix this libgcrypt cross-compilation error?

I'm trying to cross compile GPG for an ElinOS on a board with an imx6. I have a problem when I compile libgcrypt. First, here's what I do:
export PATH=/opt/elinos/cdk/arm/v7hf/glibc/bin:$PATH
./configure --host=arm-unknown-linux-gnueabihf --build=i686-pc-linux-gnu
make all
The configuration part shows no errors or warning, but the make displays this:
hwf-arm.c:31:3: error: #error Module build for wrong CPU.
# error Module build for wrong CPU.
^
hwf-arm.c: In function 'get_hwcap':
hwf-arm.c:126:26: error: 'AT_HWCAP' undeclared (first use in this function)
if (auxv.a_type == AT_HWCAP)
^
hwf-arm.c:126:26: note: each undeclared identifier is reported only once for each function it appears in
hwf-arm.c:132:26: error: 'AT_HWCAP2' undeclared (first use in this function)
if (auxv.a_type == AT_HWCAP2)
^
In file included from hwf-arm.c:27:0:
hwf-arm.c: In function 'detect_arm_at_hwcap':
hwf-arm.c:159:23: error: 'arm_features' undeclared (first use in this function)
for (i = 0; i < DIM(arm_features); i++)
^
g10lib.h:96:24: note: in definition of macro 'DIM'
#define DIM(v) (sizeof(v)/sizeof((v)[0]))
^
hwf-arm.c: In function 'detect_arm_proc_cpuinfo':
hwf-arm.c:250:23: error: 'arm_features' undeclared (first use in this function)
for (i = 0; i < DIM(arm_features); i++)
^
g10lib.h:96:24: note: in definition of macro 'DIM'
#define DIM(v) (sizeof(v)/sizeof((v)[0]))
The first error leads me to this part of the code :
#if !defined (__arm__) && !defined (__aarch64__)
# error Module build for wrong CPU.
#endif
Any idea where this comes from? It looks like a configuration problem, but I'm not sure where to look now.
In the config.log file, CC was setup correctly: CC='arm-unknown-linux-gnueabihf-gcc'.
Yet I needed to specify it in the make command. So instead of simply using make all, which didn't work, I had to use make all CC=arm-unknown-linux-gnueabihf-gcc.

rt2870.o/rt2870.ko usb wireless adupter installation issue

i am using parrot Linux the latest version . i want to install/use a nano adapter (802.11n) USB
i tried several ways but i failed
tried 1
after trying this i found no other way to ask for help
the following error i am getting while using make && make install
└──╼ #sudo make && make install
make -C tools
make[1]: Entering directory '/home/ano/Downloads/linux/tools'
gcc -g bin2h.c -o bin2h
make[1]: Leaving directory '/home/ano/Downloads/linux/tools'
/home/ano/Downloads/linux/tools/bin2h
cp -f os/linux/Makefile.6 /home/ano/Downloads/linux/os/linux/Makefile
make -C /lib/modules/4.1.8-parrot-686-pae/build SUBDIRS=/home/ano/Downloads/linux/os/linux modules
make[1]: Entering directory '/usr/src/linux-headers-4.1.8-parrot-686-pae'
CC [M] /home/ano/Downloads/linux/os/linux/../../os/linux/rt_profile.o
/home/ano/Downloads/linux/os/linux/../../os/linux/rt_profile.c: In function ‘announce_802_3_packet’:
/home/ano/Downloads/linux/os/linux/../../os/linux/rt_profile.c:331:16: warning: unused variable ‘pAd’ [-Wunused-variable]
RTMP_ADAPTER *pAd = (RTMP_ADAPTER *)pAdSrc;
^
CC [M] /home/ano/Downloads/linux/os/linux/../../sta/assoc.o
CC [M] /home/ano/Downloads/linux/os/linux/../../sta/auth.o
CC [M] /home/ano/Downloads/linux/os/linux/../../sta/auth_rsp.o
CC [M] /home/ano/Downloads/linux/os/linux/../../sta/sync.o
/home/ano/Downloads/linux/os/linux/../../sta/sync.c: In function ‘PeerBeacon’:
/home/ano/Downloads/linux/os/linux/../../sta/sync.c:2180:12: warning: passing argument 8 of ‘StaAddMacTableEntry’ from incompatible pointer type
ie_list,
^
In file included from /home/ano/Downloads/linux/include/rt_config.h:59:0,
from /home/ano/Downloads/linux/os/linux/../../sta/sync.c:28:
/home/ano/Downloads/linux/include/rtmp.h:7892:9: note: expected ‘struct IE_LISTS *’ but argument is of type ‘struct BCN_IE_LIST *’
BOOLEAN StaAddMacTableEntry(
^
CC [M] /home/ano/Downloads/linux/os/linux/../../sta/sanity.o
CC [M] /home/ano/Downloads/linux/os/linux/../../sta/rtmp_data.o
/home/ano/Downloads/linux/os/linux/../../sta/rtmp_data.c: In function ‘STAHandleRxDataFrame’:
/home/ano/Downloads/linux/os/linux/../../sta/rtmp_data.c:523:33: warning: passing argument 2 of ‘MacTableLookup’ from incompatible pointer type
pEntry = MacTableLookup(pAd, &pHeader->Addr2);
^
In file included from /home/ano/Downloads/linux/include/rt_config.h:59:0,
from /home/ano/Downloads/linux/os/linux/../../sta/rtmp_data.c:28:
/home/ano/Downloads/linux/include/rtmp.h:8429:18: note: expected ‘UCHAR *’ but argument is of type ‘UCHAR (*)[6]’
MAC_TABLE_ENTRY *MacTableLookup(RTMP_ADAPTER *pAd, UCHAR *pAddr);
^
CC [M] /home/ano/Downloads/linux/os/linux/../../sta/connect.o
CC [M] /home/ano/Downloads/linux/os/linux/../../sta/wpa.o
CC [M] /home/ano/Downloads/linux/os/linux/../../sta/sta_cfg.o
/home/ano/Downloads/linux/os/linux/../../sta/sta_cfg.c: In function ‘RTMPIoctlRF’:
/home/ano/Downloads/linux/os/linux/../../sta/sta_cfg.c:5306:7: warning: format ‘%X’ expects argument of type ‘unsigned int’, but argument 5 has type ‘LONG’ [-Wformat=]
sprintf(msg+strlen(msg), "BANK%d_R%02d:%02X ", bank_Id, rfId, rfValue);
^
/home/ano/Downloads/linux/os/linux/../../sta/sta_cfg.c:5359:27: warning: passing argument 2 of ‘RtmpDrvAllRFPrint’ from incompatible pointer type
RtmpDrvAllRFPrint(NULL, msg, strlen(msg));
^
In file included from /home/ano/Downloads/linux/include/rt_config.h:64:0,
from /home/ano/Downloads/linux/os/linux/../../sta/sta_cfg.c:28:
/home/ano/Downloads/linux/include/rt_os_util.h:668:6: note: expected ‘UINT32 *’ but argument is of type ‘PSTRING’
VOID RtmpDrvAllRFPrint(
^
/home/ano/Downloads/linux/os/linux/../../sta/sta_cfg.c:5209:22: warning: unused variable ‘rf_bank’ [-Wunused-variable]
UCHAR regRF = 0, rf_bank = 0;
^
/home/ano/Downloads/linux/os/linux/../../sta/sta_cfg.c: In function ‘RTMPIoctlShow’:
/home/ano/Downloads/linux/os/linux/../../sta/sta_cfg.c:5766:85: error: macro "__DATE__" might prevent reproducible builds [-Werror=date-time]
snprintf(extra, size, "Driver version-%s, %s %s\n", STA_DRIVER_VERSION, __DATE__, __TIME__ );
^
/home/ano/Downloads/linux/os/linux/../../sta/sta_cfg.c:5766:95: error: macro "__TIME__" might prevent reproducible builds [-Werror=date-time]
snprintf(extra, size, "Driver version-%s, %s %s\n", STA_DRIVER_VERSION, __DATE__, __TIME__ );
^
/home/ano/Downloads/linux/os/linux/../../sta/sta_cfg.c: In function ‘RtmpIoctl_rt_ioctl_siwgenie’:
/home/ano/Downloads/linux/os/linux/../../sta/sta_cfg.c:7610:13: warning: assignment from incompatible pointer type
eid_ptr = pAd->StaCfg.pWpaAssocIe;
^
cc1: some warnings being treated as errors
scripts/Makefile.build:258: recipe for target '/home/ano/Downloads/linux/os/linux/../../sta/sta_cfg.o' failed
make[2]: *** [/home/ano/Downloads/linux/os/linux/../../sta/sta_cfg.o] Error 1
Makefile:1384: recipe for target '_module_/home/ano/Downloads/linux/os/linux' failed
make[1]: *** [_module_/home/ano/Downloads/linux/os/linux] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.1.8-parrot-686-pae'
Makefile:394: recipe for target 'LINUX' failed
make: *** [LINUX] Error 2
can one please check and help me on it ....
I got that error, too, on a fresh Debian installation, despite being able to make that driver flawlessly a few times before.
Some problems were gone when I edited the os/linux/config.mk file as per the README file included in the driver folder, but then, new ones occured, considering something about the DATE and TIME functions.
I found that the solution is to install package firmware-ralink that also contains drivers for your USB Wireless dongle.
On my Debian Jessie installation, it said that firmware-ralink package is now included in the firmware-non-free package.

D3D11CreateDevice causes a reading access violation

The Code & Question
I'm trying out Microsoft's Application Verifier and hitting a read-access violation on the simple code below. Is this my fault? If not, who should I report this to?
#include <D3D11_1.h>
#pragma comment(lib, "d3d11.lib")
void main()
{
ID3D11Device* device = NULL;
D3D11CreateDevice(
NULL,
D3D_DRIVER_TYPE_HARDWARE,
NULL,
0,
NULL,
0,
D3D11_SDK_VERSION,
&device,
NULL,
NULL);
}
Application Verifier Output
Page heap: pid 0x1034: page heap enabled with flags 0x3.
AVRF: D3D11_Fails_AppVerifier.exe: pid 0x1034: flags 0x81643027: application verifier enabled
First-chance exception at 0x00007FFA4EA681B9 (atiuxp64.dll) in D3D11_Fails_AppVerifier.exe: 0xC0000005: Access violation reading location 0x0000009411813000.
=======================================
VERIFIER STOP 0000000000000013: pid 0x1034: First chance access violation for current stack trace.
0000009411813000 : Invalid address causing the exception.
00007FFA4EA681B9 : Code address executing the invalid access.
000000940FA5B430 : Exception record.
000000940FA5AF40 : Context record.
WinDBG Callstack
*** ERROR: Symbol file could not be found. Defaulted to export symbols for vrfcore.dll -
vrfcore!VerifierStopMessageEx+0x6f4:
00007ffa`48d33a00 cc int 3
0:000> k
Child-SP RetAddr Call Site
00000094`0fa5a1b0 00007ffa`48d39d20 vrfcore!VerifierStopMessageEx+0x6f4
*** ERROR: Symbol file could not be found. Defaulted to export symbols for verifier.dll -
00000094`0fa5a510 00007ffa`48c5a9d0 vrfcore!VerifierDisableVerifier+0x948
00000094`0fa5a5a0 00007ffa`54b6a743 verifier!VerifierStopMessage+0xa0
*** ERROR: Module load completed but symbols could not be loaded for vfbasics.dll
00000094`0fa5a640 00007ffa`48cc62d9 ntdll!RtlApplicationVerifierStop+0x103
00000094`0fa5a6a0 00007ffa`48cc8246 vfbasics+0x62d9
00000094`0fa5a700 00007ffa`48cc787e vfbasics+0x8246
00000094`0fa5a790 00007ffa`54af5f42 vfbasics+0x787e
00000094`0fa5a7e0 00007ffa`54af4763 ntdll!RtlRestoreContext+0x182
00000094`0fa5a870 00007ffa`54b330aa ntdll!RtlRaiseException+0xe33
00000094`0fa5af40 00007ffa`4ea681b9 ntdll!KiUserExceptionDispatcher+0x3a
*** ERROR: Symbol file could not be found. Defaulted to export symbols for atiuxp64.dll -
00000094`0fa5b658 00000094`1170b0f0 atiuxp64!OpenAdapter10_2+0x12525
00000094`0fa5b660 00000094`0fa5b800 0x00000094`1170b0f0
00000094`0fa5b668 00007ffa`4ea5aa93 0x00000094`0fa5b800
00000094`0fa5b670 00007ffa`4ea55dbe atiuxp64!OpenAdapter10_2+0x4dff
*** ERROR: Symbol file could not be found. Defaulted to export symbols for aticfx64.dll -
00000094`0fa5b720 00007ffa`4f18120e atiuxp64!OpenAdapter10_2+0x12a
*** ERROR: Symbol file could not be found. Defaulted to export symbols for d3d11.dll -
00000094`0fa5b750 00007ffa`4f3a88c1 aticfx64!OpenAdapter10_2+0x13e
00000094`0fa5b780 00007ffa`4f3a8691 d3d11!D3D11CoreCreateLayeredDevice+0x1ba1
00000094`0fa5b8a0 00007ffa`4f3a85db d3d11!D3D11CoreCreateLayeredDevice+0x1971
00000094`0fa5b900 00007ffa`4f387f3d d3d11!D3D11CoreCreateLayeredDevice+0x18bb
00000094`0fa5ba30 00007ffa`4f387e60 d3d11+0x7f3d
00000094`0fa5ba90 00007ffa`4f3a7c6e d3d11+0x7e60
00000094`0fa5bc60 00007ffa`4f3a81fb d3d11!D3D11CoreCreateLayeredDevice+0xf4e
00000094`0fa5c4c0 00007ffa`4f3a80ad d3d11!D3D11CoreCreateLayeredDevice+0x14db
00000094`0fa5c8a0 00007ffa`4f3a6cf9 d3d11!D3D11CoreCreateLayeredDevice+0x138d
00000094`0fa5c8d0 00007ffa`4f3a73cf d3d11!D3D11CoreCreateDevice+0xb09
00000094`0fa5c910 00007ffa`4f3a730b d3d11!D3D11CoreCreateLayeredDevice+0x6af
00000094`0fa5c960 00007ffa`4f3a7295 d3d11!D3D11CoreCreateLayeredDevice+0x5eb
00000094`0fa5c9d0 00007ffa`4f3a6e61 d3d11!D3D11CoreCreateLayeredDevice+0x575
00000094`0fa5caa0 00007ffa`4f3a7573 d3d11!D3D11CoreCreateLayeredDevice+0x141
00000094`0fa5cb40 00007ffa`4f3a5b7f d3d11!D3D11CoreCreateLayeredDevice+0x853
00000094`0fa5f260 00007ffa`4f3a58e4 d3d11!D3D11CreateDeviceAndSwapChain+0x37f
00000094`0fa5f590 00007ffa`4f3a57ec d3d11!D3D11CreateDeviceAndSwapChain+0xe4
00000094`0fa5f650 00007ffa`4f3a576c d3d11!D3D11CreateDevice+0x14c
*** WARNING: Unable to verify checksum for D3D11_Fails_AppVerifier.exe
00000094`0fa5f6c0 00007ff7`a70b1087 d3d11!D3D11CreateDevice+0xcc
00000094`0fa5f770 00007ff7`a70b175d D3D11_Fails_AppVerifier!main+0x77 [c:\_personalprojects\d3d11_fails_appverifier\main.cpp # 18]
00000094`0fa5f800 00007ff7`a70b188e D3D11_Fails_AppVerifier!__tmainCRTStartup+0x19d [f:\dd\vctools\crt_bld\self_64_amd64\crt\src\crtexe.c # 536]
*** ERROR: Symbol file could not be found. Defaulted to export symbols for kernel32.dll -
00000094`0fa5f870 00007ffa`540113d2 D3D11_Fails_AppVerifier!mainCRTStartup+0xe [f:\dd\vctools\crt_bld\self_64_amd64\crt\src\crtexe.c # 377]
00000094`0fa5f8a0 00007ffa`54ab5454 kernel32!BaseThreadInitThunk+0x22
00000094`0fa5f8d0 00000000`00000000 ntdll!RtlUserThreadStart+0x34
My PC's Info
Windows 8.1 Pro 64-bit (6.3, Build 9600)
AMD Radeon (TM) R9 200 Series
AMD Catalyst driver (15.7.1) Up to Date (Last checked 10/15/2015 10:16:39 PM)
App-Verifier no longer detects a read violation after using D3D_DRIVER_TYPE_WARP.
I've contacted AMD. Thanks for the suggestion Chuck Walbourn!

" error: unknown field ‘compat_ioctl’ specified in initializer " while creating dummy ioctl

static const struct inode_operations msdos_dir_inode_operations = {
.create = msdos_create,
.lookup = msdos_lookup,
.unlink = msdos_unlink,
.mkdir = msdos_mkdir,
.rmdir = msdos_rmdir,
.rename = msdos_rename,
.setattr = fat_setattr,
.getattr = fat_getattr,
.compat_ioctl = my_ioctl, ---->error
};
i also tried with unlocked_ioctl but same error occured
[root#localhost fat]# make
make -C /lib/modules/3.11.10-100.fc18.x86_64/build M=/home/aditya/linux-3.12.6/fs/fat modules
make[1]: Entering directory `/usr/src/kernels/3.11.10-100.fc18.x86_64'
CC [M] /home/aditya/linux-3.12.6/fs/fat/namei_msdos.o
/home/aditya/linux-3.12.6/fs/fat/namei_msdos.c:646:2: error: unknown field ‘compat_ioctl’ specified in initializer
/home/aditya/linux-3.12.6/fs/fat/namei_msdos.c:646:2: warning: initialization from incompatible pointer type [enabled by default]
/home/aditya/linux-3.12.6/fs/fat/namei_msdos.c:646:2: warning: (near initialization for ‘msdos_dir_inode_operations.setxattr’) [enabled by default]
make[2]: * [/home/aditya/linux-3.12.6/fs/fat/namei_msdos.o] Error 1
make[1]: * [module/home/aditya/linux-3.12.6/fs/fat] Error 2
make[1]: Leaving directory `/usr/src/kernels/3.11.10-100.fc18.x86_64'
make: * [all] Error 2
The ioctl has been changed for a reason and it would be best if you follow the kernel changes in your driver too. You can not use drivers compiled for one version in another.
The change is not too difficult one.
In the fops structure change
ioctl to unlocked_ioctl
and in the ioctl function in your driver, do not pass the inode pointer. That is all, the rest of the code can remain the same.
see this tutorial for more details

Resources