<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;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.EmailStyle19
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.EmailStyle20
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.EmailStyle22
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@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="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hi Martin,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">ok, you are the author – so I won’t insist. <span style="font-family:"Segoe UI Emoji",sans-serif">
😊</span><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Best regards<o:p></o:p></p>
<p class="MsoNormal">Christoph<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></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>From:</b> Doerr, Martin <martin.doerr@sap.com> <br>
<b>Sent:</b> Freitag, 6. Dezember 2019 12:22<br>
<b>To:</b> Langer, Christoph <christoph.langer@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>; Thomas Stüfe <thomas.stuefe@gmail.com><br>
<b>Subject:</b> RE: RFR(S): 8220348: [ntintel] asserts about copying unalinged array<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="DE">Hi Christoph,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE"><o:p> </o:p></span></p>
<p class="MsoNormal">that would work, but I don’t want to pollute this file with compiler specific defines. In addition, I don’t like introducing a macro which works on some platforms and does nothing on other ones (which is the case for hotspot’s ATTRIBUTE_ALIGNED).<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Because Windows 32 bit is the only affected platform, I prefer not to touch other ones. Are you ok with webrev.00 as it is?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Best regards,<o:p></o:p></p>
<p class="MsoNormal">Martin<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></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>From:</b> Langer, Christoph <<a href="mailto:christoph.langer@sap.com">christoph.langer@sap.com</a>>
<br>
<b>Sent:</b> Donnerstag, 5. Dezember 2019 12:16<br>
<b>To:</b> Doerr, Martin <<a href="mailto:martin.doerr@sap.com">martin.doerr@sap.com</a>><br>
<b>Cc:</b> <a href="mailto:core-libs-dev@openjdk.java.net">core-libs-dev@openjdk.java.net</a>; security-dev <<a href="mailto:security-dev@openjdk.java.net">security-dev@openjdk.java.net</a>>; Lindenmaier, Goetz <<a href="mailto:goetz.lindenmaier@sap.com">goetz.lindenmaier@sap.com</a>>;
Thomas Stüfe <<a href="mailto:thomas.stuefe@gmail.com">thomas.stuefe@gmail.com</a>><br>
<b>Subject:</b> RE: RFR(S): 8220348: [ntintel] asserts about copying unalinged array<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><span lang="DE"><o:p> </o:p></span></p>
<p class="MsoNormal">Hi Martin,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I can see that both places already include headers from src/java.base/share/native/libjava/. I suggest adding the define in jni_util.h. WindowsPreferences.c already includes it.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Best regards<o:p></o:p></p>
<p class="MsoNormal">Christoph<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b>From:</b> Doerr, Martin <<a href="mailto:martin.doerr@sap.com">martin.doerr@sap.com</a>>
<br>
<b>Sent:</b> Donnerstag, 5. Dezember 2019 12:00<br>
<b>To:</b> Thomas Stüfe <<a href="mailto:thomas.stuefe@gmail.com">thomas.stuefe@gmail.com</a>>; Langer, Christoph <<a href="mailto:christoph.langer@sap.com">christoph.langer@sap.com</a>><br>
<b>Cc:</b> <a href="mailto:core-libs-dev@openjdk.java.net">core-libs-dev@openjdk.java.net</a>; security-dev <<a href="mailto:security-dev@openjdk.java.net">security-dev@openjdk.java.net</a>>; Lindenmaier, Goetz <<a href="mailto:goetz.lindenmaier@sap.com">goetz.lindenmaier@sap.com</a>><br>
<b>Subject:</b> RE: RFR(S): 8220348: [ntintel] asserts about copying unalinged array<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Hi Thomas and Christoph,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">thanks for the reviews.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Other code in java.security.jgss also uses these #defined checks:<o:p></o:p></p>
<p class="MsoNormal">src/java.security.jgss/share/native/libj2gss/gssapi.h:#if defined (_WIN32) && defined (_MSC_VER)<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I’d like to have it consistent with that.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">@Christoph: I think having 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></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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></p>
<p class="MsoNormal">(AFAIK, GCC uses -malign-double by default on 32 bit which should do the job for jlongs, too:<o:p></o:p></p>
<p class="MsoNormal"><a href="https://gcc.gnu.org/onlinedocs/gcc-4.5.3/gcc/i386-and-x86_002d64-Options.html">https://gcc.gnu.org/onlinedocs/gcc-4.5.3/gcc/i386-and-x86_002d64-Options.html</a>)<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Best regards,<o:p></o:p></p>
<p class="MsoNormal">Martin<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b>From:</b> Thomas Stüfe <<a href="mailto:thomas.stuefe@gmail.com">thomas.stuefe@gmail.com</a>>
<br>
<b>Sent:</b> Mittwoch, 4. Dezember 2019 17:56<br>
<b>To:</b> Doerr, Martin <<a href="mailto:martin.doerr@sap.com">martin.doerr@sap.com</a>><br>
<b>Cc:</b> <a href="mailto:core-libs-dev@openjdk.java.net">core-libs-dev@openjdk.java.net</a>; security-dev <<a href="mailto:security-dev@openjdk.java.net">security-dev@openjdk.java.net</a>>; Lindenmaier, Goetz <<a href="mailto:goetz.lindenmaier@sap.com">goetz.lindenmaier@sap.com</a>><br>
<b>Subject:</b> Re: RFR(S): 8220348: [ntintel] asserts about copying unalinged array<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Hi Martin,<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">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></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Cheers, Thomas<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Mon, Dec 2, 2019 at 4:14 PM Doerr, Martin <<span lang="DE"><a href="mailto:martin.doerr@sap.com"><span lang="EN-US">martin.doerr@sap.com</span></a></span>> wrote:<o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">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 lang="DE"><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><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 lang="DE"><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><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 lang="DE">Best regards,<br>
Martin<o:p></o:p></span></p>
</div>
</div>
</div>
</body>
</html>