Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes by GitHub action #586

Merged
merged 1 commit into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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