Тёмный

Developing Kernel Drivers with Modern C++ - Pavel Yosifovich 

NDC Conferences
Подписаться 198 тыс.
Просмотров 80 тыс.
50% 1

Опубликовано:

 

5 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 67   
@davidpike766
@davidpike766 5 лет назад
"no one is there to call your constructors" - my new fave tshirt
@CosmoCopulates1
@CosmoCopulates1 5 лет назад
This man is brilliant!
@RonilMalvania
@RonilMalvania 2 года назад
Very good explanation and helpful to develop stable driver. Pavel is best windows OS instructor. Thanks for sharing knowledge .
@KangJangkrik
@KangJangkrik 3 года назад
I have no idea why people hate C++ so much, namespace is really useful for me to keep everything organized
@internetfacile4146
@internetfacile4146 2 года назад
yes , me too
@hamoodrex
@hamoodrex 2 года назад
I dont hate it. I just prefer other languages. C++ code never looked clean. Sometimes you have to do 10 times the typing to get the same result. Yes its low level process heap data fetching stuff is cool and all but for general purposes other languages do have a better aesthetic look to them. I find myself looking into c++ when I want to achieve the epitomy of performances or for low level programming like in kernel mode for this instance
@philippemts88
@philippemts88 2 года назад
Two words: linus torvalds.
@KangJangkrik
@KangJangkrik 2 года назад
@@philippemts88 not only lord torvalds, Mr. Stallman too
@Unv12sL
@Unv12sL Год назад
it's not necessarily people hate c++, in terms of cost benefits when making a web app for corporate use/requirements it would cost a LOT of money and manpower to manually take care of heap memory/garbage collection than using a language that automagically takes care of garbage (java) - but other then that , C++ for firmware / hardware interfacing is still preferred
@Kid420
@Kid420 4 года назад
אלוף, גאווה שיש בן אדם כזה בישראל.
@MasterCheats343
@MasterCheats343 2 года назад
נכון
@smithwilliams5637
@smithwilliams5637 Год назад
exactly what I got from that
@cesarmtodoido8850
@cesarmtodoido8850 5 лет назад
lol i do failed looking for v2 of kernel pool monitor, then i realized that, the dude on presentation is the developer of it.. omg... gj Pavel Yosifovich, i'm w8 for v2 download link !!! XDD
@RaptorFactor5
@RaptorFactor5 5 лет назад
No need to wait, it's already available for some time: github.com/zodiacon/PoolMonXv2
@golosovsky
@golosovsky 5 лет назад
BTW, he's also one of the authors of Windows Internals 7
@Elite7555
@Elite7555 4 года назад
13:35 Would it be possible (theoretically) to develop a kernel on a virtual machine?
@AE2-scc
@AE2-scc 4 года назад
That’s what it’s kinda made for. Don’t mess with a kernel on a regular pc. Always do it virtually.
@quasa0
@quasa0 3 года назад
@@AE2-scc why
@quasa0
@quasa0 3 года назад
@Worlanyo Amevuvor why
@wp-wisdom
@wp-wisdom 3 года назад
@@quasa0 again if you do something not supposed to be done to the hardware, then your pc could crash or you could get the blue screen of death "BSOD" which could potentially harm the hardware. that's why.
@quasa0
@quasa0 3 года назад
@@wp-wisdom I'm just wondering if there is a specific scenario how getting like a devision by zero exception in the driver you're coding would corrupt any system things
@JoseLima-fn2vn
@JoseLima-fn2vn 11 месяцев назад
Very good !!!!
@Narblo
@Narblo Год назад
I dont get why the delete and new operators would not be available. Dont they translate to a call to the kernel? In kernel mode you could override them to call the proper function to free the memory. I also dont get why calling the destructors of global variables is impossible. Wouldnt the destructors be called at the end of main? The compiler should be able to do that for you am I right?
@zanityplays
@zanityplays Год назад
No
@TerabyteForever
@TerabyteForever Год назад
"delete" and "new" (by default of course) do allocate/free a portion of an arena in the userspace, not in the kernel space. Hence, the OS provided functions should be used, those operators could very well be overloaded as well. I don't really know the answer to your second question but it could be related with RAII.
@AHToHK
@AHToHK Год назад
when main() ends in an ordinary program, the execution continues in "CRT main" which calls registrered destructors for global and static objects. As for the drivers, I guess, there is no underlying CRT part, so you'll have to track global/static objects by yourself to call their destuctors.
@dancristian3673
@dancristian3673 2 года назад
please indicate how to access my kernel mode driver .sys functions from native c++ code or c# code... i know how to create and install kernel driver .sys but don´t know how to access the kernel driver .sys from applications.. i mean, obviously the drivers .sys are intended to comunicate to hardware devices from the implemented functions it has, so the question is " how to access those implemented functions from c# or c++ code??? that´s the question of million... because if i want to turn on a led in my device connected to USB from c# or c++ code i have to give the order to the driver. right?...
@EE-cc5bd
@EE-cc5bd 5 месяцев назад
DeviceIoControl ?
@dancristian3673
@dancristian3673 5 месяцев назад
@@EE-cc5bd do oyu know how to get a listing of all b2c USERS and assign them to security group from graph beta api' ?
@EE-cc5bd
@EE-cc5bd 5 месяцев назад
@@dancristian3673 Honestly, I'd google it.
@EE-cc5bd
@EE-cc5bd 5 месяцев назад
@@dancristian3673 That I'd google it.
@jevsdisjava
@jevsdisjava 3 года назад
people says "its not possible to run a programm in kernel mode". but ,we know data bases system dont use filessytem but acces direct disk block sector, so why database get installed?
@dosomething3
@dosomething3 3 года назад
Very interesting
@quasa0
@quasa0 3 года назад
What
@quasa0
@quasa0 3 года назад
You know there are open source db you could look at?
@AshishNegi1618
@AshishNegi1618 2 года назад
When they say databases don't use file system, they mean that they pass the flags like direct_io, no buffering to files stem which by pass file system cache ; so, your writes go directly to disk;
@ronald3836
@ronald3836 22 дня назад
Databases still run in user space, even if they use raw block access to bypass the file system..
@CTPATEX
@CTPATEX 5 лет назад
0) you can totally have C++ globals in drivers 1) AutoLock is unnecessary, there is std::lock_guard. 2) operator bool const() { - is nonsense 3) if (_owner && _handle) should call Traits::IsValid(_handle) 4) _handle = nullptr should call Traits::InvalidHandle() (in fact, GenericHandle shouldn't be using nullptr at all) 5) GenericHandle move ops should be noexcept 6) branching in move-assignment is unnecessary 7) GenericHandle constructor should be explicit 8) return value of NtClose is not checked 9) const wchar_t operator[](... - lol 10) GetUnicodeString should just return UNICODE_STRING by value 11) IComponent needs virtual destructor 12) QueryInterface(IComponent::IID... is broken 13) ComponentBase::QueryInterface does not work if interfaces inherit each other.
@test143000
@test143000 4 года назад
0) You can't have them out of the box. You need to call constructors and destructors for global C++ objects, e. g. in DriverEntry and DriverUnload. 8) There is no need for this. If it failed you had an invalid handle. Internally the system ignores the returned value for IRP_MJ_CLEANUP. So there is no way to stop / prevent handle closure.
@CTPATEX
@CTPATEX 4 года назад
​@@test143000 0) yep, whatever MS CRT does in this case, it is not rocket surgery (it is just a simple loop) and all the sources are available; 8) I'm a simple man - dropping errors on the floor like this will not pass my code review. Either process the error (call BSOD when needed) or write big giant comment explaining why the result is ignored (and I guarantee you this comment will be at least 3 pages long at the end of the review process, and will contain the explanation of why exactly "you had an invalid handle", what are consequences of ignoring the result, architectural implications, current political situation in the country, and all the reasoning for the answer to the ultimate question of life, the universe and everything). Ignoring the return value is not an easy task.
@test143000
@test143000 4 года назад
@@CTPATEX 0) You can port a garbage collector to KM. That doesn't mean that it exists in the kernel. So, no C++ globals in KM by default. Also, there is no C++ exceptions handling available in KM to process global constructors errors. So you are missing a point. 8) Calling KeBugCheck on NtClose error or requiring for lengthy comments on missing errors checks can only raise eyebrows among kernel developers. You are really a simple man and you are better to stay away from KM code review.
@CTPATEX
@CTPATEX 4 года назад
@@test143000 0) I can port a garbage collector to KM, you can't have globals. Is this what you are saying? What do you mean "exists in the kernel"? Please provide a link to this (or give your own definition if you just invented this for the sake of argument). Your comment about C++ exceptions has nothing to do with anything, please try again. 8) Their eyebrows is your best argument. 👍 If someone's eyebrows are your reliable guide and source of your wisdom, then I can't help. Are you Pavel?
@test143000
@test143000 4 года назад
@@CTPATEX It is okay for an amateur to be ignorant about some KM concepts, e.g. there is no support for C++ globals (you need to add it) and NtClose returned status doesn't make a lot of sense and is not checked for the most cases (the NT kernel doesn't check it for example, the reason - IRP_MJ_CLEANUP status is ignored by the system). Relax. BTW I am not Pavel, he doesn't speak Russian.
@AlienFreak69
@AlienFreak69 2 года назад
This is out of my skill level but super interesting nonetheless. Maybe some day I'll be able to write my own windows drivers
@yldrmcs
@yldrmcs 9 месяцев назад
memory compression in kernel? 🤮
@MarieAmeliaFreyaAster
@MarieAmeliaFreyaAster 3 года назад
Screw C++
Далее
WHY did this C++ code FAIL?
38:10
Просмотров 260 тыс.
How Do Linux Kernel Drivers Work? - Learning Resource
17:02
Is C++ better than C?
1:46:10
Просмотров 47 тыс.
Write and Submit your first Linux kernel Patch
41:26
Просмотров 313 тыс.
Rust: When C Code Isn't Enough
8:26
Просмотров 168 тыс.
Should I pass by const reference or by value?
10:45
Просмотров 105 тыс.