Skip to content

Commit

Permalink
Update documentation after commit 4acb297 (#586)
Browse files Browse the repository at this point in the history
Co-authored-by: masesdevelopers <[email protected]>
  • Loading branch information
github-actions[bot] and masesdevelopers authored Dec 23, 2024
1 parent 4acb297 commit e019ab5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
10 changes: 9 additions & 1 deletion docs/articles/usage.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ <h3 id="intel-cet-and-jnet">Intel CET and JNet</h3>
<p>JNet uses an embedded JVM through JCOBridge, however JVM initialization is incompatible with <a href="https://www.intel.com/content/www/us/en/developer/articles/technical/technical-look-control-flow-enforcement-technology.html">CET</a> because the code used to identify CPU try to modify the return address and this is considered from CET a violation: see <a href="https://github.com/masesgroup/JNet/issues/573#issuecomment-2544249107">this comment</a>.</p>
<p>From .NET 9 preview 6, <a href="https://learn.microsoft.com/en-us/dotnet/core/compatibility/interop/9.0/cet-support">CET is enabled by default on supported hardware</a> when the final stage produce an executable artifact, i.e. the csproj file contains <code>&lt;OutputType&gt;Exe&lt;/OutputType&gt;</code>.</p>
<p>If the application, upon startup, fails with the error 0xc0000409 (subcode 0x30) it was compiled with CET enabled and it fails during JVM initialization.</p>
<p>To solve the issue there are three possible solutions:</p>
<p>To solve the issue there are four possible solutions:</p>
<ol>
<li>use a .NET version, e.g. 8, that does not enable CET by default</li>
<li>Add the following snippet to disable CET on executable (templates available for JNet are ready made and solve this issue):</li>
Expand All @@ -151,6 +151,14 @@ <h3 id="intel-cet-and-jnet">Intel CET and JNet</h3>
<p>instead of the classic:</p>
<pre><code class="lang-sh"> MyApplication.exe
</code></pre>
<ol start="4">
<li>If you want to run the classic application execute the following command in an <strong>elevated shell</strong>:</li>
</ol>
<pre><code class="lang-sh"> reg add &quot;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\MyApplication.exe&quot; /v MitigationOptions /t REG_BINARY /d &quot;0000000000000000000000000000002000&quot; /f
</code></pre>
<p>then run:</p>
<pre><code class="lang-sh"> MyApplication.exe
</code></pre>
<h2 id="basic-example">Basic example</h2>
<p>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.</p>
Expand Down
6 changes: 6 additions & 0 deletions docs/articles/usageCLI.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ <h2 id="usage">Usage</h2>
</ul>
<pre><code class="lang-sh">jnet -i
</code></pre>
<div class="IMPORTANT">
<h5>Important</h5>
<p>If the previous command raises the error described in <a href="usage.html#intel-cet-and-jnet">Intel CET and JNet</a>, the only solution is to apply the following workaround (within an <strong>elevated shell</strong>) and disable CET:</p>
<pre><code class="lang-sh"> reg add &quot;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\jnet.exe&quot; /v MitigationOptions /t REG_BINARY /d &quot;0000000000000000000000000000002000&quot; /f
</code></pre>
</div>
<ul>
<li><strong>Docker image</strong></li>
</ul>
Expand Down
15 changes: 12 additions & 3 deletions docs/articles/usageReflector.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,14 @@ <h2 id="usage">Usage</h2>
</ul>
<pre><code class="lang-sh">jnetreflector -OriginRootPath C:\\myJars -OriginJavadocUrl \&quot;https://thehost/javadoc/\&quot; -JavadocVersion 11 -DestinationRootPath C:\\ReflectionDestination
</code></pre>
<div class="IMPORTANT">
<h5>Important</h5>
<p>If the previous command raises the error described in <a href="usage.html#intel-cet-and-jnet">Intel CET and JNet</a>, the only solution is to apply the following workaround (within an <strong>elevated shell</strong>) and disable CET:</p>
<pre><code class="lang-sh"> reg add &quot;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\jnetreflector.exe&quot; /v MitigationOptions /t REG_BINARY /d &quot;0000000000000000000000000000002000&quot; /f
</code></pre>
</div>
<h2 id="command-switches-available">Command switches available</h2>
<p><em>jnr</em> accepts the following command-line switch:</p>
<p><em>jnetreflector</em> accepts the following command-line switch:</p>
<ul>
<li><strong>ConfigurationFile</strong>: The path where is stored a JSON file containing the tool configuration properties; the JSON items shall be written using the same command-line property names</li>
<li><strong>CopyrightFile</strong>: The path where the tool will locate copyright info</li>
Expand Down Expand Up @@ -172,14 +178,17 @@ <h2 id="jnet-reflected-classes">JNet reflected classes</h2>
&quot;java.awt.peer&quot;
],
&quot;ClassesToBeListener&quot;: [
&quot;java.lang.Runnable&quot;,
&quot;javax.swing.Action&quot;,
&quot;javax.management.NotificationFilter&quot;
],
&quot;ClassesManuallyDeveloped&quot;: [
&quot;java.util.Comparator&quot;,
&quot;java.util.EventListener&quot;
],
&quot;ClassesToAvoid&quot;: [
&quot;java.lang.ProcessBuilder$Redirect$Type&quot;,
&quot;java.lang.Thread$UncaughtExceptionHandler&quot;,
&quot;java.util.Comparator&quot;,
&quot;java.util.EventListener&quot;,
&quot;java.util.stream.DoubleStream$Builder&quot;,
&quot;java.util.stream.IntStream$Builder&quot;,
&quot;java.util.stream.LongStream$Builder&quot;,
Expand Down

0 comments on commit e019ab5

Please sign in to comment.