Skip to content

Work around start-up crash in Adobe Reader protected mode #13413

Merged
michaelDCurran merged 8 commits into
masterfrom
fixAdobeCrashes
Mar 3, 2022
Merged

Work around start-up crash in Adobe Reader protected mode #13413
michaelDCurran merged 8 commits into
masterfrom
fixAdobeCrashes

Conversation

@michaelDCurran

Copy link
Copy Markdown
Member

Link to issue number:

Fixes #11568
Partial fix for #12920

Summary of the issue:

Recent versions of Adobe Reader introduced a Protected Mode, where by the Adobe Acrobat process has less privileges and is sandboxed. This ensures that insecure PDFs do not have a chance to affect the rest of the Operating System.
By default Adobe Reader is configured to enter its Protected mode on start-up, and to set the 'isAppContainer' attribute on its process token.
There seems to be a bug however, either in Adobe Reader, the Windows OS, or NVDA (NV access and Adobe cannot be sure) that causes the Adobe Reader process to become unstable when NVDA tires to register IAccessible2. Specifically, the call to CoGetPSClsid seems to start making things unstable. The further call to CoRegisterPSClsid fails, and then eventually the process completely crashes randomly in places such as TSF initialization.
The upshot is that If Adobe Reader is started when NVDA is running, many errors are written to NVDA's log, and Adobe Reader closes straight away.

Description of how this pull request fixes the issue:

NVDAHelper's IAccessible2 registration code now checks if the process token has the 'IsAppContainer' attribute, and of so refuses to install IAccessible2 support.
Note that Adobe Reader itself does not require IAccessible2 to function.
Also, the 'IsAppContainer' is only set on very heavily sandboxed sitations, and is not the same as the app container that is used for Windows Desktop Bridge apps. Thus, refusing to install IAccessible2 into processes with the 'IsAppContainer' attribute has no other known side affects.

Testing strategy:

  • Installed Adobe Reader 32 bit.
  • With NVDA running, launched Adobe Reader 32 bit. Ensured that it did not close / crash.
  • Ensured that errors were not written to the NVDA log.
  • Repeated all the previous steps but this time with Adobe Reader 64 bit.
  • Ensured that IAccessible2 support was still being registered in other processes E.g. Firefox, by compiling NvDAHelper with nvdaHelperLogLevel set to debug and looking at the log for the appropriate registration messages.

Known issues with pull request:

Note that this pr does not address the crashes in Adobe Reader 64 bit when trying to read a PDF. This is a very separate issue.

Change log entries:

New features
Changes
Bug fixes

For Developers

Code Review Checklist:

  • Pull Request description:
    • description is up to date
    • change log entries
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • API is compatible with existing add-ons.
  • Documentation:
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English

@michaelDCurran michaelDCurran requested a review from a team as a code owner March 2, 2022 05:56
@michaelDCurran michaelDCurran added this to the 2022.1 milestone Mar 2, 2022
@AppVeyorBot

This comment was marked as outdated.

@feerrenrut feerrenrut 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.

Generally this looks like big improvement!

Comment thread nvdaHelper/remote/IA2Support.cpp Outdated
Comment thread nvdaHelper/remote/IA2Support.cpp
Comment thread nvdaHelper/remote/IA2Support.cpp Outdated
Comment thread nvdaHelper/remote/IA2Support.cpp
@feerrenrut

Copy link
Copy Markdown
Contributor

I've kicked off the build again due to the intermittent chrome test failure.

@AppVeyorBot

This comment was marked as outdated.

@Brian1Gaff

This comment was marked as off-topic.

Comment thread nvdaHelper/remote/IA2Support.cpp
@michaelDCurran

Copy link
Copy Markdown
Member Author

@feerrenrut I did not quite follow your request about making a helper function that returns std::optional. Note that kernel32Handle has to remain valid from when looking up the function, until after actually executing it. So really that is the entirety of isSuspendableProcess. I could rename the function to hasApplicationUserModelID? But that is all that whole function does.

@feerrenrut

feerrenrut commented Mar 2, 2022

Copy link
Copy Markdown
Contributor

Note that kernel32Handle has to remain valid from when looking up the function, until after actually executing it.

Ah, I didn't realize that, let me take another look at it.

Comment thread nvdaHelper/remote/IA2Support.cpp Outdated
Comment thread nvdaHelper/remote/IA2Support.cpp Outdated
michaelDCurran and others added 2 commits March 2, 2022 20:10
Co-authored-by: Łukasz Golonka <lukasz.golonka@mailbox.org>
@AppVeyorBot

This comment was marked as outdated.

@feerrenrut feerrenrut 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.

I've kicked off the build again. The code and PR description look good.

@michaelDCurran michaelDCurran merged commit 2d2a269 into master Mar 3, 2022
@michaelDCurran michaelDCurran deleted the fixAdobeCrashes branch March 3, 2022 12:49
Sign up for free to 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.

alpha builds: many error messages in the log when opening Adobe Reader

5 participants