Commit Graph
26 Commits
Author SHA1 Message Date
Kyle Wojtaszek 4c72048b5c FIxing corruption in callbacks
Signed-off-by: Kyle Wojtaszek <kylewo@microsoft.com>
2021-10-12 14:31:04 -07:00
Kyle W 0b148d19cf Fix corruption in x86 callback 2021-06-14 13:44:35 -07:00
Kevin Parsons 941861fe1a pkg/etw: Fix to build on windows/arm
We don't support actually using ETW on windows/arm, but to make things
easier for downstream dependencies, we want to still allow the package
to compile and just no-op on this architecture. We do this by returning
a nil Provider, and implementing its methods to no-op when the receiver
is nil.

Previously this was implemented by putting NewProviderWithID in
provider_unsupported.go, but when we refactored the code so that the
actual work was done in NewProviderWithOptions instead, we didn't fix up
provider_unsupported. This change fixes this by putting only
NewProviderWithOptions in provider_unsupported.go, since the other
provider creation functions call into this one.

Signed-off-by: Kevin Parsons <kevpar@microsoft.com>
2021-03-24 15:05:25 -07:00
Paul "TBBle" Hampson 1390d1a07b Pull sync generated syscalls
This moves all the current users of
$GOROOT/src/syscall/mksyscall_windows.go to instead use
golang.org/x/sys/windows/mkwinsyscall, as directed by the version of the
former in Go 1.15.

It also syncs the local forks of mksyscall_windows.go with the latest
version of golang.org/x/sys/windows/mkwinsyscall/mkwinsyscall.go, so
that the local patches can be easily seen in a side-by-side comparison.
Significant changes compared to the in-tree forked versions:
* *bool parameters are read back through a temp-var, not directly like
  other pointer parameters.
* ?-suffixed function names support testing for function presence before
  calling. This replaces a local implementation of this in
  pkg/security, which was not actually used anyway. The upstream version
  correctly supports functions that don't already have an error return.
* `errnoErr(0)` is now useful, so each call of `errnoErr` doesn't need
  to be protected with a check for 0 first.
* The generated functions are now sorted. This of course produced a
  *lot* of churn in the generated files.

vhd\vhd.go was changed to generate syscalls into zvhd_windows.go, since
regeneration removes the build tag added by hand in
9d8277341f.

After all that, I also ran
```
go generate . .\pkg\etw\ .\pkg\process\ .\pkg\security\ .\vhd\
```
to update all the existing generated code.

Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
2021-02-11 22:47:40 +11:00
Kathryn Baldauf 68cdd9bd9d Merge pull request #191 from uhthomas/master
Add build guards for all Windows imports
2021-02-10 17:11:08 -08:00
Thomas e09292102f Add noop mains for non windows builds 2021-02-11 00:05:48 +00:00
Thomas d4c02ad896 Add missing build constraints 2021-02-10 23:54:19 +00:00
Thomas f0d2c76ab3 Fix missing platform/architecture separation 2021-02-10 23:09:41 +00:00
Thomas eb9d8c9346 Separate platform from architecture build constraints 2021-02-10 23:05:19 +00:00
Kyle Wojtaszek 652abba813 Removing unneeded NewProviderWithGroup function 2021-01-27 14:43:00 -08:00
Kyle Wojtaszek 30844eed75 Add ability to set provider group 2021-01-27 13:12:37 -08:00
Thomas Way 9d8277341f Add build guards for all Windows imports 2021-01-21 23:24:01 +00:00
Kevin Parsons c20fb68775 etw: Add test for provider name to GUID conversion
Also simplified the name to GUID conversion code, and improved the
comments.

Signed-off-by: Kevin Parsons <kevpar@microsoft.com>
2019-07-10 15:12:20 -07:00
Kevin Parsons a2a7cd6b7d Fix errors introduced with guid-by-value change
Signed-off-by: Kevin Parsons <kevpar@microsoft.com>
2019-05-08 16:43:22 -07:00
Justin f4260581c2 Merge pull request #132 from jstarks/etwtime
pkg/etw: Add support for time.Time
2019-05-07 10:25:08 -07:00
John Starks 89c1d0e19d pkg/etw: Add support for time.Time
This change adds support for encoding time.Time values as FILETIME
values in tracelogging events. FILETIME has slightly less precision than
time.Time (100ns vs 1ns), but it is the closest availble match.
2019-05-05 00:02:18 +00:00
Kevin Parsons 0112307ab4 Fix ETW package to work on 386
The ETW registration handle is defined to be 64-bits on all platforms. The Go
type previously used a uintptr which created problems on 32-bit systems. This
change adds a new wrapper file which receives a 64-bit handle for the functions
defined in it, and correctly passes it to the native ETW functions either as-is
(on 64-bit) or as two 32-bit values (on 32-bit).

This required a minor change in mksyscall_windows.go, to allow multiple syscalls
that map to the same underlying function without causing a duplicate definition
error in the generated file.
2019-04-22 10:28:49 -07:00
Kevin Parsons 1af701744e Add stock mksyscall_windows.go to ETW package
This is just so we can see the alterations we make to this file as a diff in
the next commit.
2019-04-22 10:24:50 -07:00
Kevin Parsons a4918f0a0f Make ETW no-op on ARM
Proper support for ETW on ARM will require additional changes in Go to support
more than 16 bytes of arguments to a syscall callback. Until this work is done,
the ETW package is being changed to no-op on ARM.
2019-04-20 19:23:37 -07:00
Kevin Parsons dac77d8a7c etw: Fix panic when provider creation fails
There is a cleanup function deferred to remove the provider from the global
provider map. However, this function didn't bind the value of provider ahead of
time, so when the provider creation returned with nil for provider, we tried to
cleanup a nil provider, and panicked.
2019-04-19 10:43:53 -07:00
Kevin Parsons 88da7d1491 Add guid package 2019-04-01 16:07:14 -07:00
Kevin Parsons 873693efb7 Add opcode support to etw package 2019-03-28 14:34:17 -07:00
Kevin Parsons dd3d7fa178 Merge pull request #120 from kevpar/etw-smart-field
Move smart ETW field logging to base etw library
2019-03-22 14:48:08 -07:00
Kevin Parsons a132ab2270 Move smart ETW field logging to base etw library 2019-03-22 14:16:54 -07:00
Kevin Parsons 9ea416ec01 Fix activity ID not being passed in ETW 2019-03-22 11:11:18 -07:00
Kevin Parsons ce5a3739bc Export etw package 2019-03-18 23:57:19 -07:00