From 98abcbd3fb03051ff2fb85c01964859734cf7c26 Mon Sep 17 00:00:00 2001 From: masesdevelopers <94312179+masesdevelopers@users.noreply.github.com> Date: Mon, 23 Dec 2024 00:48:32 +0000 Subject: [PATCH] Update documentation after commit 4acb297 --- docs/articles/usage.html | 10 +++++++++- docs/articles/usageCLI.html | 6 ++++++ docs/articles/usageReflector.html | 15 ++++++++++++--- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/docs/articles/usage.html b/docs/articles/usage.html index fca939b77c..f27234218e 100644 --- a/docs/articles/usage.html +++ b/docs/articles/usage.html @@ -133,7 +133,7 @@

Intel CET and JNet

JNet uses an embedded JVM through JCOBridge, however JVM initialization is incompatible with CET because the code used to identify CPU try to modify the return address and this is considered from CET a violation: see this comment.

From .NET 9 preview 6, CET is enabled by default on supported hardware when the final stage produce an executable artifact, i.e. the csproj file contains <OutputType>Exe</OutputType>.

If the application, upon startup, fails with the error 0xc0000409 (subcode 0x30) it was compiled with CET enabled and it fails during JVM initialization.

-

To solve the issue there are three possible solutions:

+

To solve the issue there are four possible solutions:

  1. use a .NET version, e.g. 8, that does not enable CET by default
  2. Add the following snippet to disable CET on executable (templates available for JNet are ready made and solve this issue):
  3. @@ -151,6 +151,14 @@

    Intel CET and JNet

    instead of the classic:

    	MyApplication.exe
     
    +
      +
    1. If you want to run the classic application execute the following command in an elevated shell:
    2. +
    +
    	reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\MyApplication.exe" /v MitigationOptions /t REG_BINARY /d "0000000000000000000000000000002000" /f
    +
    +

    then run:

    +
    	MyApplication.exe
    +

    Basic example

    Below a basic example which demonstrates how to create a program based on JNet and some other features available like generics and exception handling. Within the program the comments try to explain how the code works.

    diff --git a/docs/articles/usageCLI.html b/docs/articles/usageCLI.html index 8a9bd1d394..c59fa09e68 100644 --- a/docs/articles/usageCLI.html +++ b/docs/articles/usageCLI.html @@ -103,6 +103,12 @@

    Usage

    jnet -i
     
    +
    +
    Important
    +

    If the previous command raises the error described in Intel CET and JNet, the only solution is to apply the following workaround (within an elevated shell) and disable CET:

    +
      reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\jnet.exe" /v MitigationOptions /t REG_BINARY /d "0000000000000000000000000000002000" /f
    +
    +
    diff --git a/docs/articles/usageReflector.html b/docs/articles/usageReflector.html index 7b43511b8c..a6162fa693 100644 --- a/docs/articles/usageReflector.html +++ b/docs/articles/usageReflector.html @@ -93,8 +93,14 @@

    Usage

    jnetreflector -OriginRootPath C:\\myJars -OriginJavadocUrl \"https://thehost/javadoc/\" -JavadocVersion 11 -DestinationRootPath C:\\ReflectionDestination
     
    +
    +
    Important
    +

    If the previous command raises the error described in Intel CET and JNet, the only solution is to apply the following workaround (within an elevated shell) and disable CET:

    +
      reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\jnetreflector.exe" /v MitigationOptions /t REG_BINARY /d "0000000000000000000000000000002000" /f
    +
    +

    Command switches available

    -

    jnr accepts the following command-line switch:

    +

    jnetreflector accepts the following command-line switch: