<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 19 Aug 2022, at 4:52 pm, Christophe Leroy <<a href="mailto:christophe.leroy@csgroup.eu" class="">christophe.leroy@csgroup.eu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta charset="UTF-8" class=""><br style="caret-color: rgb(0, 0, 0); font-family: IBMPlexMono; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: IBMPlexMono; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: IBMPlexMono; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Le 19/08/2022 à 05:38, Rohan McLure a écrit :</span><br style="caret-color: rgb(0, 0, 0); font-family: IBMPlexMono; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" style="font-family: IBMPlexMono; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">Clear user state in gprs (assign to zero) to reduce the influence of user<br class="">registers on speculation within kernel syscall handlers. Clears occur<br class="">at the very beginning of the sc and scv 0 interrupt handlers, with<br class="">restores occurring following the execution of the syscall handler.<br class=""><br class="">Signed-off-by: Rohan McLure <<a href="mailto:rmclure@linux.ibm.com" class="">rmclure@linux.ibm.com</a>><br class="">---<br class="">V1 -> V2: Update summary<br class="">V2 -> V3: Remove erroneous summary paragraph on syscall_exit_prepare<br class="">---<br class=""> arch/powerpc/kernel/interrupt_64.S | 22 ++++++++++++++++++----<br class=""> 1 file changed, 18 insertions(+), 4 deletions(-)<br class=""><br class="">diff --git a/arch/powerpc/kernel/interrupt_64.S b/arch/powerpc/kernel/interrupt_64.S<br class="">index 0178aeba3820..d9625113c7a5 100644<br class="">--- a/arch/powerpc/kernel/interrupt_64.S<br class="">+++ b/arch/powerpc/kernel/interrupt_64.S<br class="">@@ -70,7 +70,7 @@ _ASM_NOKPROBE_SYMBOL(system_call_vectored_\name)<br class=""> <span class="Apple-tab-span" style="white-space: pre;">  </span>ld<span class="Apple-tab-span" style="white-space: pre;">        </span>r2,PACATOC(r13)<br class=""> <span class="Apple-tab-span" style="white-space: pre;">        </span>mfcr<span class="Apple-tab-span" style="white-space: pre;">      </span>r12<br class=""> <span class="Apple-tab-span" style="white-space: pre;">    </span>li<span class="Apple-tab-span" style="white-space: pre;">        </span>r11,0<br class="">-<span class="Apple-tab-span" style="white-space: pre;">       </span>/* Can we avoid saving r3-r8 in common case? */<br class="">+<span class="Apple-tab-span" style="white-space: pre;">     </span>/* Save syscall parameters in r3-r8 */<br class=""> <span class="Apple-tab-span" style="white-space: pre;"> </span>std<span class="Apple-tab-span" style="white-space: pre;">       </span>r3,GPR3(r1)<br class=""> <span class="Apple-tab-span" style="white-space: pre;">    </span>std<span class="Apple-tab-span" style="white-space: pre;">       </span>r4,GPR4(r1)<br class=""> <span class="Apple-tab-span" style="white-space: pre;">    </span>std<span class="Apple-tab-span" style="white-space: pre;">       </span>r5,GPR5(r1)<br class="">@@ -109,6 +109,13 @@ END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR)<br class=""> <span class="Apple-tab-span" style="white-space: pre;">    </span><span class="Apple-converted-space"> </span>* but this is the best we can do.<br class=""> <span class="Apple-tab-span" style="white-space: pre;">       </span><span class="Apple-converted-space"> </span>*/<br class=""><br class="">+<span class="Apple-tab-span" style="white-space: pre;">      </span>/*<br class="">+<span class="Apple-tab-span" style="white-space: pre;">  </span><span class="Apple-converted-space"> </span>* Zero user registers to prevent influencing speculative execution<br class="">+<span class="Apple-tab-span" style="white-space: pre;">   </span><span class="Apple-converted-space"> </span>* state of kernel code.<br class="">+<span class="Apple-tab-span" style="white-space: pre;">      </span><span class="Apple-converted-space"> </span>*/<br class="">+<span class="Apple-tab-span" style="white-space: pre;">   </span>NULLIFY_GPRS(5, 12)<br class=""></blockquote><br style="caret-color: rgb(0, 0, 0); font-family: IBMPlexMono; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: IBMPlexMono; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Macro name has changed.</span><br style="caret-color: rgb(0, 0, 0); font-family: IBMPlexMono; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: IBMPlexMono; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" style="font-family: IBMPlexMono; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">+<span class="Apple-tab-span" style="white-space: pre;">       </span>NULLIFY_NVGPRS()<br class=""></blockquote><br style="caret-color: rgb(0, 0, 0); font-family: IBMPlexMono; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: IBMPlexMono; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Why clearing non volatile GPRs ? They are supposed to be callee saved so<span class="Apple-converted-space"> </span></span><br style="caret-color: rgb(0, 0, 0); font-family: IBMPlexMono; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: IBMPlexMono; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">I can't see how they could be used for speculation. Do you have any<span class="Apple-converted-space"> </span></span><br style="caret-color: rgb(0, 0, 0); font-family: IBMPlexMono; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: IBMPlexMono; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">exemple ?</span><br style="caret-color: rgb(0, 0, 0); font-family: IBMPlexMono; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: IBMPlexMono; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" style="font-family: IBMPlexMono; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">+<br class=""> <span class="Apple-tab-span" style="white-space: pre;">    </span>/* Calling convention has r3 = orig r0, r4 = regs */<br class=""> <span class="Apple-tab-span" style="white-space: pre;">   </span>mr<span class="Apple-tab-span" style="white-space: pre;">        </span>r3,r0<br class=""> <span class="Apple-tab-span" style="white-space: pre;">  </span>bl<span class="Apple-tab-span" style="white-space: pre;">        </span>system_call_exception<br class="">@@ -139,6 +146,7 @@ BEGIN_FTR_SECTION<br class=""> <span class="Apple-tab-span" style="white-space: pre;">        </span>HMT_MEDIUM_LOW<br class=""> END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR)<br class=""><br class="">+<span class="Apple-tab-span" style="white-space: pre;">        </span>REST_NVGPRS(r1)<br class=""></blockquote><br style="caret-color: rgb(0, 0, 0); font-family: IBMPlexMono; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: IBMPlexMono; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: IBMPlexMono; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" style="font-family: IBMPlexMono; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""> <span class="Apple-tab-span" style="white-space: pre;">     </span>cmpdi<span class="Apple-tab-span" style="white-space: pre;">     </span>r3,0<br class=""> <span class="Apple-tab-span" style="white-space: pre;">   </span>bne<span class="Apple-tab-span" style="white-space: pre;">       </span>.Lsyscall_vectored_\name\()_restore_regs<br class=""><br class="">@@ -181,7 +189,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR)<br class=""> <span class="Apple-tab-span" style="white-space: pre;">   </span>ld<span class="Apple-tab-span" style="white-space: pre;">        </span>r4,_LINK(r1)<br class=""> <span class="Apple-tab-span" style="white-space: pre;">   </span>ld<span class="Apple-tab-span" style="white-space: pre;">        </span>r5,_XER(r1)<br class=""><br class="">-<span class="Apple-tab-span" style="white-space: pre;">    </span>REST_NVGPRS(r1)<br class=""> <span class="Apple-tab-span" style="white-space: pre;">        </span>ld<span class="Apple-tab-span" style="white-space: pre;">        </span>r0,GPR0(r1)<br class=""> <span class="Apple-tab-span" style="white-space: pre;">    </span>mtcr<span class="Apple-tab-span" style="white-space: pre;">      </span>r2<br class=""> <span class="Apple-tab-span" style="white-space: pre;">     </span>mtctr<span class="Apple-tab-span" style="white-space: pre;">     </span>r3<br class="">@@ -249,7 +256,7 @@ END_BTB_FLUSH_SECTION<br class=""> <span class="Apple-tab-span" style="white-space: pre;">       </span>ld<span class="Apple-tab-span" style="white-space: pre;">        </span>r2,PACATOC(r13)<br class=""> <span class="Apple-tab-span" style="white-space: pre;">        </span>mfcr<span class="Apple-tab-span" style="white-space: pre;">      </span>r12<br class=""> <span class="Apple-tab-span" style="white-space: pre;">    </span>li<span class="Apple-tab-span" style="white-space: pre;">        </span>r11,0<br class="">-<span class="Apple-tab-span" style="white-space: pre;">       </span>/* Can we avoid saving r3-r8 in common case? */<br class="">+<span class="Apple-tab-span" style="white-space: pre;">     </span>/* Save syscall parameters in r3-r8 */<br class=""> <span class="Apple-tab-span" style="white-space: pre;"> </span>std<span class="Apple-tab-span" style="white-space: pre;">       </span>r3,GPR3(r1)<br class=""> <span class="Apple-tab-span" style="white-space: pre;">    </span>std<span class="Apple-tab-span" style="white-space: pre;">       </span>r4,GPR4(r1)<br class=""> <span class="Apple-tab-span" style="white-space: pre;">    </span>std<span class="Apple-tab-span" style="white-space: pre;">       </span>r5,GPR5(r1)<br class="">@@ -300,6 +307,13 @@ END_BTB_FLUSH_SECTION<br class=""> <span class="Apple-tab-span" style="white-space: pre;">     </span>wrteei<span class="Apple-tab-span" style="white-space: pre;">    </span>1<br class=""> #endif<br class=""><br class="">+<span class="Apple-tab-span" style="white-space: pre;">     </span>/*<br class="">+<span class="Apple-tab-span" style="white-space: pre;">  </span><span class="Apple-converted-space"> </span>* Zero user registers to prevent influencing speculative execution<br class="">+<span class="Apple-tab-span" style="white-space: pre;">   </span><span class="Apple-converted-space"> </span>* state of kernel code.<br class="">+<span class="Apple-tab-span" style="white-space: pre;">      </span><span class="Apple-converted-space"> </span>*/<br class="">+<span class="Apple-tab-span" style="white-space: pre;">   </span>NULLIFY_GPRS(5, 12)<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span>NULLIFY_NVGPRS()<br class="">+<br class=""></blockquote><br style="caret-color: rgb(0, 0, 0); font-family: IBMPlexMono; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: IBMPlexMono; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Name has changed.</span><br style="caret-color: rgb(0, 0, 0); font-family: IBMPlexMono; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: IBMPlexMono; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" style="font-family: IBMPlexMono; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""> <span class="Apple-tab-span" style="white-space: pre;">     </span>/* Calling convention has r3 = orig r0, r4 = regs */<br class=""> <span class="Apple-tab-span" style="white-space: pre;">   </span>mr<span class="Apple-tab-span" style="white-space: pre;">        </span>r3,r0<br class=""> <span class="Apple-tab-span" style="white-space: pre;">  </span>bl<span class="Apple-tab-span" style="white-space: pre;">        </span>system_call_exception<br class="">@@ -342,6 +356,7 @@ BEGIN_FTR_SECTION<br class=""> <span class="Apple-tab-span" style="white-space: pre;">        </span>stdcx.<span class="Apple-tab-span" style="white-space: pre;">    </span>r0,0,r1<span class="Apple-tab-span" style="white-space: pre;">   </span><span class="Apple-tab-span" style="white-space: pre;">  </span><span class="Apple-tab-span" style="white-space: pre;">  </span>/* to clear the reservation */<br class=""> END_FTR_SECTION_IFCLR(CPU_FTR_STCX_CHECKS_ADDRESS)<br class=""><br class="">+<span class="Apple-tab-span" style="white-space: pre;">    </span>REST_NVGPRS(r1)<br class=""></blockquote><br style="caret-color: rgb(0, 0, 0); font-family: IBMPlexMono; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: IBMPlexMono; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Same question.</span><br style="caret-color: rgb(0, 0, 0); font-family: IBMPlexMono; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: IBMPlexMono; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" style="font-family: IBMPlexMono; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""> <span class="Apple-tab-span" style="white-space: pre;">       </span>cmpdi<span class="Apple-tab-span" style="white-space: pre;">     </span>r3,0<br class=""> <span class="Apple-tab-span" style="white-space: pre;">   </span>bne<span class="Apple-tab-span" style="white-space: pre;">       </span>.Lsyscall_restore_regs<br class=""> <span class="Apple-tab-span" style="white-space: pre;"> </span>/* Zero volatile regs that may contain sensitive kernel data */<br class="">@@ -377,7 +392,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR)<br class=""> .Lsyscall_restore_regs:<br class=""> <span class="Apple-tab-span" style="white-space: pre;">       </span>ld<span class="Apple-tab-span" style="white-space: pre;">        </span>r3,_CTR(r1)<br class=""> <span class="Apple-tab-span" style="white-space: pre;">    </span>ld<span class="Apple-tab-span" style="white-space: pre;">        </span>r4,_XER(r1)<br class="">-<span class="Apple-tab-span" style="white-space: pre;"> </span>REST_NVGPRS(r1)<br class=""> <span class="Apple-tab-span" style="white-space: pre;">        </span>mtctr<span class="Apple-tab-span" style="white-space: pre;">     </span>r3<br class=""> <span class="Apple-tab-span" style="white-space: pre;">     </span>mtspr<span class="Apple-tab-span" style="white-space: pre;">     </span>SPRN_XER,r4<br class=""> <span class="Apple-tab-span" style="white-space: pre;">    </span>ld<span class="Apple-tab-span" style="white-space: pre;">        </span>r0,GPR0(r1)</blockquote></div></blockquote></div><br class=""><div class=""><br class=""></div><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><blockquote type="cite" style="font-family: monospace; font-size: 16px;" class="">Why clearing non volatile GPRs ? They are supposed to be callee saved so <br class="">I can't see how they could be used for speculation. Do you have any <br class="">exemple ?<br class=""></blockquote><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: monospace; font-size: 16px;" class=""><br class=""></div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: monospace; font-size: 16px;" class="">Even though non-volatiles will be callee-saved subject to ABI in the syscall handler prologue, it is still conceivable that a syscall handler will leave a register uninitialised on one branch outcome, assigning that register in the other.</div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: monospace; font-size: 16px;" class=""><br class=""></div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: monospace; font-size: 16px;" class="">On speculative processors, there remains the possibility for untaken branches to be executed microarchitecturally (by mistraining the branch predictor or otherwise),</div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: monospace; font-size: 16px;" class="">whereby the microarchitectural effects of the execution present a side-channel.</div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: monospace; font-size: 16px;" class=""><br class=""></div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: monospace; font-size: 16px;" class="">Such a hardening measure removes the burden for developers to prove that toolchains</div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: monospace; font-size: 16px;" class="">will never emit code with these properties in code reachable via a syscall. For what</div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: monospace; font-size: 16px;" class="">it’s worth, precedent already exists in arm64 and x86.</div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: monospace; font-size: 16px;" class=""><br class=""></div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: monospace; font-size: 16px;" class="">Links:</div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: monospace; font-size: 16px;" class=""><a href="https://lore.kernel.org/linux-arm-kernel/20180702110415.10465-13-mark.rutland@arm.com/" class="">https://lore.kernel.org/linux-arm-kernel/20180702110415.10465-13-mark.rutland@arm.com/</a></div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: monospace; font-size: 16px;" class=""><a href="https://lore.kernel.org/lkml/20180405095307.3730-8-linux@dominikbrodowski.net/" class="">https://lore.kernel.org/lkml/20180405095307.3730-8-linux@dominikbrodowski.net/</a></div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: monospace; font-size: 16px;" class=""><br class=""></div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: monospace; font-size: 16px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 14px;" class=""><span class="" style="font-family: IBMPlexMono; font-size: 16px; float: none; display: inline !important;">What is the link between this change and the description in the commit </span><br class="" style="font-family: IBMPlexMono; font-size: 16px;"><span class="" style="font-family: IBMPlexMono; font-size: 16px; float: none; display: inline !important;">message ?</span></blockquote><br class=""></div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: monospace; font-size: 16px;" class="">I’ll include a detail on why we must restore nvgprs in both cases in the commit message.</div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: monospace; font-size: 16px;" class="">Thanks for pointing that out.</div></div></div></body></html>