Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

[x86/Linux] Port SWCB_GetExecutionState#9436

Merged
janvorli merged 1 commit into
dotnet:masterfrom
parjong:fix/x86_SWCB_GetExecutionState
Feb 9, 2017
Merged

[x86/Linux] Port SWCB_GetExecutionState#9436
janvorli merged 1 commit into
dotnet:masterfrom
parjong:fix/x86_SWCB_GetExecutionState

Conversation

@parjong
Copy link
Copy Markdown

@parjong parjong commented Feb 9, 2017

SWCB_GetExecutionState currently updates m_ppvRetAddrPtr using PCTAddr.

Unfortunately, however, there is no guarantee that PCTAddr is in actual stack range (for x86/Linux), which results in #9435.

This commit use Caller SP based routine (which is used for other architectures) for x86/Linux in order to fix #9435.

@parjong
Copy link
Copy Markdown
Author

parjong commented Feb 9, 2017

\CC @seanshpark @wateret

@parjong
Copy link
Copy Markdown
Author

parjong commented Feb 9, 2017

@dotnet-bot test Ubuntu x64 Checked Build and Test please

Comment thread src/vm/eetwain.cpp Outdated
_ASSERTE( pRD->IsCallerContextValid );
}

size_t EECodeManager::GetCallerSpUnsafe( PREGDISPLAY pRD )
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think it is worth extracting this simple expression into a function, especially when it is obvious what it does and it is used at two places only. Could you please revert this part of the change? Otherwise LGTM.

Comment thread src/vm/threadsuspend.cpp
pES->m_ppvRetAddrPtr = (void **) ((size_t)GetSP(pRDT->pCallerContext) - sizeof(void*));
#endif
#elif defined(_TARGET_X86_) || defined(_TARGET_AMD64_)
pES->m_ppvRetAddrPtr = (void **) (EECodeManager::GetCallerSp(pRDT) - sizeof(void*));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@parjong I meant just use the original form without calling the EECodeManager method. Is there a problem with it?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

As we discussed in #9384, it is possible that caller's esp is not same as Caller-SP. I would like to express that we need Caller-SP here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@parjong I am sorry, I have not realized that it was the reason for introducing the unsafe method before. But that means that this change depends on the CallerSP change and so it should not be merged before the other one, right?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@janvorli This change requires Caller SP change to be correct, but it seems that this change could be merged first as the current implementation (based on PCTAddr) already has an issue.

Copy link
Copy Markdown
Member

@janvorli janvorli left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@janvorli janvorli merged commit 2ecadf5 into dotnet:master Feb 9, 2017
@parjong parjong deleted the fix/x86_SWCB_GetExecutionState branch February 9, 2017 22:54
jorive pushed a commit to guhuro/coreclr that referenced this pull request May 4, 2017
@karelz karelz modified the milestone: 2.0.0 Aug 28, 2017
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[x86/Linux] Random GC.Scenarios.BinTree.thdtree test failure

4 participants