Skip to content

Poison address-exposed user variables in debug - #54685

Merged
jakobbotsch merged 12 commits into
dotnet:mainfrom
jakobbotsch:poison-debug-variables
Jul 1, 2021
Merged

Poison address-exposed user variables in debug#54685
jakobbotsch merged 12 commits into
dotnet:mainfrom
jakobbotsch:poison-debug-variables

Conversation

@jakobbotsch

Copy link
Copy Markdown
Member

@ghostghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jun 24, 2021
@jakobbotschjakobbotsch changed the title Poison debug variablesPoison address-exposed user variables in debugJun 24, 2021
@jakobbotsch
jakobbotschforce-pushed the poison-debug-variables branch from d4efca4 to feaff3dCompareJune 24, 2021 15:34
@jakobbotsch

Copy link
Copy Markdown
MemberAuthor

@sandreenko I hope I have addressed what we talked about some weeks ago.

  1. Now we only poison address exposed user locals
  2. The poison code is emitted in a scratch BB right after the prolog
  3. It's implemented for ARM/ARM64 as well

PTAL

@sandreenko

Copy link
Copy Markdown
Contributor

cc @dotnet/jit-contrib

@jakobbotsch

jakobbotsch commented Jun 24, 2021

Copy link
Copy Markdown
MemberAuthor

I want to run local tests first before I do some more testing in CI, not sure that this is quite ready yet.

@sandreenkosandreenko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, this is an elegant solution, a few nits/questions.

Comment threadsrc/coreclr/jit/compiler.h Outdated
Comment threadsrc/coreclr/jit/flowgraph.cpp Outdated
Comment threadsrc/libraries/System.Private.CoreLib/src/System/Decimal.DecCalc.cs Outdated
Comment threadsrc/coreclr/jit/codegencommon.cpp Outdated
Comment threadsrc/coreclr/jit/codegencommon.cpp Outdated
Comment threadsrc/coreclr/jit/codegencommon.cpp Outdated
@jakobbotsch
jakobbotschforce-pushed the poison-debug-variables branch from feaff3d to 8acf5eaCompareJune 25, 2021 17:16
@jakobbotsch

Copy link
Copy Markdown
MemberAuthor

/azp run runtime

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@jakobbotsch
jakobbotsch marked this pull request as ready for review June 28, 2021 23:09
@jakobbotsch

Copy link
Copy Markdown
MemberAuthor

This should be ready for review. I believe the failing tests are #54778.
To make sure we do not allocate things to the scratch register being used for the immediate I have added a kill in register allocation when we see the scratch BB and know that we will emit poisoning. @kunalspathak can you take a look at this part?

cc @dotnet/jit-contrib

@kunalspathakkunalspathak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also include a test for this?

Comment threadsrc/coreclr/jit/flowgraph.cpp Outdated
jakobbotschand others added 3 commits June 29, 2021 20:25
Co-authored-by: Kunal Pathak <Kunal.Pathak@microsoft.com>

@kunalspathakkunalspathak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment threadsrc/coreclr/jit/flowgraph.cpp Outdated
@jakobbotsch

jakobbotsch commented Jul 1, 2021

Copy link
Copy Markdown
MemberAuthor

I added a test. Failing tests are #54778 and some Mono failures (looks like https://github.com/dotnet/runtime/issues/53329#issuecomment-871039590). I'll wait for @echesakovMSFT review before merging.

@sandreenkosandreenko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@echesakovechesakov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jakobbotsch
jakobbotsch merged commit b8beed2 into dotnet:mainJul 1, 2021
@jakobbotsch
jakobbotsch deleted the poison-debug-variables branch July 1, 2021 19:39
thaystg added a commit to thaystg/runtime that referenced this pull request Jul 2, 2021
* origin/main: (27 commits)
[mono][llvm] Only emit 'LLVM failed' messages on verbosity > 0. (dotnet#55060)
Http2Stream throws a wrapped Http2ConnectionException on GO_AWAY (dotnet#54625)
[main] Update dependencies from dnceng/internal/dotnet-optimization dotnet/arcade dotnet/xharness dotnet/hotreload-utils (dotnet#55007)
disable a failing test. (dotnet#55063)
[mono][wasm] Disable some tests which crash on AOT. (dotnet#55054)
Fix fix_allocation_context for regions (dotnet#54931)
Delete stale references to System.IO.FileSystem.Primitives (dotnet#55041)
Add binplaced analyzers to ASP.NET transport package (dotnet#55042)
[mono] Enable many HardwareIntrinsic tests on wasm
Delete `compQuirkForPPP`. (dotnet#55050)
[Mono] Condition Workload AOT import to be osx only (dotnet#55040)
package native quic library (dotnet#54992)
Make GlobalizationMode code consistent (dotnet#55039)
Expand PerfMap format to support metadata for symbol indexation (dotnet#53792)
[debugger]Componentize debugger (dotnet#54887)
[Mono] Include loaded interpreter methods as EventPipe session rundown method events. (dotnet#54953)
Delete stale ActiveIssue from HttpHeadersTest (dotnet#55027)
Poison address-exposed user variables in debug (dotnet#54685)
Recategorize emsdk dependency (dotnet#55028)
Remove the the wasm AOT specific test project exclusions (dotnet#54988)
...
@ghostghost locked as resolved and limited conversation to collaborators Jul 31, 2021
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fill uninitialized address-taken locals with poison pattern in debug codegen

4 participants

@jakobbotsch@sandreenko@echesakov@kunalspathak