diff for duplicates of <1535752180.31230.4.camel@intel.com> diff --git a/a/content_digest b/N1/content_digest index b66c209..6097c80 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -28,7 +28,11 @@ Mike Kravetz <mike.kravetz@oracle.com> Nadav Amit <nadav.amit@gmail.com> Oleg Nesterov <oleg@redhat.com> - " Pavel Machek <pavel@ucw.cz>\0" + Pavel Machek <pavel@ucw.cz> + Peter Zijlstra <peterz@infradead.org> + Ravi V. Shankar <ravi.v.shankar@intel.com> + Shanbhogue + " Vedvyas <vedvyas.shanbhogue@intel.com>\0" "\00:1\0" "b\0" "On Thu, 2018-08-30 at 09:22 -0700, Yu-cheng Yu wrote:\n" @@ -115,4 +119,4 @@ "\treturn -1;\n" } -b7517239d06aa30caff223d345eb026f22bb632b7e6456e4889ba9b9fdc9d45d +f537d77d8294e6ee7f99b462cea60cfccda52c074fee78d6e97f46f3337a4297
diff --git a/a/1.txt b/N2/1.txt index 67f31a1..142e625 100644 --- a/a/1.txt +++ b/N2/1.txt @@ -12,12 +12,12 @@ On Thu, 2018-08-30 at 09:22 -0700, Yu-cheng Yu wrote: > > > > > > > > > > > > WRUSS is a new kernel-mode instruction but writes directly -> > > > to user shadow stack memory. This is used to construct +> > > > to user shadow stack memory.A A This is used to construct > > > > a return address on the shadow stack for the signal > > > > handler. > > > > > > > > This instruction can fault if the user shadow stack is -> > > > invalid shadow stack memory. In that case, the kernel does +> > > > invalid shadow stack memory.A A In that case, the kernel does > > > > fixup. > > > > > > > > Signed-off-by: Yu-cheng Yu <yu-cheng.yu@intel.com> @@ -27,16 +27,16 @@ On Thu, 2018-08-30 at 09:22 -0700, Yu-cheng Yu wrote: > > > > +static inline int write_user_shstk_64(unsigned long addr, > > > > unsigned long val) > > > > +{ -> > > > + int err = 0; +> > > > +A A A A A A A int err = 0; > > > > + -> > > > + asm volatile("1: wrussq %1, (%0)\n" -> > > > + "2:\n" -> > > > + _ASM_EXTABLE_HANDLE(1b, 2b, +> > > > +A A A A A A A asm volatile("1: wrussq %1, (%0)\n" +> > > > +A A A A A A A A A A A A A A A A A A A A "2:\n" +> > > > +A A A A A A A A A A A A A A A A A A A A _ASM_EXTABLE_HANDLE(1b, 2b, > > > > ex_handler_wruss) -> > > > + : -> > > > + : "r" (addr), "r" (val)); +> > > > +A A A A A A A A A A A A A A A A A A A A : +> > > > +A A A A A A A A A A A A A A A A A A A A : "r" (addr), "r" (val)); > > > > + -> > > > + return err; +> > > > +A A A A A A A return err; > > > > +} > > > What's up with "err"? You set it to zero, and then you return > > > it, @@ -47,12 +47,12 @@ On Thu, 2018-08-30 at 09:22 -0700, Yu-cheng Yu wrote: > > > > > > > > +__visible bool ex_handler_wruss(const struct > > > > exception_table_entry *fixup, -> > > > + struct pt_regs *regs, int +> > > > +A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A struct pt_regs *regs, int > > > > trapnr) > > > > +{ -> > > > + regs->ip = ex_fixup_addr(fixup); -> > > > + regs->ax = -1; -> > > > + return true; +> > > > +A A A A A A A regs->ip = ex_fixup_addr(fixup); +> > > > +A A A A A A A regs->ax = -1; +> > > > +A A A A A A A return true; > > > > +} > > > And here you just write into regs->ax, but your "asm volatile" > > > doesn't @@ -60,22 +60,22 @@ On Thu, 2018-08-30 at 09:22 -0700, Yu-cheng Yu wrote: > > > > > > I think you probably want to add something like an explicit > > > `"+&a"(err)` output to the asm statements. -> > We require asm goto support these days. How about using -> > that? You +> > We require asm goto support these days.A A How about using +> > that?A A You > > won't even need a special exception handler. -Maybe something like this? It looks simple now. +Maybe something like this? A It looks simple now. static inline int write_user_shstk_64(unsigned long addr, unsigned long val) { asm_volatile_goto("wrussq %1, (%0)\n" - "jmp %l[ok]\n" - ".section .fixup,\"ax\"n" - "jmp %l[fail]\n" - ".previous\n" - :: "r" (addr), "r" (val) - :: ok, fail); + A A A A A "jmp %l[ok]\n" + A A A A A ".section .fixup,\"ax\"n" + A A A A A "jmp %l[fail]\n" + A A A A A ".previous\n" + A A A A A :: "r" (addr), "r" (val) + A A A A A :: ok, fail); ok: return 0; fail: diff --git a/a/content_digest b/N2/content_digest index b66c209..d466ba7 100644 --- a/a/content_digest +++ b/N2/content_digest @@ -28,7 +28,11 @@ Mike Kravetz <mike.kravetz@oracle.com> Nadav Amit <nadav.amit@gmail.com> Oleg Nesterov <oleg@redhat.com> - " Pavel Machek <pavel@ucw.cz>\0" + Pavel Machek <pavel@ucw.cz> + Peter Zijlstra <peterz@infradead.org> + Ravi V. Shankar <ravi.v.shankar@intel.com> + Shanbhogue + " Vedvyas <vedvyas.shanbhogue@intel.com>\0" "\00:1\0" "b\0" "On Thu, 2018-08-30 at 09:22 -0700, Yu-cheng Yu wrote:\n" @@ -45,12 +49,12 @@ "> > > > \n" "> > > > \n" "> > > > WRUSS is a new kernel-mode instruction but writes directly\n" - "> > > > to user shadow stack memory.\302\240\302\240This is used to construct\n" + "> > > > to user shadow stack memory.A A This is used to construct\n" "> > > > a return address on the shadow stack for the signal\n" "> > > > handler.\n" "> > > > \n" "> > > > This instruction can fault if the user shadow stack is\n" - "> > > > invalid shadow stack memory.\302\240\302\240In that case, the kernel does\n" + "> > > > invalid shadow stack memory.A A In that case, the kernel does\n" "> > > > fixup.\n" "> > > > \n" "> > > > Signed-off-by: Yu-cheng Yu <yu-cheng.yu@intel.com>\n" @@ -60,16 +64,16 @@ "> > > > +static inline int write_user_shstk_64(unsigned long addr,\n" "> > > > unsigned long val)\n" "> > > > +{\n" - "> > > > +\302\240\302\240\302\240\302\240\302\240\302\240\302\240int err = 0;\n" + "> > > > +A A A A A A A int err = 0;\n" "> > > > +\n" - "> > > > +\302\240\302\240\302\240\302\240\302\240\302\240\302\240asm volatile(\"1: wrussq %1, (%0)\\n\"\n" - "> > > > +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\"2:\\n\"\n" - "> > > > +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240_ASM_EXTABLE_HANDLE(1b, 2b,\n" + "> > > > +A A A A A A A asm volatile(\"1: wrussq %1, (%0)\\n\"\n" + "> > > > +A A A A A A A A A A A A A A A A A A A A \"2:\\n\"\n" + "> > > > +A A A A A A A A A A A A A A A A A A A A _ASM_EXTABLE_HANDLE(1b, 2b,\n" "> > > > ex_handler_wruss)\n" - "> > > > +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240:\n" - "> > > > +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240: \"r\" (addr), \"r\" (val));\n" + "> > > > +A A A A A A A A A A A A A A A A A A A A :\n" + "> > > > +A A A A A A A A A A A A A A A A A A A A : \"r\" (addr), \"r\" (val));\n" "> > > > +\n" - "> > > > +\302\240\302\240\302\240\302\240\302\240\302\240\302\240return err;\n" + "> > > > +A A A A A A A return err;\n" "> > > > +}\n" "> > > What's up with \"err\"? You set it to zero, and then you return\n" "> > > it,\n" @@ -80,12 +84,12 @@ "> > > > \n" "> > > > +__visible bool ex_handler_wruss(const struct\n" "> > > > exception_table_entry *fixup,\n" - "> > > > +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240struct pt_regs *regs, int\n" + "> > > > +A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A A struct pt_regs *regs, int\n" "> > > > trapnr)\n" "> > > > +{\n" - "> > > > +\302\240\302\240\302\240\302\240\302\240\302\240\302\240regs->ip = ex_fixup_addr(fixup);\n" - "> > > > +\302\240\302\240\302\240\302\240\302\240\302\240\302\240regs->ax = -1;\n" - "> > > > +\302\240\302\240\302\240\302\240\302\240\302\240\302\240return true;\n" + "> > > > +A A A A A A A regs->ip = ex_fixup_addr(fixup);\n" + "> > > > +A A A A A A A regs->ax = -1;\n" + "> > > > +A A A A A A A return true;\n" "> > > > +}\n" "> > > And here you just write into regs->ax, but your \"asm volatile\"\n" "> > > doesn't\n" @@ -93,26 +97,26 @@ "> > > \n" "> > > I think you probably want to add something like an explicit\n" "> > > `\"+&a\"(err)` output to the asm statements.\n" - "> > We require asm goto support these days.\302\240\302\240How about using\n" - "> > that?\302\240\302\240You\n" + "> > We require asm goto support these days.A A How about using\n" + "> > that?A A You\n" "> > won't even need a special exception handler.\n" "\n" - "Maybe something like this? \302\240It looks simple now.\n" + "Maybe something like this? A It looks simple now.\n" "\n" "static inline int write_user_shstk_64(unsigned long addr, unsigned\n" "long val)\n" "{\n" "\tasm_volatile_goto(\"wrussq %1, (%0)\\n\"\n" - "\t\t\302\240\302\240\302\240\302\240\302\240\"jmp %l[ok]\\n\"\n" - "\t\t\302\240\302\240\302\240\302\240\302\240\".section .fixup,\\\"ax\\\"n\"\n" - "\t\t\302\240\302\240\302\240\302\240\302\240\"jmp %l[fail]\\n\"\n" - "\t\t\302\240\302\240\302\240\302\240\302\240\".previous\\n\"\n" - "\t\t\302\240\302\240\302\240\302\240\302\240:: \"r\" (addr), \"r\" (val)\n" - "\t\t\302\240\302\240\302\240\302\240\302\240:: ok, fail);\n" + "\t\tA A A A A \"jmp %l[ok]\\n\"\n" + "\t\tA A A A A \".section .fixup,\\\"ax\\\"n\"\n" + "\t\tA A A A A \"jmp %l[fail]\\n\"\n" + "\t\tA A A A A \".previous\\n\"\n" + "\t\tA A A A A :: \"r\" (addr), \"r\" (val)\n" + "\t\tA A A A A :: ok, fail);\n" "ok:\n" "\treturn 0;\n" "fail:\n" "\treturn -1;\n" } -b7517239d06aa30caff223d345eb026f22bb632b7e6456e4889ba9b9fdc9d45d +cadb5806853f5a619aa5a23b58c22399ef32220d08e96faf24fc21cd9e980d7d
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.