Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| summerofcode2023projects:lldbkernelmoduleimprovement [2023/06/28 00:28] – feat: add draft of soc lldb project ShengYiHong | summerofcode2023projects:lldbkernelmoduleimprovement [2023/08/30 14:17] (current) – feat: change commit branch to simplify change ShengYiHong | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Project name ====== | ====== Project name ====== | ||
| - | * Student: [[/ShengYi|ShengYi]]-Hong (aokblast@%%FreeBSD%%.org) | + | * Student: [[/ShengYiHong|ShengYiHong]] (<aokblast@FreeBSD.org>) |
| - | * Mentor: | + | * Mentor: |
| ===== Project description ===== | ===== Project description ===== | ||
| Line 21: | Line 21: | ||
| In LLDB’s userspace implementation, | In LLDB’s userspace implementation, | ||
| - | loaded module information, | + | loaded module information, |
| - | edModuleFileSpce | + | |
| What we have to do is to combine LLDB userspace and kgdb in LLDB | What we have to do is to combine LLDB userspace and kgdb in LLDB | ||
| kernel space. | kernel space. | ||
| Line 34: | Line 33: | ||
| 1. LKM parse and LLDB %%FreeBSD%% Kernel Module implementation | 1. LKM parse and LLDB %%FreeBSD%% Kernel Module implementation | ||
| - | ===== Milestones | + | ===== Report |
| - | (5-10 milestones, with dates, indicating when you hope or expect to be able to complete features. This section is mandatory. Please negotiate these with your mentor to make sure you're not under- or over-estimating the amount of work to be done. Please also make sure the following four dates are included within your milestones) | + | * May 29th - June 12th |
| - | * May 14th: Start of coding | + | Busy on my school final exam. |
| - | * You'll be doing this in the first week | + | The development environment have been set up in these weeks. |
| - | * May 21st: Week 2 | + | |
| - | * You plan to do this in the second | + | * June 12th - June 26th |
| - | * June 11th - June 15th: Mid-term Evaluations #1 | + | |
| - | * July 9th - July 13th: Mid-term Evaluations #2 | + | In this week, I implement LLDB interface sketch for %%DynamicLoader%% %%FreeBSD%% Kernel (%%DynamicLoaderFreeBSDKernel%%) that contains parsing kernel loader address and designinbg kld memory Image structure that contain enough information to create lldb Module. |
| - | * August 6th: End of coding (soft) | + | Also, the lldb Module information for Kernel is also parsed so that can provide lldb recognize the Kernel. |
| - | * You may wish to use this time to complete documentation etc | + | |
| - | * August 14th: End of coding (hard) | + | * June 26th - July 10th |
| + | |||
| + | Parse kld info and Finish all implementation about %%DynamicLoaderFreeBSDKernel%%. The kld info is in a linked list structure defined at linked_files symbol that is a TAILQ structure. The necessary member' | ||
| + | Merge the source code from llvm-project to %%FreeBSD%% codebase | ||
| + | |||
| + | * June 14th - July 2th | ||
| + | |||
| + | Found the unloaded debug caused by merging LLDB plugin from llvm codebase | ||
| + | |||
| + | * July 3th - July 17th | ||
| + | |||
| + | Finish all implementation and finally the module can shown and debug symbol can be loaded | ||
| ===== Test Plan ===== | ===== Test Plan ===== | ||
| Line 59: | Line 69: | ||
| ===== The Code ===== | ===== The Code ===== | ||
| - | (Link to your code, for example | + | https://github.com/ |
| + | |||
| + | ===== Final Production ===== | ||
| + | |||
| + | As I have finished implementing %%DynamicLoaderFreeBSDKernel%% class, we have the following feature enabled on LLDB when debugging %%FreeBSDKernel%% Image: | ||
| + | |||
| + | 1. Display all kernel module and it's load address | ||
| + | |||
| + | < | ||
| + | (lldb) image list | ||
| + | [ 0] 013C9080-98CC-F2F1-237C-AFAA727809F7-8144DCF4 0xffffffff80200000 | ||
| + | | ||
| + | [ 1] F67FE954-8379-A3D1-848C-946C8C239092-6EAD3444 0xffffffff81f50000 / | ||
| + | / | ||
| + | [ 2] C580C510-DF33-FB7D-81AC-7989646C889C-26A50D5F 0xffffffff82644000 / | ||
| + | / | ||
| + | [ 3] 34D8ADD5-836D-7AB7-F62E-0C35987F19D0-9659DE07 0xffffffff82b18000 / | ||
| + | / | ||
| + | [ 4] B90304EB-A9FE-5495-9B77-E92790CF6EAF-FC35AA21 0xffffffff82b1c000 / | ||
| + | / | ||
| + | [ 5] 1AC7F0BF-CE67-8AD0-1A14-2E4444489F0E-7742EFF9 0xffffffff82b1f000 / | ||
| + | / | ||
| + | [ 6] CF312DEA-1D10-5C8B-D139-153111326704-24679FD8 0xffffffff82b23000 / | ||
| + | / | ||
| + | [ 7] B2A238B6-767A-D503-ADAC-8C828C613FF4-0D1D1D86 0xffffffff82b27000 / | ||
| + | / | ||
| + | [ 8] 9AF49EC4-8C0D-D9CE-5372-749EFF8A2F50-394D4184 0xffffffff82b2b000 / | ||
| + | / | ||
| + | </ | ||
| + | |||
| + | 2. Display content of a Symbol | ||
| + | |||
| + | < | ||
| + | (lldb) p cryptodev_mod | ||
| + | (moduledata_t) $0 = { | ||
| + | name = 0xffffffff8264718f " | ||
| + | evhand = 0xffffffff82644000 (cryptodev.ko`cryptodev_modevent at cryptodev.c: | ||
| + | priv = 0x0000000000000000 | ||
| + | </ | ||
| + | |||
| + | Of course it's address: | ||
| + | |||
| + | < | ||
| + | (lldb) p & | ||
| + | (moduledata_t *) $3 = 0xffffffff826482b0 | ||
| + | </ | ||
| + | |||
| + | 3. Some information dump from module dump | ||
| + | |||
| + | < | ||
| + | (lldb) image dump symtab cryptodev.ko | ||
| + | Symtab, file = / | ||
| + | Debug symbol | ||
| + | | ||
| + | | ||
| + | ||| | ||
| + | Index | ||
| + | ------- ------ --- --------------- ------------------ ------------------ ------------------ ---------- ---------------------------------- | ||
| + | [ 0] 1 | ||
| + | [ 1] 2 | ||
| + | [ 2] 3 | ||
| + | [ 3] 4 | ||
| + | [ 4] 5 | ||
| + | [ 5] 6 | ||
| + | [ 6] 7 | ||
| + | [ 7] 8 | ||
| + | [ 8] 9 | ||
| + | [ 9] | ||
| + | [ | ||
| + | [ | ||
| + | [ | ||
| + | </ | ||