in Education by
I've programmed a kernel module. The module is part of a thesis on the subject of Smartphone Security. The module reads a file and send its content over a UDP socket. The module is working correctly on Ubuntu. I've compiled it for the right android kernel (2.6.29). Under Android: Insmod works correctly. I get some errors when a UDP packet is received. I suspect it has something to do with the file reading. First of all the error message: hiJack: Starting LKM! hiJack: Sending answer! hiJack: Reading queue! hiJack: Opening File! Unable to handle kernel NULL pointer dereference at virtual address 0000001e pgd = c0004000 [0000001e] *pgd=00000000 Internal error: Oops: 817 [#1] Modules linked in: hiJack CPU: 0 Not tainted (2.6.29 #3) PC is at readFile+0x84/0xec [hiJack] LR is at call_rcu+0x28/0x48 pc : [] lr : [] psr: a0000013 sp : c2a27ef0 ip : 000007ff fp : c2a27f0c r10: c2a27f38 r9 : c2a27f1c r8 : 00000000 r7 : 00000000 r6 : 00000000 r5 : 00000000 r4 : fffffffe r3 : 00000000 r2 : 00000000 r1 : bf000b38 r0 : fffffffe Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel Control: 00093177 Table: 02bfc000 DAC: 00000017 LR: 0xc0069e94: 9e94 e5831000 e121f002 e89da810 c02fd2d8 e1a0c00d e92dd830 e24cb004 e5801004 9eb4 e10f4000 e3843080 e121f003 e59f101c e59f201c ebffffc7 e3140080 0a000001 9ed4 e121f004 e89da830 e121f004 e89da830 c02fd2ec c03280ec e1a0c00d e92dd830 9ef4 e24cb004 e5801004 e10f4000 e3843080 e121f003 e59f101c e59f201c ebffffb5 9f14 e3140080 0a000001 e121f004 e89da830 e121f004 e89da830 c02fd2d8 c03280b0 9f34 e1a0c00d e92dd8f0 e24cb004 e5913010 e1a04001 e3530000 e1a05000 0a00004c 9f54 e10f2000 e3823080 e121f003 e5903004 e591100c e0610003 e3500000 a594301c 9f74 a5843014 a5843018 aa000003 e2611001 e1710003 55943018 55843014 e5941014 SP: 0xc2a27e70: 7e70 c2a27e94 c2a27e80 60000013 00000004 c6043430 c0312fb8 ffffffff c2a27edc 7e90 00000000 00000000 c2a27f0c c2a27ea8 c024580c c00221d4 fffffffe bf000b38 7eb0 00000000 00000000 fffffffe 00000000 00000000 00000000 00000000 c2a27f1c 7ed0 c2a27f38 c2a27f0c 000007ff c2a27ef0 c0069f14 bf0000ac a0000013 ffffffff 7ef0 c2a26000 00000000 00000000 c783a2c0 c2a27f7c c2a27f10 bf000170 bf000034 7f10 c024778c bf000b24 c02f201c c6043400 00000017 c02f4e10 c6043400 c02f4f80 7f30 c2a27f54 c2a27f40 c0247814 c0247764 c0312f80 c2a26000 c2a27f9c c2a27f58 7f50 c0243e4c c2988240 c2a26000 bf000114 00000000 00000000 00000000 00000000 FP: 0xc2a27e8c: 7e8c c2a27edc 00000000 00000000 c2a27f0c c2a27ea8 c024580c c00221d4 fffffffe 7eac bf000b38 00000000 00000000 fffffffe 00000000 00000000 00000000 00000000 7ecc c2a27f1c c2a27f38 c2a27f0c 000007ff c2a27ef0 c0069f14 bf0000ac a0000013 7eec ffffffff c2a26000 00000000 00000000 c783a2c0 c2a27f7c c2a27f10 bf000170 7f0c bf000034 c024778c bf000b24 c02f201c c6043400 00000017 c02f4e10 c6043400 7f2c c02f4f80 c2a27f54 c2a27f40 c0247814 c0247764 c0312f80 c2a26000 c2a27f9c 7f4c c2a27f58 c0243e4c c2988240 c2a26000 bf000114 00000000 00000000 00000000 7f6c 00000000 c2a27f9c c2a27f80 c004aaec bf000120 c2988240 c2a26000 c2a27fa4 R9: 0xc2a27e9c: 7e9c c2a27ea8 c024580c c00221d4 fffffffe bf000b38 00000000 00000000 fffffffe 7ebc 00000000 00000000 00000000 00000000 c2a27f1c c2a27f38 c2a27f0c 000007ff 7edc c2a27ef0 c0069f14 bf0000ac a0000013 ffffffff c2a26000 00000000 00000000 7efc c783a2c0 c2a27f7c c2a27f10 bf000170 bf000034 c024778c bf000b24 c02f201c 7f1c c6043400 00000017 c02f4e10 c6043400 c02f4f80 c2a27f54 c2a27f40 c0247814 7f3c c0247764 c0312f80 c2a26000 c2a27f9c c2a27f58 c0243e4c c2988240 c2a26000 7f5c bf000114 00000000 00000000 00000000 00000000 c2a27f9c c2a27f80 c004aaec 7f7c bf000120 c2988240 c2a26000 c2a27fa4 c2988248 c2a27fd4 c2a27fa0 c004b1f0 R10: 0xc2a27eb8: 7eb8 fffffffe 00000000 00000000 00000000 00000000 c2a27f1c c2a27f38 c2a27f0c 7ed8 000007ff c2a27ef0 c0069f14 bf0000ac a0000013 ffffffff c2a26000 00000000 7ef8 00000000 c783a2c0 c2a27f7c c2a27f10 bf000170 bf000034 c024778c bf000b24 7f18 c02f201c c6043400 00000017 c02f4e10 c6043400 c02f4f80 c2a27f54 c2a27f40 7f38 c0247814 c0247764 c0312f80 c2a26000 c2a27f9c c2a27f58 c0243e4c c2988240 7f58 c2a26000 bf000114 00000000 00000000 00000000 00000000 c2a27f9c c2a27f80 7f78 c004aaec bf000120 c2988240 c2a26000 c2a27fa4 c2988248 c2a27fd4 c2a27fa0 7f98 c004b1f0 c004aa38 d0fe328e 00000000 c6043400 c004eecc c2a27fb0 c2a27fb0 Process hiJack-workqueu (pid: 305, stack limit = 0xc2a26268) Stack: (0xc2a27ef0 to 0xc2a28000) 7ee0: c2a26000 00000000 00000000 c783a2c0 7f00: c2a27f7c c2a27f10 bf000170 bf000034 c024778c bf000b24 c02f201c c6043400 7f20: 00000017 c02f4e10 c6043400 c02f4f80 c2a27f54 c2a27f40 c0247814 c0247764 7f40: c0312f80 c2a26000 c2a27f9c c2a27f58 c0243e4c c2988240 c2a26000 bf000114 7f60: 00000000 00000000 00000000 00000000 c2a27f9c c2a27f80 c004aaec bf000120 7f80: c2988240 c2a26000 c2a27fa4 c2988248 c2a27fd4 c2a27fa0 c004b1f0 c004aa38 7fa0: d0fe328e 00000000 c6043400 c004eecc c2a27fb0 c2a27fb0 c2a26000 c004b0ec 7fc0: c2988240 00000000 c2a27ff4 c2a27fd8 c004e9b0 c004b0f8 00000000 00000000 7fe0: 00000000 00000000 00000000 c2a27ff8 c003da58 c004e964 00000000 0000001b Backtrace: [] (readFile+0x0/0xec [hiJack]) from [] (send_answer+0x5c/0x174 [hiJack]) r7:c783a2c0 r6:00000000 r5:00000000 r4:c2a26000 [] (send_answer+0x0/0x174 [hiJack]) from [] (run_workqueue+0xc0/0x148) [] (run_workqueue+0x0/0x148) from [] (worker_thread+0x104/0x118) r7:c2988248 r6:c2a27fa4 r5:c2a26000 r4:c2988240 [] (worker_thread+0x0/0x118) from [] (kthread+0x58/0x94) r7:00000000 r6:c2988240 r5:c004b0ec r4:c2a26000 [] (kthread+0x0/0x94) from [] (do_exit+0x0/0x6e0) r7:00000000 r6:00000000 r5:00000000 r4:00000000 Code: ee032f10 e1a02007 e1a03fc2 e59f105c (e1c022f0) Kernel panic - not syncing: Fatal exception Has anyone any idea what's wrong? I would be very grateful if someone could help me. This is the output after I added the error handling. hiJack: Starting LKM! hiJack: IN Port: 44552 hiJack: Sending answer! hiJack: Reading queue! hiJack: Opening File! Unable to handle kernel paging request at virtual address fffffffe pgd = c0004000 [fffffffe] *pgd=004a0031, *pte=00000000, *ppte=00000000 Internal error: Oops: 17 [#1] Modules linked in: hiJack CPU: 0 Not tainted (2.6.29 #3) PC is at send_answer+0x5c/0x198 [hiJack] LR is at call_rcu+0x28/0x48 pc : [] lr : [] psr: 20000013 sp : c4ef5f10 ip : 00000000 fp : c4ef5f7c r10: c4ef5f38 r9 : c4ef5f1c r8 : 00000000 r7 : 00000000 r6 : c28a36a0 r5 : 00000000 r4 : c4ef4000 r3 : 0000000a r2 : c03280b0 r1 : 00002710 r0 : fffffffe Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel Control: 00093177 Table: 00d58000 DAC: 00000017 LR: 0xc0069e94: 9e94 e5831000 e121f002 e89da810 c02fd2d8 e1a0c00d e92dd830 e24cb004 e5801004 9eb4 e10f4000 e3843080 e121f003 e59f101c e59f201c ebffffc7 e3140080 0a000001 9ed4 e121f004 e89da830 e121f004 e89da830 c02fd2ec c03280ec e1a0c00d e92dd830 9ef4 e24cb004 e5801004 e10f4000 e3843080 e121f003 e59f101c e59f201c ebffffb5 9f14 e3140080 0a000001 e121f004 e89da830 e121f004 e89da830 c02fd2d8 c03280b0 9f34 e1a0c00d e92dd8f0 e24cb004 e5913010 e1a04001 e3530000 e1a05000 0a00004c 9f54 e10f2000 e3823080 e121f003 e5903004 e591100c e0610003 e3500000 a594301c 9f74 a5843014 a5843018 aa000003 e2611001 e1710003 55943018 55843014 e5941014 SP: 0xc4ef5e90: 5e90 c4ef5ee4 00000001 00000000 c2832ee0 00000000 c28a36a0 ffffffff c4ef5efc 5eb0 c28a36a0 00000000 c4ef5f7c c4ef5ec8 c024580c c00221d4 fffffffe 00002710 5ed0 c03280b0 0000000a c4ef4000 00000000 c28a36a0 00000000 00000000 c4ef5f1c 5ef0 c4ef5f38 c4ef5f7c 00000000 c4ef5f10 c0069f14 bf00017c 20000013 ffffffff 5f10 c024778c bf000b94 c4eb801c c59fa400 00000015 c02f4e10 c59fa400 c5dc8000 5f30 c4ef5f54 c4ef5f40 c0247814 c0247764 c0312f80 c4ef4000 c4ef5f9c c4ef5f58 5f50 c0243e4c c2816d60 c4ef4000 bf000120 00000000 00000000 00000000 00000000 5f70 c4ef5f9c c4ef5f80 c004aaec bf00012c c2816d60 c4ef4000 c4ef5fa4 c2816d68 FP: 0xc4ef5efc: 5efc c4ef5f10 c0069f14 bf00017c 20000013 ffffffff c024778c bf000b94 c4eb801c 5f1c c59fa400 00000015 c02f4e10 c59fa400 c5dc8000 c4ef5f54 c4ef5f40 c0247814 5f3c c0247764 c0312f80 c4ef4000 c4ef5f9c c4ef5f58 c0243e4c c2816d60 c4ef4000 5f5c bf000120 00000000 00000000 00000000 00000000 c4ef5f9c c4ef5f80 c004aaec 5f7c bf00012c c2816d60 c4ef4000 c4ef5fa4 c2816d68 c4ef5fd4 c4ef5fa0 c004b1f0 5f9c c004aa38 455b97e6 00000000 c59fa400 c004eecc c4ef5fb0 c4ef5fb0 c4ef4000 5fbc c004b0ec c2816d60 00000000 c4ef5ff4 c4ef5fd8 c004e9b0 c004b0f8 00000000 5fdc 00000000 00000000 00000000 00000000 c4ef5ff8 c003da58 c004e964 011a5412 R2: 0xc0328030: 8030 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 8050 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 8070 00000000 00000001 00000001 00000000 00000000 00000000 00000000 00000000 8090 00000000 00000000 00000000 00000000 00000000 00000000 00000000 c7810f60 80b0 00000724 00000001 00000000 00000725 c7cbe650 c03280c0 c37cc3c0 c2832ee0 80d0 0000000a 00000000 c03280d4 0000000a 00000000 00000000 00000000 fffffed4 80f0 00000001 00000000 00000000 00000000 c03280fc c03280fc c03280fc 00000000 8110 00000000 c0328110 0000000a 00000000 00000000 00000000 00000000 00008000 R4: 0xc4ef3f80: 3f80 00000008 00000000 44feb4b8 00000000 44feb460 44faefe8 00000000 44fe7fa0 3fa0 00000000 44feb420 006e0061 00000023 4000d1c8 00000000 44faefd0 00000bd7 3fc0 00000000 00000002 00630069 0000001b 4000d520 00000000 00000002 00000000 3fe0 0075005e 00000023 4000de90 00000000 44faefb0 44fec230 00000000 79926933 4000 00000002 00000001 00000000 c59fa400 c02f6d08 00000000 00000017 c0312f80 4020 c4ef4000 00000420 c02f4e10 c59fa400 c6468240 c5dc8000 c4ef5f9c c4ef5f58 4040 c0243e48 00000000 00000000 00000000 00000000 00000000 00000000 00000000 4060 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 R6: 0xc28a3620: 3620 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 3640 00000000 00000000 00000000 c01b4b08 00000000 00000000 00000000 00000000 3660 00000000 00000000 00000000 c2920a23 c2920a40 c2920a00 c2920a23 000000e8 3680 00000001 00000000 00000000 00000000 00000000 00000000 00000000 00000000 36a0 00000000 00000000 c7b89b80 00000000 00000000 00000000 00000000 c3d46b80 36c0 00000000 00000000 00000000 00000000 00000000 00000011 00000000 00000000 36e0 00000000 00000000 00000000 00000000 00000000 00000011 00000000 0000000e 3700 00060024 00000000 0008000d c01b2ef8 00000001 00000000 00000000 00000000 R9: 0xc4ef5e9c: 5e9c c2832ee0 00000000 c28a36a0 ffffffff c4ef5efc c28a36a0 00000000 c4ef5f7c 5ebc c4ef5ec8 c024580c c00221d4 fffffffe 00002710 c03280b0 0000000a c4ef4000 5edc 00000000 c28a36a0 00000000 00000000 c4ef5f1c c4ef5f38 c4ef5f7c 00000000 5efc c4ef5f10 c0069f14 bf00017c 20000013 ffffffff c024778c bf000b94 c4eb801c 5f1c c59fa400 00000015 c02f4e10 c59fa400 c5dc8000 c4ef5f54 c4ef5f40 c0247814 5f3c c0247764 c0312f80 c4ef4000 c4ef5f9c c4ef5f58 c0243e4c c2816d60 c4ef4000 5f5c bf000120 00000000 00000000 00000000 00000000 c4ef5f9c c4ef5f80 c004aaec 5f7c bf00012c c2816d60 c4ef4000 c4ef5fa4 c2816d68 c4ef5fd4 c4ef5fa0 c004b1f0 R10: 0xc4ef5eb8: 5eb8 c4ef5f7c c4ef5ec8 c024580c c00221d4 fffffffe 00002710 c03280b0 0000000a 5ed8 c4ef4000 00000000 c28a36a0 00000000 00000000 c4ef5f1c c4ef5f38 c4ef5f7c 5ef8 00000000 c4ef5f10 c0069f14 bf00017c 20000013 ffffffff c024778c bf000b94 5f18 c4eb801c c59fa400 00000015 c02f4e10 c59fa400 c5dc8000 c4ef5f54 c4ef5f40 5f38 c0247814 c0247764 c0312f80 c4ef4000 c4ef5f9c c4ef5f58 c0243e4c c2816d60 5f58 c4ef4000 bf000120 00000000 00000000 00000000 00000000 c4ef5f9c c4ef5f80 5f78 c004aaec bf00012c c2816d60 c4ef4000 c4ef5fa4 c2816d68 c4ef5fd4 c4ef5fa0 5f98 c004b1f0 c004aa38 455b97e6 00000000 c59fa400 c004eecc c4ef5fb0 c4ef5fb0 Process hiJack-workqueu (pid: 269, stack limit = 0xc4ef4268) Stack: (0xc4ef5f10 to 0xc4ef6000) 5f00: c024778c bf000b94 c4eb801c c59fa400 5f20: 00000015 c02f4e10 c59fa400 c5dc8000 c4ef5f54 c4ef5f40 c0247814 c0247764 5f40: c0312f80 c4ef4000 c4ef5f9c c4ef5f58 c0243e4c c2816d60 c4ef4000 bf000120 5f60: 00000000 00000000 00000000 00000000 c4ef5f9c c4ef5f80 c004aaec bf00012c 5f80: c2816d60 c4ef4000 c4ef5fa4 c2816d68 c4ef5fd4 c4ef5fa0 c004b1f0 c004aa38 5fa0: 455b97e6 00000000 c59fa400 c004eecc c4ef5fb0 c4ef5fb0 c4ef4000 c004b0ec 5fc0: c2816d60 00000000 c4ef5ff4 c4ef5fd8 c004e9b0 c004b0f8 00000000 00000000 5fe0: 00000000 00000000 00000000 c4ef5ff8 c003da58 c004e964 011a5412 10f80005 Backtrace: [] (send_answer+0x0/0x198 [hiJack]) from [] (run_workqueue+0xc0/0x148) [] (run_workqueue+0x0/0x148) from [] (worker_thread+0x104/0x118) r7:c2816d68 r6:c4ef5fa4 r5:c4ef4000 r4:c2816d60 [] (worker_thread+0x0/0x118) from [] (kthread+0x58/0x94) r7:00000000 r6:c2816d60 r5:c004b0ec r4:c4ef4000 [] (kthread+0x0/0x94) from [] (do_exit+0x0/0x6e0) r7:00000000 r6:00000000 r5:00000000 r4:00000000 Code: eb490d30 e1a01005 e59f0124 ebffffaa (e5d03000) Kernel panic - not syncing: Fatal exception Thank you! JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
It's worth putting some error checking around the call to: phMscd_Filp = filp_open(filename, O_RDONLY, 0); ...before you start trying to dereference the resulting pointer. The returned value from filp_open() should be checked using the IS_ERR() macro. For example, from the fs/reiserfs/journal.c file: journal->j_dev_file = filp_open(jdev_name, 0, 0); if(!IS_ERR(journal->j_dev_file)) { // snip } else { result = PTR_ERR(journal->j_dev_file); // dump a warning using the return code }

Related questions

0 votes
    I am new to OpenCL. I would like to write a generic kernel so later I can extend its use to ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 6, 2022 in Education by JackTerrance
0 votes
    I am new to machine learning and I was following this blog on how to write a model with mobilenet ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 21, 2022 in Education by JackTerrance
0 votes
    Has anyone managed to run an ipynb Python notebook using a local kernel but connecting to a remote GitHub ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 2, 2022 in Education by JackTerrance
0 votes
    Without getting into the details of why, I'm looking for a clean (as possible) way to replace ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 11, 2022 in Education by JackTerrance
0 votes
    I am writing an OpenCL code to assemble a sparse matrix from Finite Element discretization and I would ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 18, 2022 in Education by JackTerrance
0 votes
    ___________ shares the OS kernel of the host system. 1. Virtual Machine 2. Container 3. VMware 4. Hypervisor...
asked Sep 18, 2021 in Education by JackTerrance
0 votes
    Multiple containers running on a single machine all share the same resources such as the operating system kernel for instant boot and ... ? 1. True 2. False 3. Doesn't make sense...
asked Jun 22, 2021 in Technology by JackTerrance
0 votes
    How does synchronize module works of an Ansible?...
asked Jan 29, 2023 in Technology by JackTerrance
0 votes
    What is an ask_pass module?...
asked Jan 28, 2023 in Technology by JackTerrance
0 votes
    Which module you can use to install Apache in Ubuntu OS? 1. yum 2. apt...
asked Jan 27, 2023 in Technology by JackTerrance
0 votes
    Which module can be used to force a handler to run in between two tasks? (1)meta (2)asset (3)flush (4)None of the options...
asked Jan 26, 2023 in Technology by JackTerrance
0 votes
    Which Ansible module is used to manage docker services and containers. (i)docker_login (ii)docker_container (iii)docker (iv)docker_service...
asked Jan 25, 2023 in Technology by JackTerrance
0 votes
    Using which module can you see the list of all the ansible variables? (i)ping (ii)fetch (iii)setup (iv)copy...
asked Jan 25, 2023 in Technology by JackTerrance
0 votes
    Which module can be used to copy files from remote machine to control machine? (i)copy (ii)move (iii)ping (iv)fetch...
asked Jan 25, 2023 in Technology by JackTerrance
0 votes
    Which module will you use to create a directory? (i)file (ii)fetch (iii)copy (iv)template...
asked Jan 24, 2023 in Technology by JackTerrance
...