Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upSome more changes and cleanup to reduce the startup time #8396
+108
−114
Conversation
daxian-dbw
added some commits
Dec 4, 2018
daxian-dbw
requested review from
TravisEz13,
adityapatwardhan,
PaulHigin and
iSazonov
Dec 4, 2018
daxian-dbw
requested review from
anmenaga and
BrucePay
as
code owners
Dec 4, 2018
daxian-dbw
force-pushed the
daxian-dbw:debugsyspolicy
branch
from
9f718e0
to
d32458e
Dec 4, 2018
daxian-dbw
self-assigned this
Dec 4, 2018
This comment has been minimized.
This comment has been minimized.
Currently runtime has |
iSazonov
approved these changes
Dec 5, 2018
PaulHigin
requested changes
Dec 5, 2018
This comment has been minimized.
This comment has been minimized.
@iSazonov I don't think |
daxian-dbw
merged commit c1e1716
into
PowerShell:master
Dec 6, 2018
6 checks passed
CodeFactor
24 issues fixed. 23 issues found.
Details
PowerShell-CI-linux
#PR-8396-20181205.01 succeeded
Details
PowerShell-CI-macos
#PR-8396-20181205.01 succeeded
Details
PowerShell-CI-spelling
#PR-8396-20181205.01 succeeded
Details
PowerShell-CI-windows
#PR-8396-20181205.01 succeeded
Details
license/cla
All CLA requirements met.
Details
daxian-dbw
deleted the
daxian-dbw:debugsyspolicy
branch
Dec 6, 2018
daxian-dbw
added
CL-Engine
CL-CodeCleanup
and removed
CL-Engine
labels
Dec 6, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
daxian-dbw commentedDec 4, 2018
•
edited
PR Summary
This PR includes some changes and cleanups that will reduce the startup time. Each commit is self-contained, and the commit message serves as a summary of the changes in the commit.
s_wasSystemPolicyDebugPolicytos_allowDebugOverridePolicyto make it less confusing. Also slightly refactorHelperSecurity.psm1andConstrainedLanguageDebugger.Tests.ps1to remove unneeded code. There is no functional change in this commit.IsInbox, as PowerShell Core won't be shipped in-box with Windows in the foreseeable feature. Even if we do in future, we won't be needing it because Windows PowerShell will probably be gone by that time.$env:PSModulePath, and it will in turn causeIsNanoServerandIsIoTto be evaluated, all of which will trigger access to the Registry. By removingIsInbox, that can be all avoided.BindRunspaceretrieves all available commands from the session state, but for the most common scenario of creating/opening a Runspace, the retrieved commands are never get used afterwards. The method is updated to avoid retrieving all commands unless it's necessary.ProcessXXXmethod, so that we can avoid some unneeded method calls.IsSafeValueVisitorevery time whenIsScriptBlockInFactASafeHashtableruns.IsSafeValueVisitor.IsAstSafecreates an instance ofIsSafeValueVisitorevery time it runs. Given thatIsScriptBlockInFactASafeHashtablegets called relatively frequently inPerformSecurityCheck, this will result in some GC pressure as it will generate transient objects. This is updated to reuse aIsSafeValueVisitorsingleton with the defaultSafeValueContext.Defaultand_safeValueContextfields are madereadonly, so it cannot be changed by reflection._visitCountis changed touinttype, so an attacker cannot change the value of it to a negative number in order to practically increase the max visit count limit.PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:to the beginning of the title and remove the prefix when the PR is ready.[feature]if the change is significant or affects feature tests