From 7c884c57d5efaa6de53a4a73fea4655d6ab604f6 Mon Sep 17 00:00:00 2001 From: Anatolii Date: Fri, 19 Nov 2021 10:27:00 +0200 Subject: [PATCH 01/15] TASK1: Implement Hello World Created main.c and run.sh for futher development --- 01_git/scissors/a.out | Bin 0 -> 16696 bytes 01_git/scissors/main.c | 6 ++++++ 01_git/scissors/run.sh | 5 +++++ 3 files changed, 11 insertions(+) create mode 100755 01_git/scissors/a.out create mode 100644 01_git/scissors/main.c create mode 100755 01_git/scissors/run.sh diff --git a/01_git/scissors/a.out b/01_git/scissors/a.out new file mode 100755 index 0000000000000000000000000000000000000000..e92259341b72f5f8b211688227e7d9cc0ba8de91 GIT binary patch literal 16696 zcmeHOZ)_Y#6`%9j$)$K(#_eowvXN) zbGO&p6)Hh)t6HtW;tL2WK|d9#tprjf!Uw=1Q1YQv$rn_p3ZWu!MQxgd1cg7z@!srv z=iTu+NQH0RvF?8Je)Ha&nK!e0v)-An^d2cZp$tG&bc#m! zZV`8jWgyo}&MA*N0HscPv(Ael;)8%_*NmAO_;H68jNC#*v|BP^gD^2tKhUlLd6HGU zP8Be6d9^+bjUj3ByNV~sj?rz0O*qx+=%4EH;t<8<1R>j@h<0bm?kw3cUZ(mOIi463 z{B%-0Rn(vilP14~Q0<1uPQ_l*XT&-%9l2R8_X zn}_)@)wk3*7!-d-3a{9nNe_3lZ_lJ!GwEDuvURevqqU=5FXr`~vSMr()`4?s-+@5^ zZsw7rFv_u5OEQ+14-8ytpLlWe*#{pv9^GI6qjRtRek=RHI#CA`+Vhk^ndbxQIQ{=B z($(pG-g+Y|i6y@F0k-Gd{52Oj!kMEM2s%!odEX zOg?7~B!@F-IhM`m$kKFFYbs*1>L|(_>wv(&h1)}ELwW^j?V>*L^~={ybhT43PuC~& zg7{F>DQBMLH*r89;aFmQoG!R{o223Bj88CkHAMN0)K0|`=7@2dm-c5hTm=%!gy-luB)6grhgGSBjZrn z{cWJHRzCe5fTk9K`r}w~_1!;KDwR2uq4X75+ACx^$R)SD?)Z73k@xnZw^rsf#I` z=*Ol0?rwyww~U#~#_3CYjng-RM&LE${4IMeIA|aTp~{8PrWR-?+hhArc44t7eP+;@ z?s`XutTA)ZUS&Mn^=A;u>!F|J6nwqb@HWVS<6!HtfA=vcL`Q>Q2Mu~T4A1@8$nvFI zm5R)v%}JzCEp{|9+jajoAz}~4XMPhKjL%$;4a8>tJ!s6fZUg#AV(U#Dld=is#_5|u zyJg2)WS^M1nwYuNJM))VW$hn~=`#Ui&)cQH;&?rDJa#O0Joa$RJTp3~H?=&8)yevB zB(YvO&ef5X#r~Hc0Y3tM1pEm25%446N5GGO9|1oCegymod_*D;fVV-0mC59{X-D&g zOllMKJFqc$e-sek6|K5lsn~$q0G|i^Ea0nv3BY53yRTF#uLB+fd=Kz-z;<}L$9JEY z0*@aSfyqc<vi#P^VfoXVQsd)FTCZshTd@7)60x-=k)S@;b<=084I_?!dtq-T6eg) zI~?f_hvd89YhXSHe%$Zl(50XJ2>223Bj88CkANQmKLUOP{0R6F@FVcQM1c1n@_s{j zw33N&6+5Sgq(+j3$- zL$O+T8=3c~?(6BfPuns$T*}!cZI8Z7Z)@FgZ%K+fp4i!@x3zC|=-c?>q9E*WZLSf3 zApFmP_ouTiVi5j#|GAg17hkUFr=dFky!y)o&pR)_T=4w#@*%w&H=QX_bt`>Z~dwJNMt+^Q|9~5_1_v5=u zgYe&#p_=;Z1m8cr`X3W~-|+HxiCXhE2zLR#&b|6@mx{U>Cm$3WM5HFqcd-Q#g3u$&PZT7F)UI_nmV*H3{Dz+F`xuV0bAI_|%d{NnlZzVx$r zd|!eN)QQE{MG*Kk5T6V5JH@{%cLJ};I=o+xNPh7=*$#X}tY0)w8i8L^xA?l~K;G+G zN)If-r^&xMKOY5NtKsJ<;8)kJ7kr;(m2V)AHIotje25o-$2d$-94s>UF<=DdTXU2M zf;{P;pn1EU_#Xm~`s(%a6Vi{9e~t8i4m`F~)qewc)*)31W#HvMX5A#_M+$b)F2PQu z5wUPy!?d&J2%gv|!fB0E-W<#1hm#pIW#B3`|eFnhmn zAhti=<1LYAQhU^bUx=1OeiZ@ znIsxeZX#m~UG`jutUi_p5i><=MCi6P2_nuj(9X-D(XDZsS>q}2#**X1nPQFw=b@@( zHVw`kbBM0cVR~m_%Bt7Ohmi4?4lX^ohdPPZS&Y11r(&tgdBjh_2iM4K&+9Qp4a(e! z*Tu|rK*nu9MC&ug&8$es_cf;DiaoFI7&TTTRPB!f|94npbNl%@gpup#Gf-;#lVFd} zAZ*X;MaJ(_z1T;LGu!j?LK-;iGTZaIlJQ9>b0_rSPG156pCQuXBp>7k?U9c|4p**CcQHKP&0Cz&>r)u{R_Zh zOxQpCNI8j6UCF8A|GZ+akzEzZ9fRUtyr|emNr92|m$LtXV$bVx#{XuIzvJ%ypCAK9 zTraqj>hEWYJ+Jc_8{Ni`SL63fvgh#^8W|9(Ya!MC*NXj8=XlBMqWa%b?1!jc#*or~ zo$jsk_0-U>CKd+Pd+%})j z#_JCg+wnNQ1RQpe?fLoV6fN8gG;$@jXIuuxZhH|WeV8)zo*JL8Mb$0b?&)zqvWueZVaD*G95nL9=@;O|8KbME^{%2KTMG7 Y73W;9Q;KWu+V;mf9gPi&fg+0k0G3EOoB#j- literal 0 HcmV?d00001 diff --git a/01_git/scissors/main.c b/01_git/scissors/main.c new file mode 100644 index 0000000..6b8012d --- /dev/null +++ b/01_git/scissors/main.c @@ -0,0 +1,6 @@ +#include + +int main() { + printf("Hello, World!"); + return 0; +} \ No newline at end of file diff --git a/01_git/scissors/run.sh b/01_git/scissors/run.sh new file mode 100755 index 0000000..dd40724 --- /dev/null +++ b/01_git/scissors/run.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +rm a.out +gcc main.c +./a.out \ No newline at end of file From 8f649a71c2e968c3b2a458b8f068fc37322eb45b Mon Sep 17 00:00:00 2001 From: Anatolii Date: Fri, 19 Nov 2021 11:28:50 +0200 Subject: [PATCH 02/15] TASK1: Implemented scissors game Implemented scissors game according to the requiremnts in the file main.c --- 01_git/scissors/a.out | Bin 16696 -> 16992 bytes 01_git/scissors/main.c | 79 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 77 insertions(+), 2 deletions(-) diff --git a/01_git/scissors/a.out b/01_git/scissors/a.out index e92259341b72f5f8b211688227e7d9cc0ba8de91..b3b51669c756f7ad68308eb9ebd9d945c1e7abd4 100755 GIT binary patch delta 3370 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 delta 1959 zcmZ`)Z%kWN6u|6AqFbEFuuH5TG-W0RlSStjqca*@)YN3zhC;#?-SfQmzT%&FlY4*X zocp`yo_p@O?=2js>7z7RZjT8h*OWYv7lWs_zQYqMQ%`>@uUV#fWtoDV`ob}$8c3K2 z-K;N5*X8Ny&_8j2%j+>nP)VF;ta-+ohx7DHyTg;`tRhr!8{r(Mc>m9>%G|2Jo1%{F zuDv(?s@7upmdDQ&j)k{Crz{{p;ryiLRAt8y}Hdgq^bU$r_A5Aj#f@qfLlPF8{ zncQfH8S^H~#OT5J2z+OL$%IQFYVp=LlzQ8-!k-bUY-eRce$(!I6SfK!4iw%;z0}=F$nT{a z@1lMf(!$2R5j?0mU2+SZsnel31kKrl%%vo%lPIXumI)n#D{-fK(&E$Q6PY-#EtI;C zAf0^55cyp>eq*}~wPGb_k)cc6P-8(OIs8DcdMtF^hoU<5b9}9OGV}{7S(m11*&!T0 zvwRP)i&eYO%Y}7V7`o@|&3l@bllB>#=&^_UyQf3VwSuS;bcz4a8>aiQPZ1i4Ac6?Qwx@b*uXFTQ}b@;%6v06|6*u;S$FZ!pIre+1P2>aUG znifZ_MSKgf1@RJMH(~^_aZ%H*AVv^xAYMWAQ?PogHe_#Untn#oS(Gd9%_#b@C(-VK zo!(77uc5>$U*{1Ac73xW|FW+~+bQgWxTyz`>|7_j%5{`j`_~rfC4!enE?|H9HZ)bW z+m=vFA{D&#Wq9qeVz_8s&v z3`?TbI66(mB&#Eg)Ni8-B+ybycEc>r;|s5MnnjWo;d;G~IzZee(E%KtCMO0PMlFM* z(CofHHi?}Q-S_E+hq;Is zt~K~v#yiY0aQGxg(zo>bC71DfjoE8Cp^P|Sk6$We&X|1pZEp$K3`72?` zzrJu025md+X_V+A`nY}+AE7|-iWFlukI$nWQ&Gl|6ENE-)to_HBz8hP`FS&=&!F9o z9>&>a4}*8RduWVVV=PO#8pRc}XctHY5frwZ!N-i>#k_c!{W97`&h;Pu7iia`vyv=I zRWQprQZ(SB*68riV0;iFJHqh6j%Fbmed^Gm=%M)FM4UW3IC>E3f*q-&!3a$)G{q=A z2jLc39A{@S@HiyUy2Pvou7kN2nYXd3w85R00AJ0tY6yk`g^D#Qw;U3oSKud;079#W zS6C_(2(|{q-Apr3fJCcY_{$k-J3--ct8b0*kg!niwmt+7vjE9v0b*@}xcUdmXRH$v zZL&DP@@Jq8=GtW5sHHUAX$$a1-DM!C1o+ke+oTdG)K!|@n+kJ^M$2I?9N-7G=XWv# NZ4Ypf9njRi +#include +#include + +#define UNDEFINED 0 +#define ERROR -1 + +#define ROCK 'r' +#define PAPER 'p' +#define SCISSORS 's' + +bool is_command_valid(char command) { + return command == ROCK || command == PAPER || command == SCISSORS; +} + +char get_computer_command() { + int command = rand() % 3; + switch (command) { + case 0: + return ROCK; + case 1: + return PAPER; + case 2: + return SCISSORS; + default: + return UNDEFINED; + } +} + +char define_winner(char computer_command, char user_command) { + if (!is_command_valid(computer_command) || !is_command_valid(user_command)) { + return ERROR; + } + + if (computer_command == user_command) { + return UNDEFINED; + } else if (computer_command == ROCK && user_command == SCISSORS) { + return computer_command; + } else if (computer_command == PAPER && user_command == ROCK) { + return computer_command; + } else if (computer_command == SCISSORS && user_command == PAPER) { + return computer_command; + } else { + return user_command; + } +} + +char* get_command_name(char command) { + if (command == ROCK) { + return "rock"; + } else if (command == PAPER) { + return "paper"; + } else if (command == SCISSORS) { + return "scissors"; + } else { + return ""; + } +} int main() { - printf("Hello, World!"); - return 0; + printf("Please choose: rock (r) - paper (p) - scissors (s)\n"); + char computer_command = get_computer_command(); + char user_command = getchar(); + + char* computer_command_name = get_command_name(computer_command); + char* user_command_name = get_command_name(user_command); + + printf("You choose %s, I choose %s\n", user_command_name, computer_command_name); + + char winner_command = define_winner(computer_command, user_command); + + if (winner_command == computer_command) { + printf("I win: %s beats %s\n", computer_command_name, user_command_name); + } else if (winner_command == user_command) { + printf("You win: %s beats %s\n", user_command_name, computer_command_name); + } else { + printf("Draw\n"); + } + + return 0; } \ No newline at end of file From a28c26acbf3e81faa20648f51b4a7890c29ef004 Mon Sep 17 00:00:00 2001 From: aberchanov Date: Sun, 21 Nov 2021 23:40:17 +0200 Subject: [PATCH 03/15] TASK2: develop hwdetect.sh In hwdetect.sh implemented notification messages about usb devices connection/disconnection --- 02_bash/hwdetect/echo | 0 02_bash/hwdetect/hwdetect.sh | 49 ++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 02_bash/hwdetect/echo create mode 100755 02_bash/hwdetect/hwdetect.sh diff --git a/02_bash/hwdetect/echo b/02_bash/hwdetect/echo new file mode 100644 index 0000000..e69de29 diff --git a/02_bash/hwdetect/hwdetect.sh b/02_bash/hwdetect/hwdetect.sh new file mode 100755 index 0000000..0ba1eb4 --- /dev/null +++ b/02_bash/hwdetect/hwdetect.sh @@ -0,0 +1,49 @@ +#!/bin/sh + +devices=`lsusb` +while : +do + sleep 1 + + new_devices=`lsusb` + + # discover disconnected devices + for device in $devices + do + is_present=0 + for new_device in $new_devices; + do + if [ $new_device = $device ] + then + is_present=1 + break + fi + done + + if [ $is_present -eq 0 ] + then + echo "Disconnected: $device" + fi + done + + # discover connected devices + for new_device in $new_devices + do + is_present=0 + for device in $devices; + do + if [ $new_device = $device ] + then + is_present=1 + break + fi + done + + if [ $is_present -eq 0 ] + then + echo "Connected: $new_device" + fi + done + + devices=$new_devices +done \ No newline at end of file From 183ac6b647272bcc52b6f513d710974cf6d33231 Mon Sep 17 00:00:00 2001 From: Serhii Perederii Date: Fri, 19 Nov 2021 19:01:51 +0200 Subject: [PATCH 04/15] TASK3: Add module task Add description for module task Signed-off-by: Serhii Perederii --- 03_module/README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 03_module/README.md diff --git a/03_module/README.md b/03_module/README.md new file mode 100644 index 0000000..739d55a --- /dev/null +++ b/03_module/README.md @@ -0,0 +1,15 @@ +## module home work: create a simple loadable module with parameters + +Create a loadadle kernel module which should accept two integer parameters and provide: + - A sum of parameters upon driver load + - A substration of parameters upon driver unload + +Info about module parameters can be found at: https://devarea.com/linux-kernel-development-kernel-module-parameters/#.YZfWcpFByV4 + +Task should be performed using buildroot+qemu approach + +The task results should contain: +- The module code +- The Makefile +- Dump of the kernel logs from the target system + From 77a58eda9a4ce7f566feaae3b259bfc58795bc7c Mon Sep 17 00:00:00 2001 From: Oleksandr Posukhov Date: Tue, 23 Nov 2021 20:10:08 +0200 Subject: [PATCH 05/15] Task04: Add task for Lection 03 Add home task for lection Basic Data structures Signed-off-by: Oleksandr Posukhov --- 04_basic_struct/README.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 04_basic_struct/README.md diff --git a/04_basic_struct/README.md b/04_basic_struct/README.md new file mode 100644 index 0000000..445d6dc --- /dev/null +++ b/04_basic_struct/README.md @@ -0,0 +1,7 @@ +## Basic structure homework +Implement object with name “MyObject” which is parent of kernel_kobj. +Object should include linked_list structure. +This object should contain sysfs attribute with name “list”. +On read form attribute “list” it should show content of the objects linked list. +On write to attribute “list” it should add new string to the objects linked list. +!! Do not forget properly free all the resources during rmmod. From 9653f4a392aca5f85ce6c4f3776474d9858e13e6 Mon Sep 17 00:00:00 2001 From: Anatolii Berchanov Date: Wed, 24 Nov 2021 17:14:06 +0200 Subject: [PATCH 06/15] Ht 03 module (#40) Task03: Create home task 03 Created module `hello` that accepts `a` and `b` as arguments. Also created Makefile for assembling and logs_dump.txt as example of execution. Co-authored-by: Serhii Perederii Co-authored-by: Oleksandr Posukhov --- 03_module/.gitignore | 6 + 03_module/README.md | 15 ++ 03_module/logs_dump.txt | 309 ++++++++++++++++++++++++++++++++++++++ 03_module/module/Makefile | 10 ++ 03_module/module/hello.c | 20 +++ 04_basic_struct/README.md | 7 + 6 files changed, 367 insertions(+) create mode 100644 03_module/.gitignore create mode 100644 03_module/README.md create mode 100644 03_module/logs_dump.txt create mode 100644 03_module/module/Makefile create mode 100644 03_module/module/hello.c create mode 100644 04_basic_struct/README.md diff --git a/03_module/.gitignore b/03_module/.gitignore new file mode 100644 index 0000000..7d4c27d --- /dev/null +++ b/03_module/.gitignore @@ -0,0 +1,6 @@ +module/*.cmd +module/*.mod* +module/*.ko +/module/*.o +module/Module.symvers +module/modules.order \ No newline at end of file diff --git a/03_module/README.md b/03_module/README.md new file mode 100644 index 0000000..739d55a --- /dev/null +++ b/03_module/README.md @@ -0,0 +1,15 @@ +## module home work: create a simple loadable module with parameters + +Create a loadadle kernel module which should accept two integer parameters and provide: + - A sum of parameters upon driver load + - A substration of parameters upon driver unload + +Info about module parameters can be found at: https://devarea.com/linux-kernel-development-kernel-module-parameters/#.YZfWcpFByV4 + +Task should be performed using buildroot+qemu approach + +The task results should contain: +- The module code +- The Makefile +- Dump of the kernel logs from the target system + diff --git a/03_module/logs_dump.txt b/03_module/logs_dump.txt new file mode 100644 index 0000000..24bd65f --- /dev/null +++ b/03_module/logs_dump.txt @@ -0,0 +1,309 @@ +Linux version 5.10.7 (anatolii@anatolii-TM1707) (x86_64-buildroot-linux-uclibc-gcc.br_real (Buildroot 2021.02.7) 9.4.0, GNU ld (GNU Binutils) 2.35.2) #1 SMP Mon Nov 22 11:28:54 EET 2021 +Command line: rootwait root=/dev/vda console=tty1 console=ttyS0 +x86/fpu: x87 FPU will use FXSAVE +BIOS-provided physical RAM map: +BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable +BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved +BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved +BIOS-e820: [mem 0x0000000000100000-0x0000000007fdcfff] usable +BIOS-e820: [mem 0x0000000007fdd000-0x0000000007ffffff] reserved +BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved +NX (Execute Disable) protection: active +SMBIOS 2.8 present. +DMI: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 +tsc: Fast TSC calibration using PIT +tsc: Detected 1991.997 MHz processor +e820: update [mem 0x00000000-0x00000fff] usable ==> reserved +e820: remove [mem 0x000a0000-0x000fffff] usable +last_pfn = 0x7fdd max_arch_pfn = 0x400000000 +MTRR default type: write-back +MTRR fixed ranges enabled: + 00000-9FFFF write-back + A0000-BFFFF uncachable + C0000-FFFFF write-protect +MTRR variable ranges enabled: + 0 base 0080000000 mask FF80000000 uncachable + 1 disabled + 2 disabled + 3 disabled + 4 disabled + 5 disabled + 6 disabled + 7 disabled +x86/PAT: Configuration [0-7]: WB WC UC- UC WB WP UC- WT +found SMP MP-table at [mem 0x000f5aa0-0x000f5aaf] +ACPI: Early table checksum verification disabled +ACPI: RSDP 0x00000000000F58C0 000014 (v00 BOCHS ) +ACPI: RSDT 0x0000000007FE1550 000034 (v01 BOCHS BXPCRSDT 00000001 BXPC 00000001) +ACPI: FACP 0x0000000007FE1404 000074 (v01 BOCHS BXPCFACP 00000001 BXPC 00000001) +ACPI: DSDT 0x0000000007FE0040 0013C4 (v01 BOCHS BXPCDSDT 00000001 BXPC 00000001) +ACPI: FACS 0x0000000007FE0000 000040 +ACPI: APIC 0x0000000007FE1478 000078 (v01 BOCHS BXPCAPIC 00000001 BXPC 00000001) +ACPI: HPET 0x0000000007FE14F0 000038 (v01 BOCHS BXPCHPET 00000001 BXPC 00000001) +ACPI: WAET 0x0000000007FE1528 000028 (v01 BOCHS BXPCWAET 00000001 BXPC 00000001) +ACPI: Local APIC address 0xfee00000 +Zone ranges: + DMA [mem 0x0000000000001000-0x0000000000ffffff] + DMA32 [mem 0x0000000001000000-0x0000000007fdcfff] + Normal empty +Movable zone start for each node +Early memory node ranges + node 0: [mem 0x0000000000001000-0x000000000009efff] + node 0: [mem 0x0000000000100000-0x0000000007fdcfff] +Zeroed struct page in unavailable ranges: 133 pages +Initmem setup node 0 [mem 0x0000000000001000-0x0000000007fdcfff] +On node 0 totalpages: 32635 + DMA zone: 64 pages used for memmap + DMA zone: 21 pages reserved + DMA zone: 3998 pages, LIFO batch:0 + DMA32 zone: 448 pages used for memmap + DMA32 zone: 28637 pages, LIFO batch:7 +ACPI: PM-Timer IO Port: 0x608 +ACPI: Local APIC address 0xfee00000 +ACPI: LAPIC_NMI (acpi_id[0xff] dfl dfl lint[0x1]) +IOAPIC[0]: apic_id 0, version 32, address 0xfec00000, GSI 0-23 +ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl) +ACPI: INT_SRC_OVR (bus 0 bus_irq 5 global_irq 5 high level) +ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level) +ACPI: INT_SRC_OVR (bus 0 bus_irq 10 global_irq 10 high level) +ACPI: INT_SRC_OVR (bus 0 bus_irq 11 global_irq 11 high level) +ACPI: IRQ0 used by override. +ACPI: IRQ5 used by override. +ACPI: IRQ9 used by override. +ACPI: IRQ10 used by override. +ACPI: IRQ11 used by override. +Using ACPI (MADT) for SMP configuration information +ACPI: HPET id: 0x8086a201 base: 0xfed00000 +smpboot: Allowing 1 CPUs, 0 hotplug CPUs +[mem 0x08000000-0xfffbffff] available for PCI devices +Booting paravirtualized kernel on bare hardware +clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645519600211568 ns +setup_percpu: NR_CPUS:64 nr_cpumask_bits:64 nr_cpu_ids:1 nr_node_ids:1 +percpu: Embedded 42 pages/cpu s133528 r8192 d30312 u2097152 +pcpu-alloc: s133528 r8192 d30312 u2097152 alloc=1*2097152 +pcpu-alloc: [0] 0 +Built 1 zonelists, mobility grouping on. Total pages: 32102 +Kernel command line: rootwait root=/dev/vda console=tty1 console=ttyS0 +Dentry cache hash table entries: 16384 (order: 5, 131072 bytes, linear) +Inode-cache hash table entries: 8192 (order: 4, 65536 bytes, linear) +mem auto-init: stack:off, heap alloc:off, heap free:off +Memory: 111304K/130540K available (8195K kernel code, 900K rwdata, 1740K rodata, 896K init, 2212K bss, 18976K reserved, 0K cma-reserved) +SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1 +rcu: Hierarchical RCU implementation. +rcu: RCU restricting CPUs from NR_CPUS=64 to nr_cpu_ids=1. +rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies. +rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1 +NR_IRQS: 4352, nr_irqs: 48, preallocated irqs: 16 +Console: colour VGA+ 80x25 +printk: console [tty1] enabled +printk: console [ttyS0] enabled +ACPI: Core revision 20200925 +clocksource: hpet: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604467 ns +APIC: Switch to symmetric I/O mode setup +..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1 +clocksource: tsc-early: mask: 0xffffffffffffffff max_cycles: 0x396d4bf570c, max_idle_ns: 881590425443 ns +Calibrating delay loop (skipped), value calculated using timer frequency.. 3983.99 BogoMIPS (lpj=7967988) +pid_max: default: 32768 minimum: 301 +Mount-cache hash table entries: 512 (order: 0, 4096 bytes, linear) +Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes, linear) +Last level iTLB entries: 4KB 0, 2MB 0, 4MB 0 +Last level dTLB entries: 4KB 0, 2MB 0, 4MB 0, 1GB 0 +Spectre V1 : Mitigation: usercopy/swapgs barriers and __user pointer sanitization +Spectre V2 : Mitigation: Full AMD retpoline +Spectre V2 : Spectre v2 / SpectreRSB mitigation: Filling RSB on context switch +Speculative Store Bypass: Vulnerable +Freeing SMP alternatives memory: 24K +smpboot: CPU0: AMD QEMU Virtual CPU version 2.5+ (family: 0x6, model: 0x6, stepping: 0x3) +Performance Events: PMU not available due to virtualization, using software events only. +rcu: Hierarchical SRCU implementation. +smp: Bringing up secondary CPUs ... +smp: Brought up 1 node, 1 CPU +smpboot: Max logical packages: 1 +smpboot: Total of 1 processors activated (3983.99 BogoMIPS) +devtmpfs: initialized +random: get_random_u32 called from bucket_table_alloc.isra.0+0x75/0x160 with crng_init=0 +clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns +futex hash table entries: 256 (order: 2, 16384 bytes, linear) +NET: Registered protocol family 16 +thermal_sys: Registered thermal governor 'step_wise' +thermal_sys: Registered thermal governor 'user_space' +cpuidle: using governor ladder +ACPI: bus type PCI registered +PCI: Using configuration type 1 for base access +ACPI: Added _OSI(Module Device) +ACPI: Added _OSI(Processor Device) +ACPI: Added _OSI(3.0 _SCP Extensions) +ACPI: Added _OSI(Processor Aggregator Device) +ACPI: Added _OSI(Linux-Dell-Video) +ACPI: Added _OSI(Linux-Lenovo-NV-HDMI-Audio) +ACPI: Added _OSI(Linux-HPI-Hybrid-Graphics) +ACPI: 1 ACPI AML tables successfully acquired and loaded +ACPI: Interpreter enabled +ACPI: (supports S0 S3 S5) +ACPI: Using IOAPIC for interrupt routing +PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug +ACPI: Enabled 2 GPEs in block 00 to 0F +ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff]) +acpi PNP0A03:00: _OSC: OS supports [ASPM ClockPM Segments HPX-Type3] +acpi PNP0A03:00: fail to add MMCONFIG information, can't access extended PCI configuration space under this bridge. +PCI host bridge to bus 0000:00 +pci_bus 0000:00: root bus resource [io 0x0000-0x0cf7 window] +pci_bus 0000:00: root bus resource [io 0x0d00-0xffff window] +pci_bus 0000:00: root bus resource [mem 0x000a0000-0x000bffff window] +pci_bus 0000:00: root bus resource [mem 0x08000000-0xfebfffff window] +pci_bus 0000:00: root bus resource [mem 0x100000000-0x17fffffff window] +pci_bus 0000:00: root bus resource [bus 00-ff] +pci 0000:00:00.0: [8086:1237] type 00 class 0x060000 +pci 0000:00:01.0: [8086:7000] type 00 class 0x060100 +pci 0000:00:01.1: [8086:7010] type 00 class 0x010180 +pci 0000:00:01.1: reg 0x20: [io 0xc0a0-0xc0af] +pci 0000:00:01.1: legacy IDE quirk: reg 0x10: [io 0x01f0-0x01f7] +pci 0000:00:01.1: legacy IDE quirk: reg 0x14: [io 0x03f6] +pci 0000:00:01.1: legacy IDE quirk: reg 0x18: [io 0x0170-0x0177] +pci 0000:00:01.1: legacy IDE quirk: reg 0x1c: [io 0x0376] +pci 0000:00:01.3: [8086:7113] type 00 class 0x068000 +pci 0000:00:01.3: quirk: [io 0x0600-0x063f] claimed by PIIX4 ACPI +pci 0000:00:01.3: quirk: [io 0x0700-0x070f] claimed by PIIX4 SMB +pci 0000:00:02.0: [1234:1111] type 00 class 0x030000 +pci 0000:00:02.0: reg 0x10: [mem 0xfd000000-0xfdffffff pref] +pci 0000:00:02.0: reg 0x18: [mem 0xfebd0000-0xfebd0fff] +pci 0000:00:02.0: reg 0x30: [mem 0xfebc0000-0xfebcffff pref] +pci 0000:00:03.0: [1af4:1000] type 00 class 0x020000 +pci 0000:00:03.0: reg 0x10: [io 0xc080-0xc09f] +pci 0000:00:03.0: reg 0x14: [mem 0xfebd1000-0xfebd1fff] +pci 0000:00:03.0: reg 0x20: [mem 0xfe000000-0xfe003fff 64bit pref] +pci 0000:00:03.0: reg 0x30: [mem 0xfeb80000-0xfebbffff pref] +pci 0000:00:04.0: [1af4:1001] type 00 class 0x010000 +pci 0000:00:04.0: reg 0x10: [io 0xc000-0xc07f] +pci 0000:00:04.0: reg 0x14: [mem 0xfebd2000-0xfebd2fff] +pci 0000:00:04.0: reg 0x20: [mem 0xfe004000-0xfe007fff 64bit pref] +pci_bus 0000:00: on NUMA node 0 +ACPI: PCI Interrupt Link [LNKA] (IRQs 5 *10 11) +ACPI: PCI Interrupt Link [LNKB] (IRQs 5 *10 11) +ACPI: PCI Interrupt Link [LNKC] (IRQs 5 10 *11) +ACPI: PCI Interrupt Link [LNKD] (IRQs 5 10 *11) +ACPI: PCI Interrupt Link [LNKS] (IRQs *9) +pci 0000:00:02.0: vgaarb: setting as boot VGA device +pci 0000:00:02.0: vgaarb: VGA device added: decodes=io+mem,owns=io+mem,locks=none +pci 0000:00:02.0: vgaarb: bridge control possible +vgaarb: loaded +SCSI subsystem initialized +libata version 3.00 loaded. +ACPI: bus type USB registered +usbcore: registered new interface driver usbfs +usbcore: registered new interface driver hub +usbcore: registered new device driver usb +Advanced Linux Sound Architecture Driver Initialized. +PCI: Using ACPI for IRQ routing +PCI: pci_cache_line_size set to 64 bytes +e820: reserve RAM buffer [mem 0x0009fc00-0x0009ffff] +e820: reserve RAM buffer [mem 0x07fdd000-0x07ffffff] +clocksource: Switched to clocksource tsc-early +pnp: PnP ACPI init +pnp 00:00: Plug and Play ACPI device, IDs PNP0303 (active) +pnp 00:01: Plug and Play ACPI device, IDs PNP0f13 (active) +pnp 00:02: [dma 2] +pnp 00:02: Plug and Play ACPI device, IDs PNP0700 (active) +pnp 00:03: Plug and Play ACPI device, IDs PNP0400 (active) +pnp 00:04: Plug and Play ACPI device, IDs PNP0501 (active) +pnp 00:05: Plug and Play ACPI device, IDs PNP0b00 (active) +pnp: PnP ACPI: found 6 devices +clocksource: acpi_pm: mask: 0xffffff max_cycles: 0xffffff, max_idle_ns: 2085701024 ns +NET: Registered protocol family 2 +tcp_listen_portaddr_hash hash table entries: 256 (order: 0, 4096 bytes, linear) +TCP established hash table entries: 1024 (order: 1, 8192 bytes, linear) +TCP bind hash table entries: 1024 (order: 2, 16384 bytes, linear) +TCP: Hash tables configured (established 1024 bind 1024) +UDP hash table entries: 256 (order: 1, 8192 bytes, linear) +UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear) +NET: Registered protocol family 1 +pci_bus 0000:00: resource 4 [io 0x0000-0x0cf7 window] +pci_bus 0000:00: resource 5 [io 0x0d00-0xffff window] +pci_bus 0000:00: resource 6 [mem 0x000a0000-0x000bffff window] +pci_bus 0000:00: resource 7 [mem 0x08000000-0xfebfffff window] +pci_bus 0000:00: resource 8 [mem 0x100000000-0x17fffffff window] +pci 0000:00:01.0: PIIX3: Enabling Passive Release +pci 0000:00:00.0: Limiting direct PCI/PCI transfers +pci 0000:00:01.0: Activating ISA DMA hang workarounds +pci 0000:00:02.0: Video device with shadowed ROM at [mem 0x000c0000-0x000dffff] +PCI: CLS 0 bytes, default 64 +workingset: timestamp_bits=62 max_order=15 bucket_order=0 +Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254) +io scheduler mq-deadline registered +io scheduler kyber registered +input: Power Button as /devices/LNXSYSTM:00/LNXPWRBN:00/input/input0 +ACPI: Power Button [PWRF] +PCI Interrupt Link [LNKC] enabled at IRQ 11 +PCI Interrupt Link [LNKD] enabled at IRQ 10 +Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled +00:04: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A +bochs-drm 0000:00:02.0: vgaarb: deactivate vga console +Console: switching to colour dummy device 80x25 +[drm] Found bochs VGA, ID 0xb0c0. +[drm] Framebuffer size 16384 kB @ 0xfd000000, mmio @ 0xfebd0000. +[TTM] Zone kernel: Available graphics memory: 55794 KiB +[TTM] Initializing pool allocator +[TTM] Initializing DMA pool allocator +[drm] Found EDID data blob. +[drm] Initialized bochs-drm 1.0.0 20130925 for 0000:00:02.0 on minor 0 +fbcon: bochs-drmdrmfb (fb0) is primary device +Console: switching to colour frame buffer device 128x48 +bochs-drm 0000:00:02.0: [drm] fb0: bochs-drmdrmfb frame buffer device +virtio_blk virtio1: [vda] 122880 512-byte logical blocks (62.9 MB/60.0 MiB) +vda: detected capacity change from 0 to 62914560 +ata_piix 0000:00:01.1: version 2.13 +scsi host0: ata_piix +scsi host1: ata_piix +ata1: PATA max MWDMA2 cmd 0x1f0 ctl 0x3f6 bmdma 0xc0a0 irq 14 +ata2: PATA max MWDMA2 cmd 0x170 ctl 0x376 bmdma 0xc0a8 irq 15 +ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver +ehci-pci: EHCI PCI platform driver +uhci_hcd: USB Universal Host Controller Interface driver +usbcore: registered new interface driver usb-storage +i8042: PNP: PS/2 Controller [PNP0303:KBD,PNP0f13:MOU] at 0x60,0x64 irq 1,12 +serio: i8042 KBD port at 0x60,0x64 irq 1 +serio: i8042 AUX port at 0x60,0x64 irq 12 +usbcore: registered new interface driver usbhid +usbhid: USB HID core driver +input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input1 +NET: Registered protocol family 10 +Segment Routing with IPv6 +sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver +NET: Registered protocol family 17 +IPI shorthand broadcast: enabled +sched_clock: Marking stable (981626737, 18660054)->(1003751110, -3464319) +ALSA device list: + No soundcards found. +ata2.01: NODEV after polling detection +ata2.00: ATAPI: QEMU DVD-ROM, 2.5+, max UDMA/100 +scsi 1:0:0:0: CD-ROM QEMU QEMU DVD-ROM 2.5+ PQ: 0 ANSI: 5 +tsc: Refined TSC clocksource calibration: 1991.968 MHz +clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x396d1603e08, max_idle_ns: 881590726352 ns +clocksource: Switched to clocksource tsc +input: ImExPS/2 Generic Explorer Mouse as /devices/platform/i8042/serio1/input/input3 +EXT4-fs (vda): mounting ext2 file system using the ext4 subsystem +EXT4-fs (vda): mounted filesystem without journal. Opts: (null) +VFS: Mounted root (ext2 filesystem) readonly on device 254:0. +devtmpfs: mounted +Freeing unused kernel image (initmem) memory: 896K +Write protecting the kernel read-only data: 12288k +Freeing unused kernel image (text/rodata gap) memory: 2044K +Freeing unused kernel image (rodata/data gap) memory: 308K +Run /sbin/init as init process + with arguments: + /sbin/init + with environment: + HOME=/ + TERM=linux +EXT4-fs (vda): warning: mounting unchecked fs, running e2fsck is recommended +EXT4-fs (vda): re-mounted. Opts: (null) +ext2 filesystem being remounted at / supports timestamps until 2038 (0x7fffffff) +random: fast init done +random: dd: uninitialized urandom read (512 bytes read) +random: mktemp: uninitialized urandom read (6 bytes read) +random: mktemp: uninitialized urandom read (6 bytes read) +hello: loading out-of-tree module taints kernel. +hello: module license 'unspecified' taints kernel. +Disabling lock debugging due to kernel taint +Hi world! 6 +Bye world! 2 diff --git a/03_module/module/Makefile b/03_module/module/Makefile new file mode 100644 index 0000000..44db04f --- /dev/null +++ b/03_module/module/Makefile @@ -0,0 +1,10 @@ +KERNELDIR ?= /home/anatolii/Projects/buildroot/buildroot-2021.02.7/output/build/linux-5.10.7/ + +obj-m := hello.o + +all: + $(MAKE) -C $(KERNELDIR) M=$(PWD) modules + +clean: + $(MAKE) -C $(KERNELDIR) M=$(PWD) clean + diff --git a/03_module/module/hello.c b/03_module/module/hello.c new file mode 100644 index 0000000..d1f1853 --- /dev/null +++ b/03_module/module/hello.c @@ -0,0 +1,20 @@ +#include +#include +#include + +static int a=0; +module_param(a,int,0660); + +static int b=0; +module_param(b,int,0660); + +int init_module(void) +{ + printk(KERN_INFO "Hi world! %d\n", a + b); + return 0; +} + +void cleanup_module(void) { + printk(KERN_INFO "Bye world! %d\n", a - b); +} + diff --git a/04_basic_struct/README.md b/04_basic_struct/README.md new file mode 100644 index 0000000..445d6dc --- /dev/null +++ b/04_basic_struct/README.md @@ -0,0 +1,7 @@ +## Basic structure homework +Implement object with name “MyObject” which is parent of kernel_kobj. +Object should include linked_list structure. +This object should contain sysfs attribute with name “list”. +On read form attribute “list” it should show content of the objects linked list. +On write to attribute “list” it should add new string to the objects linked list. +!! Do not forget properly free all the resources during rmmod. From f77fc6ba507dd4980a2e2e2b30ce7ed9e843ea80 Mon Sep 17 00:00:00 2001 From: Anatolii Date: Sun, 28 Nov 2021 11:38:10 +0200 Subject: [PATCH 07/15] IMPROVEMENT: Create root gitignore Created `.gitignore' in the root of repository. Added `.vccode` to gitignore. --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cddb272 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +**/.vscode From ce2f564dbfc0b21e8a184cc9bcbdd0b3a9678244 Mon Sep 17 00:00:00 2001 From: Anatolii Date: Sun, 28 Nov 2021 11:38:10 +0200 Subject: [PATCH 08/15] IMPROVEMENT: Create root gitignore Created `.gitignore' in the root of repository. Added `.vccode` to gitignore. --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cddb272 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +**/.vscode From f4ade3bbeba6a8f59faff62161c2451477291fce Mon Sep 17 00:00:00 2001 From: Yevgen Kovalyov Date: Wed, 1 Dec 2021 00:13:52 +0200 Subject: [PATCH 09/15] Task05: Add tasks for lesson 5 Time Management Add descriptions of tasks for lesson 5. Signed-off-by: Yevgen Kovalyov --- 05_timers/README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 05_timers/README.md diff --git a/05_timers/README.md b/05_timers/README.md new file mode 100644 index 0000000..55b41f2 --- /dev/null +++ b/05_timers/README.md @@ -0,0 +1,10 @@ +## Homework: Linux Kernel Time Management + +1. Implement program which return absolute time in user space. +Use clock_gettime() from time.h. Try different clock id. +Find the difference. Show possible clock resolution provided by clock_getres(). + +2. Implement kernel module with API in sysfs, which returns relative +time in maximum possible resolution passed since previous read of it. +Implement kernel module with API in sysfs which returns absolute time +of previous reading with maximum resolution like ‘400.123567’ seconds. From e620e7afe3cffe4547ab60f73142e33aa858a7e3 Mon Sep 17 00:00:00 2001 From: Yevgen Kovalyov Date: Thu, 2 Dec 2021 19:36:43 +0200 Subject: [PATCH 10/15] Task06: Add tasks for lesson 6 Memory Management --- 06_memory/README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 06_memory/README.md diff --git a/06_memory/README.md b/06_memory/README.md new file mode 100644 index 0000000..4c22613 --- /dev/null +++ b/06_memory/README.md @@ -0,0 +1,22 @@ +# Memory management + +## Homework +1. Create user-space C or C++ program which tries to allocate buffers + with sizes 2^x for x in range from 0 to maximium possible value + using functions: + **malloc, calloc, alloca, (optional for C++) new **. + Measure time of each allocation/freeing. + 2^x means x power of 2 in this task. +Pull request should contains program source code and program output +in text format. + +2. Create kernel module and test allocation/freeing time for functions: + **kmalloc, kzmalloc, vmalloc, get_free_pages, + (optional and only for drivers integrated to kernel)alloc_bootmem**. + Measure the time of each allocation/freeing except alloc_bootmem. + The results should be presented in text file table with followed columns: + Buffer size, allocation time, freeing time. + Size unit is 1 byte, time unit is 1 ns. + +Pull request should contains source code of developed driver, Makefile +and program output from system log in text format. From f7825f844c1702ce8b57d4ea652cc55650b32f36 Mon Sep 17 00:00:00 2001 From: Anatolii Date: Sat, 27 Nov 2021 22:31:47 +0200 Subject: [PATCH 11/15] Task04: Implement saving to list Created attribute `list` for object `MyObject`. `list` saves input data to the linked list. --- 04_basic_struct/.gitignore | 6 ++ 04_basic_struct/module/Makefile | 10 ++++ 04_basic_struct/module/hello.c | 99 +++++++++++++++++++++++++++++++++ 3 files changed, 115 insertions(+) create mode 100644 04_basic_struct/.gitignore create mode 100644 04_basic_struct/module/Makefile create mode 100644 04_basic_struct/module/hello.c diff --git a/04_basic_struct/.gitignore b/04_basic_struct/.gitignore new file mode 100644 index 0000000..7d4c27d --- /dev/null +++ b/04_basic_struct/.gitignore @@ -0,0 +1,6 @@ +module/*.cmd +module/*.mod* +module/*.ko +/module/*.o +module/Module.symvers +module/modules.order \ No newline at end of file diff --git a/04_basic_struct/module/Makefile b/04_basic_struct/module/Makefile new file mode 100644 index 0000000..44db04f --- /dev/null +++ b/04_basic_struct/module/Makefile @@ -0,0 +1,10 @@ +KERNELDIR ?= /home/anatolii/Projects/buildroot/buildroot-2021.02.7/output/build/linux-5.10.7/ + +obj-m := hello.o + +all: + $(MAKE) -C $(KERNELDIR) M=$(PWD) modules + +clean: + $(MAKE) -C $(KERNELDIR) M=$(PWD) clean + diff --git a/04_basic_struct/module/hello.c b/04_basic_struct/module/hello.c new file mode 100644 index 0000000..7476432 --- /dev/null +++ b/04_basic_struct/module/hello.c @@ -0,0 +1,99 @@ +#define pr_fmt(fmt) "%s: " fmt, KBUILD_MODNAME + +#include // Core header for loading LKMs into the kernel +#include +#include +#include +#include +#include +#include + +struct node { + char* value; + struct list_head list_member; +}; + +static LIST_HEAD(nodeHead); + +static void add_node(char* value, struct list_head *head) +{ + struct node *nodePtr = (struct node *)kmalloc(sizeof(struct node), GFP_USER); + // assert(fooPtr != NULL); TODO use PANIC here + + nodePtr->value = value; + INIT_LIST_HEAD(&nodePtr->list_member); + list_add(&(nodePtr->list_member), head); +} + +static void display(struct list_head *head) +{ + struct list_head *iter; + struct node *nodePtr; + + list_for_each(iter, head) { + nodePtr = list_entry(iter, struct node, list_member); + printk(KERN_INFO "%s", nodePtr->value); + } +} + +static ssize_t list_show(struct kobject *kobj, struct kobj_attribute *attr, + char *buf) +{ + // struct list_head *iter; + // struct node *nodePtr; + + // char outStr[] = ""; + + // list_for_each(iter, &nodeHead) { + // nodePtr = list_entry(iter, struct node, list_member); + // printk(KERN_INFO "Buf size: %ld", strlen(buf)); + // sprintf(buf, "%s\n", nodePtr->value); + // strcat(outStr, nodePtr->value); + // } + // return sprintf(buf, "%s", outStr); + + sprintf(buf, "%s", "Hello"); + return strlen(buf); +} + +static ssize_t list_store(struct kobject *kobj, struct kobj_attribute *attr, + const char *buf, size_t count) +{ + char* value = (char*)kcalloc(count, sizeof(char), GFP_USER); + memcpy(value, buf, count); + add_node(value, &nodeHead); + return count; +} + +static struct kobj_attribute list_attribute = + __ATTR(list, 0664, list_show, list_store); + +static struct kobject *my_kobj; + +static int hello_init(void) +{ + int res = 0; + + my_kobj = kobject_create_and_add("MyObject", kernel_kobj); + if (!my_kobj) + return -ENOMEM; + res = sysfs_create_file(my_kobj, &list_attribute.attr); + if (res) + kobject_put(my_kobj); + return res; +} + +static void hello_exit(void) +{ + kobject_put(my_kobj); + // TODO clean memory in list + pr_info("module exited\n"); +} + +module_init(hello_init); +module_exit(hello_exit); + +MODULE_AUTHOR("Oleksandr Posukhov "); +MODULE_DESCRIPTION("Basic data structures module"); +MODULE_LICENSE("GPL"); +MODULE_VERSION("0.1"); From 5970b761d482a7fe183c12a944e3c56b47aeb4e6 Mon Sep 17 00:00:00 2001 From: Anatolii Date: Sun, 28 Nov 2021 14:12:01 +0200 Subject: [PATCH 12/15] Task04: Fix retrievemnt data from `list` Removed display function. --- 04_basic_struct/module/hello.c | 33 +++++++++------------------------ 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/04_basic_struct/module/hello.c b/04_basic_struct/module/hello.c index 7476432..bb8da4d 100644 --- a/04_basic_struct/module/hello.c +++ b/04_basic_struct/module/hello.c @@ -25,35 +25,20 @@ static void add_node(char* value, struct list_head *head) list_add(&(nodePtr->list_member), head); } -static void display(struct list_head *head) -{ - struct list_head *iter; - struct node *nodePtr; - - list_for_each(iter, head) { - nodePtr = list_entry(iter, struct node, list_member); - printk(KERN_INFO "%s", nodePtr->value); - } -} - static ssize_t list_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - // struct list_head *iter; - // struct node *nodePtr; - - // char outStr[] = ""; + struct list_head *iter; + struct node *nodePtr; - // list_for_each(iter, &nodeHead) { - // nodePtr = list_entry(iter, struct node, list_member); - // printk(KERN_INFO "Buf size: %ld", strlen(buf)); - // sprintf(buf, "%s\n", nodePtr->value); - // strcat(outStr, nodePtr->value); - // } - // return sprintf(buf, "%s", outStr); + int bufSize = 0; - sprintf(buf, "%s", "Hello"); - return strlen(buf); + list_for_each(iter, &nodeHead) { + nodePtr = list_entry(iter, struct node, list_member); + strcpy(buf + bufSize, nodePtr->value); + bufSize += strlen(nodePtr->value); + } + return bufSize; } static ssize_t list_store(struct kobject *kobj, struct kobj_attribute *attr, From 80a27b29a976423da68841a45e30c4a19496879d Mon Sep 17 00:00:00 2001 From: Anatolii Date: Mon, 29 Nov 2021 13:12:32 +0200 Subject: [PATCH 13/15] Task04: Implement list cleaning 'list' Left debug logs also. --- 04_basic_struct/module/Makefile | 1 + 04_basic_struct/module/hello.c | 65 +++++++++++++++++++++++---------- 2 files changed, 47 insertions(+), 19 deletions(-) diff --git a/04_basic_struct/module/Makefile b/04_basic_struct/module/Makefile index 44db04f..f9daf33 100644 --- a/04_basic_struct/module/Makefile +++ b/04_basic_struct/module/Makefile @@ -1,6 +1,7 @@ KERNELDIR ?= /home/anatolii/Projects/buildroot/buildroot-2021.02.7/output/build/linux-5.10.7/ obj-m := hello.o +CFLAGS_hello.o := -DDEBUG all: $(MAKE) -C $(KERNELDIR) M=$(PWD) modules diff --git a/04_basic_struct/module/hello.c b/04_basic_struct/module/hello.c index bb8da4d..bc79d60 100644 --- a/04_basic_struct/module/hello.c +++ b/04_basic_struct/module/hello.c @@ -9,45 +9,55 @@ #include struct node { - char* value; + char *value; struct list_head list_member; }; static LIST_HEAD(nodeHead); -static void add_node(char* value, struct list_head *head) +static void add_node(char *value, struct list_head *head) { - struct node *nodePtr = (struct node *)kmalloc(sizeof(struct node), GFP_USER); - // assert(fooPtr != NULL); TODO use PANIC here - - nodePtr->value = value; - INIT_LIST_HEAD(&nodePtr->list_member); - list_add(&(nodePtr->list_member), head); + pr_debug("---> %s", __func__); + struct node *nodePtr = kmalloc(sizeof(struct node), GFP_KERNEL); + + if (nodePtr == NULL) + pr_err("Node creation error"); + nodePtr->value = value; + INIT_LIST_HEAD(&nodePtr->list_member); + list_add(&(nodePtr->list_member), head); + pr_debug("---< %s", __func__); } static ssize_t list_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { + pr_debug("---> %s", __func__); struct list_head *iter; - struct node *nodePtr; + struct node *nodePtr; int bufSize = 0; - list_for_each(iter, &nodeHead) { - nodePtr = list_entry(iter, struct node, list_member); + list_for_each(iter, &nodeHead) { + nodePtr = list_entry(iter, struct node, list_member); strcpy(buf + bufSize, nodePtr->value); bufSize += strlen(nodePtr->value); - } + pr_debug("Node copy to buf: %s", nodePtr->value); + } + pr_debug("---< %s", __func__); return bufSize; } static ssize_t list_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count) { - char* value = (char*)kcalloc(count, sizeof(char), GFP_USER); + pr_debug("---> %s size_t: %ld", __func__, count); + char *value = kcalloc(count, sizeof(char), GFP_KERNEL); + memcpy(value, buf, count); + pr_debug("value created: %ld", strlen(value)); add_node(value, &nodeHead); - return count; + pr_debug("---< %s", __func__); + return count; } static struct kobj_attribute list_attribute = @@ -57,28 +67,45 @@ static struct kobject *my_kobj; static int hello_init(void) { + pr_debug("---> %s", __func__); int res = 0; my_kobj = kobject_create_and_add("MyObject", kernel_kobj); - if (!my_kobj) + if (!my_kobj) { + pr_err("Object was not created"); return -ENOMEM; + } res = sysfs_create_file(my_kobj, &list_attribute.attr); - if (res) + if (res) { + pr_err("Attribute for Object was not created"); kobject_put(my_kobj); + } + pr_debug("---< %s", __func__); return res; } static void hello_exit(void) { + pr_debug("---> %s", __func__); + struct node *nodePtr; + struct node *tmp; + + list_for_each_entry_safe(nodePtr, tmp, &nodeHead, list_member) { + pr_debug("Clean node: %s", nodePtr->value); + kfree(nodePtr->value); + list_del(&(nodePtr->list_member)); + kfree(nodePtr); + } + pr_debug("List_empty: %d", list_empty(&nodeHead)); kobject_put(my_kobj); - // TODO clean memory in list - pr_info("module exited\n"); + + pr_debug("---< %s", __func__); } module_init(hello_init); module_exit(hello_exit); -MODULE_AUTHOR("Oleksandr Posukhov "); +MODULE_AUTHOR("Anatolii Berchanov "); MODULE_DESCRIPTION("Basic data structures module"); MODULE_LICENSE("GPL"); MODULE_VERSION("0.1"); From 2deca0b411f5880dc350c6316a8cd19d7d6a79fc Mon Sep 17 00:00:00 2001 From: Anatolii Date: Sat, 4 Dec 2021 16:10:46 +0200 Subject: [PATCH 14/15] Task04: Add logs file Added logs.txt of writing and reading `list` attribute --- logs.txt | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 logs.txt diff --git a/logs.txt b/logs.txt new file mode 100644 index 0000000..b1a8e0d --- /dev/null +++ b/logs.txt @@ -0,0 +1,42 @@ +# insmod /home/user/hello.ko +# cd MyObject/ +# echo "qwety1" > list +# echo "qwety2" > list +# echo "qwety3" > list +# cat list +qwety3 +qwety2 +qwety1 +# dmesg +hello: ---< list_show +hello: ---> hello_exit +hello: Clean node: qwety3 +hello: Clean node: qwety2 +hello: Clean node: q1 +hello: List_empty: 1 +hello: ---< hello_exit +hello: ---> hello_init +hello: ---< hello_init +hello: ---> list_store size_t: 7 +hello: value created: 7 +hello: ---> add_node +hello: ---< add_node +hello: ---< list_store +hello: ---> list_store size_t: 7 +hello: value created: 7 +hello: ---> add_node +hello: ---< add_node +hello: ---< list_store +hello: ---> list_store size_t: 7 +hello: value created: 7 +hello: ---> add_node +hello: ---< add_node +hello: ---< list_store +hello: ---> list_show +hello: Node copy to buf: qwety3 +hello: Node copy to buf: qwety2 +hello: Node copy to buf: qwety1 +# pwd +/sys/kernel/MyObject +# + From 1320265a11caffa63324be0ef5c7b9358a0af66a Mon Sep 17 00:00:00 2001 From: Anatolii Date: Thu, 16 Dec 2021 21:01:11 +0200 Subject: [PATCH 15/15] Task06: Add memory check userspace program Implemented memory_check.cpp which tests different ways of memory allocation. Program result on PC with RAM 16 Gb in output.txt --- .gitignore | 1 + 06_memory/user/memory_check.cpp | 147 ++++++++++++++++++++++++++++++++ 06_memory/user/output.txt | 138 ++++++++++++++++++++++++++++++ 06_memory/user/run.sh | 4 + 4 files changed, 290 insertions(+) create mode 100644 06_memory/user/memory_check.cpp create mode 100644 06_memory/user/output.txt create mode 100755 06_memory/user/run.sh diff --git a/.gitignore b/.gitignore index cddb272..1829d53 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ **/.vscode +**/*.out \ No newline at end of file diff --git a/06_memory/user/memory_check.cpp b/06_memory/user/memory_check.cpp new file mode 100644 index 0000000..e989e3a --- /dev/null +++ b/06_memory/user/memory_check.cpp @@ -0,0 +1,147 @@ +#include +#include +#include +#include +#include + +void test_alloca() +{ + unsigned long x = 0; + for (unsigned long i = 0; i < std::numeric_limits::max(); i++) { + x = x == 0 ? 1 : x * 2; + auto start = std::chrono::high_resolution_clock::now(); + char *mem = (char*)alloca(x); + auto stop = std::chrono::high_resolution_clock::now(); + auto duration = std::chrono::duration_cast(stop - start); + if (mem == NULL) { + printf("%lu\tAlloca\t%lu\t\tAllocation error\t%lu\n", i, duration.count(), x); + break; + } + mem[0] = '!'; + if (mem[0] != '!') { + printf("%lu\tAlloca\t%lu\t\t%lu\tMemory check error\n", i, duration.count(), x); + break; + } + + // free is not needed for alloca + // auto start_free = std::chrono::high_resolution_clock::now(); + // free(mem); + // auto stop_free = std::chrono::high_resolution_clock::now(); + // auto duration_free = std::chrono::duration_cast(stop_free - start_free); + + printf("%lu\tAlloca\t%lu\t\t-\t%lu\n", i, duration.count(), x); + } +} + +void test_calloc() +{ + unsigned long x = 0; + for (unsigned long i = 0; i < std::numeric_limits::max(); i++) { + x = x == 0 ? 1 : x * 2; + auto start = std::chrono::high_resolution_clock::now(); + char *mem = (char*)calloc(x, sizeof(char)); + auto stop = std::chrono::high_resolution_clock::now(); + auto duration = std::chrono::duration_cast(stop - start); + if (mem == NULL) { + printf("%lu\tCalloc\t%lu\t\tAllocation error\t%lu\n", i, duration.count(), x); + break; + } + mem[0] = '!'; + if (mem[0] != '!') { + printf("%lu\tCalloc\t%lu\t\t%lu\tMemory check error\n", i, duration.count(), x); + break; + } + + auto start_free = std::chrono::high_resolution_clock::now(); + free(mem); + auto stop_free = std::chrono::high_resolution_clock::now(); + auto duration_free = std::chrono::duration_cast(stop_free - start_free); + + printf("%lu\tCalloc\t%lu\t\t%lu\t%lu\n", i, duration.count(), duration_free.count(), x); + } +} + +void test_malloc() +{ + unsigned long x = 0; + for (unsigned long i = 0; i < std::numeric_limits::max(); i++) { + x = x == 0 ? 1 : x * 2; + auto start = std::chrono::high_resolution_clock::now(); + char *mem = (char*)malloc(x); + auto stop = std::chrono::high_resolution_clock::now(); + auto duration = std::chrono::duration_cast(stop - start); + if (mem == NULL) { + printf("%lu\tMalloc\t%lu\t\tAllocation error\t%lu\n", i, duration.count(), x); + break; + } + mem[0] = '!'; + if (mem[0] != '!') { + printf("%lu\tMalloc\t%lu\t\t%lu\tMemory check error\n", i, duration.count(), x); + break; + } + + auto start_free = std::chrono::high_resolution_clock::now(); + free(mem); + auto stop_free = std::chrono::high_resolution_clock::now(); + auto duration_free = std::chrono::duration_cast(stop_free - start_free); + + printf("%lu\tMalloc\t%lu\t\t%lu\t%lu\n", i, duration.count(), duration_free.count(), x); + } +} + +void test_new() +{ + unsigned long x = 0; + for (unsigned long i = 0; i < std::numeric_limits::max(); i++) { + x = x == 0 ? 1 : x * 2; + auto start = std::chrono::high_resolution_clock::now(); + char *mem; + try { + mem = new char[x]; + } catch(std::bad_alloc& ba) { + auto stop = std::chrono::high_resolution_clock::now(); + auto duration = std::chrono::duration_cast(stop - start); + printf("%lu\tNew\t%lu\t\tAllocation error\t%lu\n", i, duration.count(), x); + break; + } + auto stop = std::chrono::high_resolution_clock::now(); + auto duration = std::chrono::duration_cast(stop - start); + if (mem == NULL) { + printf("%lu\tNew\t%lu\t\tAllocation error\t%lu\n", i, duration.count(), x); + break; + } + mem[0] = '!'; + if (mem[0] != '!') { + printf("%lu\tNew\t%lu\t\t%lu\tMemory check error\n", i, duration.count(), x); + break; + } + + auto start_free = std::chrono::high_resolution_clock::now(); + delete[] mem; + auto stop_free = std::chrono::high_resolution_clock::now(); + auto duration_free = std::chrono::duration_cast(stop_free - start_free); + + printf("%lu\tNew\t%lu\t\t%lu\t%lu\n", i, duration.count(), duration_free.count(), x); + } +} + +int main(int argc, char const *argv[]) +{ + printf("#\tType\tAllocation\tFree\tBuf size\n"); + test_malloc(); + + printf("\n"); + printf("#\tType\tAllocation\tFree\tBuf size\n"); + test_calloc(); + + printf("\n"); + printf("#\tType\tAllocation\tFree\tBuf size\n"); + test_new(); + + printf("\n"); + printf("#\tType\tAllocation\tFree\tBuf size\n"); + test_alloca(); + + printf("The End :)\n"); + return 0; +} diff --git a/06_memory/user/output.txt b/06_memory/user/output.txt new file mode 100644 index 0000000..2cd51ae --- /dev/null +++ b/06_memory/user/output.txt @@ -0,0 +1,138 @@ +# Type Allocation Free Buf size +0 Malloc 4 4 1 +1 Malloc 4 4 2 +2 Malloc 4 4 4 +3 Malloc 4 4 8 +4 Malloc 4 4 16 +5 Malloc 4 4 32 +6 Malloc 4 4 64 +7 Malloc 4 4 128 +8 Malloc 4 4 256 +9 Malloc 4 4 512 +10 Malloc 4 4 1024 +11 Malloc 4 4 2048 +12 Malloc 4 4 4096 +13 Malloc 4 4 8192 +14 Malloc 4 4 16384 +15 Malloc 4 4 32768 +16 Malloc 4 4 65536 +17 Malloc 4 4 131072 +18 Malloc 4 4 262144 +19 Malloc 4 4 524288 +20 Malloc 4 4 1048576 +21 Malloc 4 4 2097152 +22 Malloc 4 4 4194304 +23 Malloc 4 5 8388608 +24 Malloc 4 4 16777216 +25 Malloc 4 5 33554432 +26 Malloc 4 9 67108864 +27 Malloc 4 4 134217728 +28 Malloc 4 4 268435456 +29 Malloc 4 9 536870912 +30 Malloc 4 10 1073741824 +31 Malloc 4 9 2147483648 +32 Malloc 4 9 4294967296 +33 Malloc 4 9 8589934592 +34 Malloc 4 10 17179869184 +35 Malloc 4 Allocation error 34359738368 + +# Type Allocation Free Buf size +0 Calloc 4 4 1 +1 Calloc 4 4 2 +2 Calloc 4 4 4 +3 Calloc 4 4 8 +4 Calloc 4 4 16 +5 Calloc 4 4 32 +6 Calloc 4 4 64 +7 Calloc 4 4 128 +8 Calloc 4 4 256 +9 Calloc 4 4 512 +10 Calloc 4 4 1024 +11 Calloc 4 4 2048 +12 Calloc 4 4 4096 +13 Calloc 4 4 8192 +14 Calloc 4 4 16384 +15 Calloc 9 4 32768 +16 Calloc 13 4 65536 +17 Calloc 28 4 131072 +18 Calloc 53 4 262144 +19 Calloc 13 4 524288 +20 Calloc 146 4 1048576 +21 Calloc 204 4 2097152 +22 Calloc 397 4 4194304 +23 Calloc 782 4 8388608 +24 Calloc 1617 4 16777216 +25 Calloc 10 12 33554432 +26 Calloc 4 6 67108864 +27 Calloc 4 4 134217728 +28 Calloc 4 4 268435456 +29 Calloc 4 5 536870912 +30 Calloc 4 10 1073741824 +31 Calloc 6 10 2147483648 +32 Calloc 4 9 4294967296 +33 Calloc 4 9 8589934592 +34 Calloc 5 9 17179869184 +35 Calloc 5 Allocation error 34359738368 + +# Type Allocation Free Buf size +0 New 6 4 1 +1 New 4 4 2 +2 New 4 4 4 +3 New 4 4 8 +4 New 4 4 16 +5 New 4 4 32 +6 New 4 4 64 +7 New 4 4 128 +8 New 4 4 256 +9 New 4 4 512 +10 New 4 4 1024 +11 New 9 4 2048 +12 New 9 4 4096 +13 New 4 9 8192 +14 New 9 4 16384 +15 New 4 4 32768 +16 New 4 4 65536 +17 New 4 4 131072 +18 New 9 4 262144 +19 New 4 4 524288 +20 New 4 4 1048576 +21 New 9 4 2097152 +22 New 9 4 4194304 +23 New 9 4 8388608 +24 New 9 4 16777216 +25 New 14 5 33554432 +26 New 9 7 67108864 +27 New 14 4 134217728 +28 New 13 4 268435456 +29 New 13 9 536870912 +30 New 14 10 1073741824 +31 New 9 10 2147483648 +32 New 4 11 4294967296 +33 New 9 9 8589934592 +34 New 9 10 17179869184 +35 New 31 Allocation error 34359738368 + +# Type Allocation Free Buf size +0 Alloca 4 - 1 +1 Alloca 4 - 2 +2 Alloca 9 - 4 +3 Alloca 4 - 8 +4 Alloca 4 - 16 +5 Alloca 4 - 32 +6 Alloca 4 - 64 +7 Alloca 9 - 128 +8 Alloca 4 - 256 +9 Alloca 9 - 512 +10 Alloca 4 - 1024 +11 Alloca 4 - 2048 +12 Alloca 9 - 4096 +13 Alloca 9 - 8192 +14 Alloca 9 - 16384 +15 Alloca 14 - 32768 +16 Alloca 26 - 65536 +17 Alloca 43 - 131072 +18 Alloca 84 - 262144 +19 Alloca 165 - 524288 +20 Alloca 324 - 1048576 +21 Alloca 676 - 2097152 +Segmentation fault (core dumped) \ No newline at end of file diff --git a/06_memory/user/run.sh b/06_memory/user/run.sh new file mode 100755 index 0000000..41222da --- /dev/null +++ b/06_memory/user/run.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +g++ memory_check.cpp +./a.out \ No newline at end of file