-
Notifications
You must be signed in to change notification settings - Fork 356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
!cpuid script #361
Comments
Hi, For example:
And so on... If you want to know the content registers after the execution of CPUID instruction, you need to use the 'Event calling stage' mechanism. Please take a look at the explanation available here: In short, all you need to do is specify the calling stage on your '!cpuid' command:
For more information, take a look at Example 2: Also, another video that might be helpful for your case: Please let me know if you have any other questions. |
can the hypervisor change the register value "tsc" or is it necessary to change the value on the "fly" (tsc - time) |
It's possible to change the value of TSC (RDTSC/RDTSCP) but changing these values will make your system unstable and it's kinda tricky to change since the timing needs to be accurate but yes, you can easily change the value of registers in case the '!tsc' command. More information: |
!hide automatically change the value of registers after RDTSC? |
Yes, but the current implementation might make the system unstable. We might need to re-design this feature in the future. |
using a script !cpuid {file: .../script.txt }, global parameters are saved when calling this script in !cpuid? |
What do you mean by 'global parameter'? Global variables? |
https://docs.hyperdbg.org/commands/scripting-language/variables-and-assignments - global variables assignment |
Yes, as long as you use a dot '.' in your variable it will remain unchanged in all commands (including scripts and event scripts) until you unload HyperDbg. Once you unload HyperDbg, global variables will be removed. Also please keep in mind that if your event is running the same script simultaneously in multiple cores, you might end up with incorrect values (behavior). Usually, those who use global variables in HyperDbg, also use spinlocks and interlocked functions alongside. Example 2: More information: |
thanks for the answer, I'm checking) |
how to use !hide for ring 0 (kernel driver)? |
.my_variable = 100; it`s my script with global variable, but his not working (the variable does not change ) |
You need to modify the following lines to check for your kernel driver and then compile your customized version of HyperDbg:
|
Are you assigning |
|
what is the point hwdbg if there is a qemu? (sorry about the topic here) |
hwdbg is designed to debug hardware chips (FPGAs), not Windows, Linux, or any operating system. |
is this an FPGA simulator? |
Nope, it generates a synthesizable Verilog (SystemVerilog) code to run on FPGAs. |
when will it be possible to test? |
It will probably be in July or August if everything goes well. |
You need to add a semicolon to the end of your assignment:
|
1: kHyperDbg> ? .my=@Rax; then then result |
I think what you need is something like this:
Please note that if you use a global variable, then it might change from different cores simultaneously. In these cases you need to use a local variable (local to the current core).
Please take a look at: |
I need to store register values in a variable and by calling the script assign a new register value to the variable |
in fact this is little bypass rdtsc check |
So, for this, you don't need a global variable, you just need a local variable. But this is exactly what the |
yes, that's right, I'm debugging the ring0 code. and there is no regular option to specify the driver's memory area in the command !hide. |
Yes, in this case, you just need to modify the following check, in HyperDbg (e.g. add a check for your special driver address based on its RIP register) and recompile HyperDbg:
|
Thank you! it is very cool. but I ran into another problem |
I'm not sure if I quite understand it correctly. 🤨 What do you mean by #DB after tsc? You mean single-stepping through the RDTSC/RDTSCP? |
does the hypervisor handle single step exceptions correctly? https://howtohypervise.blogspot.com/2019/01/a-common-missight-in-most-hypervisors.html |
This is a good point, I'll try to fix it. Thank you for mentioning it |
your product is great, it's strange that it's free |
HyperDbg needs a lot of effort from the community, because of this, it's free and available to everyone. |
and when will it appear approximately fix? |
I try to fix it this month with the v0.9 release. You could also fix it and send a PR. Contributing to HyperDbg is always super appreciated. |
having no experience in hypervisor development, this may take time... tell me, where is the exception handling in your hypervisor? |
So, in that case, let me fix it. It probably needs lots of tests to make sure it won't break other functionalities. |
I encountered this issue, but resolving it is not straightforward. A quick fix could potentially disrupt the functionality of the stepper, necessitating additional testing. Therefore, I've deferred this task to future versions (not v0.9). |
what is a quick solution? |
A quick solution is to change the cpuid vm-exit handler and synchronize it with the stepping mechanism. |
I would like to get a better understanding of the work of the hypervisor, do you have any other contacts? thank you |
You can also join the telegram group t.me/hyperdbg , we discuss HyperDbg at the Telegram group too. |
Hi! I use " !cpuid script { {printf("cpuid : %p\n", @rip);} } " and want to add tr(step-in and registers) after print:
" !cpuid script { {printf("cpuid : %p\n", @rip);} , tr} " but this not working.... how i add debug command in script?
The text was updated successfully, but these errors were encountered: