Skip to content

reuse reflected table generator - #1

Merged
deeprobin merged 1 commit into
deeprobin:issue-2036from
kasperk81:issue-2036
Nov 17, 2021
Merged

reuse reflected table generator#1
deeprobin merged 1 commit into
deeprobin:issue-2036from
kasperk81:issue-2036

Conversation

@deeprobin

Copy link
Copy Markdown
Owner

No description provided.

@deeprobin
deeprobin merged commit 7e61dda into deeprobin:issue-2036Nov 17, 2021
deeprobin pushed a commit that referenced this pull request Jan 16, 2022
…otnet#63598)
* Fix native frame unwind in syscall on arm64 for VS4Mac crash report.
Add arm64 version of StepWithCompactNoEncoding for syscall leaf node wrappers that have compact encoding of 0.
Fix ReadCompactEncodingRegister so it actually decrements the addr.
Change StepWithCompactEncodingArm64 to match what MacOS libunwind does for framed and frameless stepping.
arm64 can have frames with the same SP (but different IPs). Increment SP for this condition so createdump's unwind
loop doesn't break out on the "SP not increasing" check and the frames are added to the thread frame list in the
correct order.
Add getting the unwind info for tail called functions like this:
__ZL14PROCEndProcessPvji:
36630: f6 57 bd a9 stp x22, x21, [sp, #-48]!
36634: f4 4f 01 a9 stp x20, x19, [sp, #16]
36638: fd 7b 02 a9 stp x29, x30, [sp, #32]
3663c: fd 83 00 91 add x29, sp, #32
...
367ac: e9 01 80 52 mov w9, #15
367b0: 7f 3e 02 71 cmp w19, dotnet#143
367b4: 20 01 88 1a csel w0, w9, w8, eq
367b8: 2e 00 00 94 bl _PROCAbort
_TerminateProcess:
-> 367bc: 22 00 80 52 mov w2, #1
367c0: 9c ff ff 17 b __ZL14PROCEndProcessPvji
The IP (367bc) returns the (incorrect) frameless encoding with nothing on the stack (uses an incorrect LR to unwind). To fix this
get the unwind info for PC -1 which points to PROCEndProcess with the correct unwind info. This matches how lldb unwinds this frame.
Always address module segment to IP lookup list instead of checking the module regions.
Strip pointer authentication bits on PC/LR.
deeprobin pushed a commit that referenced this pull request May 29, 2022
This adds support for EnC on arm64. A couple of notes on the
implementation compared to x64:
- On x64 we get the fixed stack size from unwind info. However, for the
frames we set up on arm64 for EnC it is not possible to extract the
frame size from there because their prologs generally look like
stp fp, lr, [sp,#-16]!
mov fp, sp
sub sp, sp, dotnet#144
with unwind codes like the following:
set_fp; mov fp, sp
save_fplr_x #1 (0x01); tp fp, lr, [sp, #-16]!
As can be seen, it is not possible to get the fixed stack size from
unwind info in this case. Instead we pass it through the GC info that
already has a section for EnC data.
- On arm64 the JIT is required to place the PSPSym at the same offset
from caller-SP for both the main function and for funclets. Due to
this we try to allocate the PSPSym as early as possible in the main
function and we must take some care in funclets. However, this
conflicts with the EnC frame header that the JIT uses to place values
that must be preserved on EnC transitions. This is currently
callee-saved registers and the MonitorAcquired boolean.
Before this change we were allocating PSPSym above (before) the
monitor acquired boolean, but we now have to allocate MonitorAcquired
first, particularly because the size of the preserved header cannot
change on EnC transitions, while the PSPSym can disappear or appear.
This changes frame allocation slightly for synchronized functions.
deeprobin pushed a commit that referenced this pull request Jun 4, 2022
These helpers are used to report names of things in warnings. The functional changes are:
* For method parameters, use the parameter name if available (and only if not fallback to the #1 notation)
* For property accessor methods, use the C# naming scheme, so for example Type.Property.get instead of Type.get_Property.
Both of these changes are in preparation to bring NativeAOT closer in behavior to ILLink and the trim analyzers.
For this I moved some of the helpers to the common shared code.
Some unrelated code cleanup as well.
Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
deeprobin pushed a commit that referenced this pull request Jun 23, 2022
* Initial implementation for contract customization
fix build errors
Move converter rooting to DefaultJsonTypeInfoResolver so that it can be used standalone
Fix ConfigurationList.IsReadOnly
Minor refactorings (#1)
* Makes the following changes:
* Move singleton initialization for DefaultTypeInfoResolver behind a static property.
* Consolidate JsonSerializerContext & IJsonTypeInfoResolver values to a single field.
* Move reflection fallback logic away from JsonSerializerContext and into JsonSerializerOptions
* Update src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.cs
* remove testing of removed field
Simplify the JsonTypeInfo.CreateObject implemenetation (#2)
* Simplify the JsonTypeInfo.CreateObject implemenetation
* Update src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfoOfT.cs
* Update src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfoOfT.cs
Co-authored-by: Krzysztof Wicher <mordotymoja@gmail.com>
Co-authored-by: Krzysztof Wicher <mordotymoja@gmail.com>
Tests and fixes for JsonTypeInfoKind.None
TypeInfo type mismatch tests
Allow setting NumberHandling on JsonTypeInfoKind.None
test resolver returning wrong type of options
JsonTypeInfo/JsonPropertyInfo mutability tests
rename test file
Move default converter rooting responsibility behind DefaultJsonTypeInfoResolver (#3)
* Move default converter rooting responsibility behind DefaultJsonTypeInfoResolver
* address feedback
Add simple test for using JsonTypeInfo<T> with APIs directly taking it
fix and tests for untyped/typed CreateObject
uncomment test cases, remove todo
More tests and tiny fixes
Add a JsonTypeInfoResolver.Combine test for JsonSerializerContext (#4)
* Fix JsonTypeInfoResolver.Combine for JsonSerializerContext
* Break up failing test
Fix simple scenarios for combining contexts (#6)
* Fix simple scenarios for combining contexts
* feedback
JsonSerializerContext combine test with different camel casing
Remove unneeded virtual calls & branching when accessing Get & Set delegates (#7)
JsonPropertyInfo tests everything minus ShouldSerialize & NumberHandling
Update src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonConverterOfT.cs
Update src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonConverterOfT.cs
throw InvalidOperationException rather than ArgumentNullException for source gen when PropertyInfo.Name is assigned through JsonPropertyInfoValues
tests for duplicated property names and JsonPropertyInfo.NumberHandling
Add tests for NumberHandling and failing tests for ShouldSerialize
disable the failing test and add extra checks
disable remainder of the failing ShouldSerialize tests, fix working one
Fix ShouldSerialize and IgnoreCondition interop
Add failing tests for CreateObject + parametrized constructors
Fix CreateObject support for JsonConstructor types (#10)
* Fix CreateObject support for JsonConstructor types
* address feedback
Make contexts more combinator friendly (#9)
* Make contexts more combinator friendly
* remove converter cache
* redesign test to account for JsonConstructorAttribute
* Combine unit tests
* address feedback
* Add acceptance tests for DataContract attributes & Specified pattern (#11)
* Add private field serialization acceptance test (#13)
* tests, PR feedback (#14)
* PR feedback and extra tests
* Shorten class name, remove incorrect check (not true for polimorphic cases)
* Make parameter matching for custom properties map property Name with parameter (#16)
* Test static initialization with JsonTypeInfo (#17)
* Fix test failures and proper fix this time (#18)
* Fix test failures and proper fix this time
* reinstate ActiveIssueAttribute
* PR feedback and adjust couple of tests which don't set TypeInfoResolver
* fix IAsyncEnumerable tests
* Lock JsonSerializerOptions in JsonTypeInfo.EnsureConfigured()
Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
deeprobin pushed a commit that referenced this pull request Jul 3, 2022
E.g.,
Update LSRA "Allocating Registers" table description.
Dump nodes added during resolution, e.g.:
```
BB29 bottom (BB08->BB08): move V25 from STK to rdi (Critical)
N001 ( 1, 1) [001174] ----------z t1174 = LCL_VAR int V25 cse4 rdi REG rdi
```
Dump more data in the LSRA block sequence data:
```
-BB03( 16 )
-BB04( 4 )
+BB03 ( 16 ) critical-in critical-out
+BB04 ( 4 ) critical-out
```
When dumping various flow bitvectors, annotate the bitvectors better:
```
-BB25 in gen out
-0000000000000000
-0000000000000003 CSE #1.c
-0000000000000003 CSE #1.c
+BB25
+ in: 0000000000000000
+gen: 0000000000000003 CSE #1.c
+out: 0000000000000003 CSE #1.c
```
Dump hoisting bitvectors using the sorting number:
```
- USEDEF (5)={V04 V00 V01 V02 V03}
+ USEDEF (5)={V00 V01 V02 V03 V04}
```
Also, fix various typos and formatting.
deeprobin pushed a commit that referenced this pull request Sep 3, 2022
* WIP: add gRPC tests
* Fix AOT and trimming
* WIP
* Implement IncludeNetworkSecurityConfig
* Use IncludeNetworkSecurityConfig
* Fix gRPC test
* Avoid git checkout
* Remove unnecessary code
* WIP: start working on CI configuration
* Remove WinHttpHandler
* Fix problem with SSL
* Change server host
* Setup CI (#1)
* Get Docker container building & exported via test build
* Changes
* Add missing pfx certificate
* changes
* cleanup
Co-authored-by: Simon Rozsival <simon@rozsival.com>
* Use tls
* Update yml
* Revert changes to the mono Android sample app
* Bump android image version
* Bump image version
* Enable TLS
* Remove hardcoded package versions
* Update package versions
* Update package versions
* Rename pipeline
* Move interop tests website dependencies versions to Versions.props
* Add cred scan supression for the interop test server private key
* Fix licenses
* Remove dependencies
* Fix path to Versions.props
* Remove unnecessary dependency version
* Fix building docker image
* Change pfx password
Co-authored-by: Jo Shields <directhex@apebox.org>
deeprobin pushed a commit that referenced this pull request Dec 19, 2022
* switch to managed thread ID in Lock
* fattening the lock
* __declspec(selectany)
* few tweaks
* fairness
* more room for thread ids
* remove CurrentNativeThreadId
* couple fixes
* fix win-arm64 build
* win-arm64 build , another try
* Apply suggestions from code review
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* fix after renaming
* do not report successful spin if thread has waited
* keep extern and undo mangling of tls_CurrentThread in asm
* use SyncTable indexer in less perf-sensitive places.
* GetNewHashCode just delegate to shared random
* Apply suggestions from code review
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* unchecked const conversion
* some refactoring comments and typos
* min number of spins in the backoff
* moved CurrentManagedThreadIdUnchecked to ManagedThreadId
* Use `-1` to report success and allow using element #1 in the SyncTable
* use threadstatic for managed thread ID
* check before calling RhGetProcessCpuCount
* use 0 as default thread ID
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
SamMonoRT pushed a commit that referenced this pull request Jun 15, 2026
…128163)
> [!NOTE]
> This PR was authored with assistance from GitHub Copilot.
Fixesdotnet#128044.
## Problem
createdump SIGSEGVs on Linux when generating a Heap-type minidump for a
process running interpreted code. The crash reproduces locally with the
`InterpreterStack` DumpTests debuggee and matches the CI failure that
prompted `<DumpTypes>Full</DumpTypes>` to be added as a temporary
workaround.
The faulting backtrace is:
```
#0 Thread::IsAddressInStack threads.cpp:6741
#1 Thread::EnumMemoryRegionsWorker threads.cpp:6909 (calls IsAddressInStack(currentSP))
#2 Thread::EnumMemoryRegions threads.cpp
#3 ThreadStore::EnumMemoryRegions
#4 ClrDataAccess::EnumMemDumpAllThreadsStack
#5 ClrDataAccess::EnumMemoryRegionsWorkerHeap (HEAP2-only path)
```
## Root cause
`Thread::m_pInterpThreadContext` was declared as a raw
`InterpThreadContext *`. In non-DAC code that's a normal host pointer,
but in
DAC mode the field's value is a target-process address. When
`IsAddressInStack` (a DAC-callable helper) dereferenced
`m_pInterpThreadContext->pStackStart` it read from a target-process
address
as if it were a host address, which faults inside createdump.
## Fix
Change the field type to `PTR_InterpThreadContext` (DPTR), matching the
treatment of other Thread fields like `m_pFrame`. In non-DAC builds
`DPTR(T)` is just `T*`, so there is no overhead or behavior change. In
DAC
builds the read goes through `__DPtr<T>` and marshals correctly from the
target.
Also remove the `<DumpTypes>Full</DumpTypes>` workaround on the
`InterpreterStack` DumpTests debuggee so the Heap path that originally
failed is exercised again.
## Validation
Locally reproduced the original SIGSEGV on Linux x64 with the auto-dump
mechanism (`DOTNET_DbgMiniDumpType=2` + `DOTNET_Interpreter=MethodA`)
running the `InterpreterStack` debuggee. With this fix applied,
createdump
produces a complete Heap dump (~74 MB) instead of crashing.
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
SamMonoRT pushed a commit that referenced this pull request Jun 15, 2026
An Android production app reported a native abort while building an
X.509 chain on arm64. The available tombstone snippet showed the process
aborting in `AndroidCryptoNative_X509ChainBuild` from `pal_x509chain.c`,
with the native guard reporting that parameter `ctx` was not a valid
pointer. The report did not include a repro or full tombstone, but the
observed failure mode means managed code reached the native build entry
point with a null `X509ChainContext*`.
```
Thread
/__w/1/s/src/native/libs/System.Security.Cryptography.Native.Android/pal_x509chain.c:113 (AndroidCryptoNative_X509ChainBuild): Parameter 'ctx' must be a valid pointer
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
pid: 0, tid: 31609 >>> com.app.name <<<
backtrace:
#00 pc 0x000000000002232c /system/lib64/libc.so (abort+116)
#1 pc 0x0000000000021fe8 [removed]-KwPZdoEumri00C7kBm3pQw==/lib/arm64/libSystem.Security.Cryptography.Native.Android.so
#2 pc 0x00000000000220b0 [removed]-KwPZdoEumri00C7kBm3pQw==/lib/arm64/libSystem.Security.Cryptography.Native.Android.so (AndroidCryptoNative_X509ChainBuild+88)
#3 pc 0x000000000000cfcc
```
`X509ChainContext` is created by
`AndroidCryptoNative_X509ChainCreateContext`. That initialization can
fail if Android certificate store setup or PKIX parameter construction
throws, or if required JNI global references cannot be created.
Previously, the managed Android chain path stored the returned
`SafeHandle` without checking whether context creation failed, so a
later build could pass a null native context to
`AndroidCryptoNative_X509ChainBuild` and terminate the app process.
This change makes context creation fail gracefully:
- The native create path checks Java exceptions around object creation
and method calls more consistently.
- Partial native contexts are destroyed if global-reference creation
fails.
- The Android interop wrapper checks the returned chain context
immediately, including a null safe-handle return, and throws
`CryptographicException` if initialization failed.
No regression test is included because the reliable failure modes depend
on Android platform/provider state or artificial fault injection, and a
test hook would be fragile and not representative.
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Kevin Jones <kevin@vcsjones.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@deeprobin@kasperk81