<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="DE" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">Hi Thomas and Christoph,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">thanks for the reviews.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">Other code in java.security.jgss also uses these #defined checks:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">src/java.security.jgss/share/native/libj2gss/gssapi.h:#if defined (_WIN32) && defined (_MSC_VER)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">I’d like to have it consistent with that.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">@Christoph: I think having
</span><span lang="EN-US">ATTRIBUTE_ALIGNED(x) would be nice. It could get defined easily for Visual Studio and GCC, but some other compilers may be more difficult. Note that this macro is only defined for a selected set of compilers in hotspot. If we wanted
to add it, where should we define it?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Windows 32 bit seems to be the only platform which is affected by the problem that jlongs on stack are not 8 byte aligned.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">(AFAIK, GCC uses -malign-double by default on 32 bit which should do the job for jlongs, too:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">https://gcc.gnu.org/onlinedocs/gcc-4.5.3/gcc/i386-and-x86_002d64-Options.html)</span><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">Best regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">Martin<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> Thomas Stüfe <thomas.stuefe@gmail.com>
<br>
<b>Sent:</b> Mittwoch, 4. Dezember 2019 17:56<br>
<b>To:</b> Doerr, Martin <martin.doerr@sap.com><br>
<b>Cc:</b> core-libs-dev@openjdk.java.net; security-dev <security-dev@openjdk.java.net>; Lindenmaier, Goetz <goetz.lindenmaier@sap.com><br>
<b>Subject:</b> Re: RFR(S): 8220348: [ntintel] asserts about copying unalinged array<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US">Hi Martin,<o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">this makes sense. This is the right way to force alignment. I do not like the platform code in the shared file but do not think this is a big deal.<br>
<br>
+#if defined (_WIN32) && defined (_MSC_VER)<br>
<br>
Why do you think we need _MSC_VER too? Is OpenJDK on Windows even buildable with anything other than VC++?<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">Cheers, Thomas<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US">On Mon, Dec 2, 2019 at 4:14 PM Doerr, Martin <</span><a href="mailto:martin.doerr@sap.com"><span lang="EN-US">martin.doerr@sap.com</span></a><span lang="EN-US">> wrote:<o:p></o:p></span></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt">
<p class="MsoNormal" style="margin-bottom:12.0pt"><span lang="EN-US">Hi,<br>
<br>
I'd like to propose a fix for an old issue on 32 bit Windows (also for an 11u backport):<br>
</span><a href="https://bugs.openjdk.java.net/browse/JDK-8220348" target="_blank"><span lang="EN-US">https://bugs.openjdk.java.net/browse/JDK-8220348</span></a><span lang="EN-US"><br>
<br>
Some jdk native methods use jni_SetLongArrayRegion with a stack allocated buffer.<br>
jni_SetLongArrayRegion uses Copy::conjoint_jlongs_atomic which requires jlongs to be 8 byte aligned (asserted).<br>
However, Windows 32 bit only uses 4 byte alignment for jlong arrays by default.<br>
I found such issues in the following files:<br>
src/java.prefs/windows/native/libprefs/WindowsPreferences.c<br>
src/java.security.jgss/share/native/libj2gss/GSSLibStub.c<br>
I suggest to use __declspec(align(8)) there.<br>
<br>
Webrev:<br>
</span><a href="http://cr.openjdk.java.net/~mdoerr/8220348_ntintel_stack_align/webrev.00/" target="_blank"><span lang="EN-US">http://cr.openjdk.java.net/~mdoerr/8220348_ntintel_stack_align/webrev.00/</span></a><span lang="EN-US"><br>
Please review.<br>
<br>
I think using 8 byte alignment is not a disadvantage for 64 bit.<br>
<br>
I guess there are still people interested in this platform with jdk14. Otherwise I could contribute it as 11u only fix.<br>
<br>
Is there a better way to force 8 byte alignment for jlongs or jlong arrays on stack?<br>
</span>Best regards,<br>
Martin<o:p></o:p></p>
</blockquote>
</div>
</div>
</div>
</body>
</html>