Commit graph

1035 commits

Author SHA1 Message Date
Max Raulea
a02a0a25fd Port hyperlog to the Linux kernel module
Logging.c and UnloadDll.c compile and link into HyperDbg.ko, along with
the two components that were waiting on the logging layer (BinarySearch,
OptimizationsExamples).

- new PlatformStr.{h,c}: PlatformVsnprintf/Sprintf/Strnlen replace
  vsprintf_s/sprintf_s/strnlen_s; PlatformSprintf moved here out of
  PlatformMem so both spellings return -1 on truncation
- BasicTypes.h: IRP/IO_STACK_LOCATION/IO_STATUS_BLOCK/UNICODE_STRING
  grow the members shared code touches, plus the NT status and access
  constants the notify path needs
- Environment.h: RTL_NUMBER_OF, _Analysis_assume_, ASSERT -> WARN_ON
- PlatformEvent: ExEventObjectType placeholder token
- HyperLogCallback.c stays out of the module: it defines the same
  LogCallback* entry points as Logging.c (it is the per-DLL forwarding
  shim on Windows), so in one link unit it is a duplicate symbol
2026-08-14 16:25:37 +02:00
Max Raulea
a7d6535442 Add files to the build files
Hopefully fixes build issue
2026-08-14 15:41:00 +02:00
Max Raulea
4dc132937f Port components/Spinlock.c to Linux kernel module
Route Spinlock.c's three MSVC intrinsics through the platform
intrinsics layer instead of the Windows builtins:
  _mm_pause                 -> CpuPause (already existed)
  _interlockedbittestandset -> CpuInterlockedBitTestAndSet (new)
  InterlockedCompareExchange-> CpuInterlockedCompareExchange (new, 32-bit)

Add the two new Cpu* wrappers to the kernel PlatformIntrinsics
{.h,.c} with win + linux arms (Linux uses __atomic_* builtins,
mirroring the existing 64-bit CAS), keeping the Cpu* wrappers the
single intrinsic boundary.
2026-08-14 11:35:21 +02:00
Sina Karvandi
368f0302f4
Merge pull request #673 from HyperDbg/linux
Linux
2026-08-13 15:01:18 +02:00
Max Raulea
2a23d05ce6 Filled in the time stubs for platformtime functions for linux 2026-08-11 13:13:07 +02:00
Max Raulea
33571e2c51 Implementationb of the platform spinlocks file for linux kernel module 2026-08-11 13:02:16 +02:00
Max Raulea
786cb1775d Filled in PlatformProcess.c for linux module build 2026-08-11 12:53:18 +02:00
Max Raulea
b0de162deb Added linux part of PlatformIrql
Added the linux part of PlatformIrql by adding preempt_enable() and preempt_disable.
2026-08-11 12:20:50 +02:00
Max Raulea
9ea26e4f8b PlatformIO stub
Empty stubs for PLatform IO and added some types to the linux build
2026-08-11 12:00:27 +02:00
Max Raulea
d64ce241f7 Added stub for the PLatform event file
Added a  empty stub for the event functions on linux, since they don't
have a one to one mapping. also removed some redundant guards.
2026-08-11 11:17:35 +02:00
Max Raulea
6bb174b006 linux BHqueue for windows DPC port
In order for PlatformDpc to compile on linux I stubbed out the DPC part
and made a skeleton for the linux implementation using the BHqueue.
2026-08-11 10:53:17 +02:00
xmaple555
d53712638c revert hyperdbg-test 2026-08-11 00:23:02 +08:00
Sina Karvandi
80f224fa58
Merge pull request #671 from nikzad66/uin-uout-commands
Uin uout commands
2026-08-10 12:00:21 +02:00
sina
c8a209d84b add different DW DA definition 2026-08-08 16:38:16 +02:00
Nikzad
128c9fac77 header files 2026-08-06 21:11:59 +03:30
Sina Karvandi
12cd4250b5
Merge pull request #664 from HyperDbg/linux
Linux
2026-08-01 20:18:42 +02:00
Max Raulea
17fb85f366 added header for PLatformCPU 2026-08-01 17:08:20 +02:00
Max Raulea
652721be62 Added Printk in rhw platformDBG file
For debug printing added printk for linux kernel logging.
2026-08-01 17:06:58 +02:00
Max Raulea
953af9388a PlatformCPU Linux Implementation
Filled in the stubs for the windows functions:
KeQueryActiveProcessorCount(0) and KeGetCurrentProcessorNumberEx(NULL).
KeQueryActiveProcessorCount(0) maps one to one to num_online_cpus()
KeGetCurrentProcessorNumberEx(NULL) maps to raw_smp_processor_id(),
however this can also be smp_processor_id(), we have to decide based on
preemption, the latter checks for preemption and throws a warning if it
is executed in preemptible code. (I dont know the kernel code well
enough so this may need some discussion)
2026-08-01 16:54:08 +02:00
Max Raulea
be2c96d192 Environment header file guards
For the kernel module build some libc header files are not present so we
guard them out for the kernel build
2026-08-01 16:52:29 +02:00
Sina Karvandi
e5a41009f5
Merge pull request #663 from munraimix/fix/serial-resync
Resync the serial receiver on framing overflow instead of flooding after an unclean disconnect
2026-08-01 13:23:48 +02:00
sina
b77df6a62b remove unused serial codes 2026-07-29 15:02:53 +02:00
munraimix
2cd78897c0 Resync serial stream on framing overflow instead of flooding the debuggee
When the debugger drops the serial link uncleanly mid-frame (no CLOSE_AND_UNLOAD packet), SerialConnectionRecvBuffer overflowed without an end-of-buffer marker and returned FALSE into the KD dispatch loop retry. The loop re-entered the same desynced stream, so it overflowed again at once and flooded 'buffer exceeds the buffer limitation' (and could wedge the KD driver on the next reconnect). Discard bytes to the next end-of-buffer marker to re-align, start a fresh frame, and log once per desync episode with LogWarning. Framing and protocol are unchanged.

Refs #661
2026-07-26 22:43:57 +10:00
Max Raulea
4bf987a596 Added missing files to the CMake build file and sweeped them for the Platform functions and guarded windows only code 2026-07-24 21:06:04 +02:00
Max Raulea
5175381c73 script engine linux build complete, added undefined references with empty stubs or linux port and updated the Cmake file accordingly 2026-07-24 20:02:00 +02:00
Max Raulea
8583d99d14 Added ucpuid to CMakeList.txt and made it portable 2026-07-24 19:48:24 +02:00
sina
36a4f67501 update version and CHANGELOG.md 2026-07-24 13:13:49 +02:00
sina
aa96eaa617 fix snprintf_s function 2026-07-23 15:46:03 +02:00
Sina Karvandi
8e1288949b
Merge pull request #657 from HyperDbg/linux
Linux
2026-07-23 15:44:56 +02:00
sina
7911465b93 cleanup ucpuid command codes 2026-07-23 10:03:35 +02:00
Nikzad
b1b9680ce6 cpuid: some changes for improvement 2026-07-22 21:21:17 +03:30
Max Raulea
6683c2dc3d New socket platform API and named-pipe linux file 2026-07-22 11:32:39 +02:00
Max Raulea
1abac35edc new email and some changes 2026-07-22 11:05:07 +02:00
Max Raulea
6f7bc287fe Guards and Documentation 2026-07-22 10:16:22 +02:00
Max Raulea
926070135d Sweeps and extra guards and some new platform functionsd 2026-07-21 15:53:34 +02:00
Sina Karvandi
6324c1d718
Merge pull request #650 from nikzad66/feature-cpuid-command
Feature cpuid command
2026-07-21 14:28:37 +02:00
Sina Karvandi
fe9a6f39e4
Merge pull request #654 from HyperDbg/linux
Linux
2026-07-21 14:05:03 +02:00
xmaple555
d44c726dff update variable type and add float type in script enginr 2026-07-20 23:21:34 +08:00
Max Raulea
a29e210ab0 Porting status update and terminate thread platform call 2026-07-20 12:32:10 +02:00
xmaple555
ec5fe7cc8a add float in script engine 2026-07-20 15:03:45 +08:00
Sina Karvandi
8db1b75b4f
Merge pull request #649 from xmaple555/mydev
Add struct in script engine
2026-07-19 22:34:41 +02:00
sina
d37352fd7e fix the error for referencing guest registers twice in both kd and vmx codes 2026-07-19 19:39:33 +02:00
Sina Karvandi
18af7f2cbd
Merge pull request #648 from munraimix/fix/kd-null-regs-on-manual-break
Fix DRIVER_IRQL_NOT_LESS_OR_EQUAL when reading registers on a manually-halted core
2026-07-19 19:28:53 +02:00
Nikzad
b8a4417709 core: add CPUID command definitions and data structures- Add DEBUGGER_CPUID_REQUEST_RESPONSE structure
- Add ucpuid command to commands.h and help.h
- Add IOCTL definitions for CPUID
- Use macros for CPUID leaf decoding
- Update Connection.h with new packet types
2026-07-19 18:09:33 +03:30
Max Raulea
dd38a30d22 New Platform functions and maybe missed CpuID wrapper function? 2026-07-19 11:05:12 +02:00
munraimix
7436b35fd0 Fix DRIVER_IRQL_NOT_LESS_OR_EQUAL when reading registers on a manually-halted core
In Debugger Mode, breaking the debuggee and then reading registers (e.g. the
'r' command) could bugcheck the debuggee with DRIVER_IRQL_NOT_LESS_OR_EQUAL
(0xD1) at IRQL 0xff.

Root cause: DebuggerCommandReadRegisters() copies GUEST_REGS from
DbgState->Regs, but the per-core DbgState->Regs is only populated on the
event-triggered halt paths. A core halted via a manual break
(DEBUGGER_VMCALL_VM_EXIT_HALT_SYSTEM) or via the NMI broadcast (KdHandleNmi)
never had DbgState->Regs set, so it was NULL and the GUEST_REGS memcpy
dereferenced address 0.

Fix:
- Add VmFuncGetGuestRegs(CoreId) returning g_GuestState[CoreId].Regs (the
  guest GP registers saved on the last vm-exit).
- Populate DbgState->Regs from it on the two manual-halt entry points
  (DEBUGGER_VMCALL_VM_EXIT_HALT_SYSTEM and KdHandleNmi) so register reads on a
  manually-halted core return the correct values.
- Add a defensive NULL check in DebuggerCommandReadRegisters().
2026-07-19 16:53:34 +10:00
xmaple555
8b6d8181a5 add struct in script engine 2026-07-19 09:39:37 +08:00
Max Raulea
0c7adbd244 New platform ioctl func and some sweeps of already existing platform functions 2026-07-18 19:20:56 +02:00
Max Raulea
db3064cb24 Sweeps of PLatform functions 2026-07-18 17:09:52 +02:00
Max Raulea
33de7da8ec test comment 2026-07-18 16:39:45 +02:00