Date: Sun, 23 May 2021 16:50:37 GMT From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 22d340828e06 - stable/12 - linux: Fix SMAP-enabled futex routines Message-ID: <202105231650.14NGoboL098483@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=22d340828e06818fb47e6034aadbd52a01795793 commit 22d340828e06818fb47e6034aadbd52a01795793 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2021-05-16 17:41:41 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2021-05-23 16:44:06 +0000 linux: Fix SMAP-enabled futex routines Some of them were dereferencing the user pointer before disabling SMAP. PR: 255591 Reviewed by: kib Tested by: pitwuu@gmail.com Sponsored by: The FreeBSD Foundation (cherry picked from commit fb580451456aa769daa2f4b2f077e39692f80c62) --- sys/amd64/linux/linux_support.s | 12 ++++++------ sys/amd64/linux32/linux32_support.s | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sys/amd64/linux/linux_support.s b/sys/amd64/linux/linux_support.s index 391f76414f22..45eb565f667d 100644 --- a/sys/amd64/linux/linux_support.s +++ b/sys/amd64/linux/linux_support.s @@ -126,16 +126,16 @@ ENTRY(futex_orl_smap) movq $VM_MAXUSER_ADDRESS-4,%rax cmpq %rax,%rsi ja futex_fault + stac movl (%rsi),%eax 1: movl %eax,%ecx orl %edi,%ecx - stac #ifdef SMP lock #endif cmpxchgl %ecx,(%rsi) - clac jnz 1b + clac movl %eax,(%rdx) xorl %eax,%eax movq %rax,PCB_ONFAULT(%r8) @@ -168,16 +168,16 @@ ENTRY(futex_andl_smap) movq $VM_MAXUSER_ADDRESS-4,%rax cmpq %rax,%rsi ja futex_fault + stac movl (%rsi),%eax 1: movl %eax,%ecx andl %edi,%ecx - stac #ifdef SMP lock #endif cmpxchgl %ecx,(%rsi) - clac jnz 1b + clac movl %eax,(%rdx) xorl %eax,%eax movq %rax,PCB_ONFAULT(%r8) @@ -210,16 +210,16 @@ ENTRY(futex_xorl_smap) movq $VM_MAXUSER_ADDRESS-4,%rax cmpq %rax,%rsi ja futex_fault + stac movl (%rsi),%eax 1: movl %eax,%ecx xorl %edi,%ecx - stac #ifdef SMP lock #endif cmpxchgl %ecx,(%rsi) - clac jnz 1b + clac movl %eax,(%rdx) xorl %eax,%eax movq %rax,PCB_ONFAULT(%r8) diff --git a/sys/amd64/linux32/linux32_support.s b/sys/amd64/linux32/linux32_support.s index 981bba9f5821..f3ec3bd8c776 100644 --- a/sys/amd64/linux32/linux32_support.s +++ b/sys/amd64/linux32/linux32_support.s @@ -126,16 +126,16 @@ ENTRY(futex_orl_smap) movq $VM_MAXUSER_ADDRESS-4,%rax cmpq %rax,%rsi ja futex_fault + stac movl (%rsi),%eax 1: movl %eax,%ecx orl %edi,%ecx - stac #ifdef SMP lock #endif cmpxchgl %ecx,(%rsi) - clac jnz 1b + clac movl %eax,(%rdx) xorl %eax,%eax movq %rax,PCB_ONFAULT(%r8) @@ -169,15 +169,15 @@ ENTRY(futex_andl_smap) cmpq %rax,%rsi ja futex_fault movl (%rsi),%eax + stac 1: movl %eax,%ecx andl %edi,%ecx - stac #ifdef SMP lock #endif cmpxchgl %ecx,(%rsi) - clac jnz 1b + clac movl %eax,(%rdx) xorl %eax,%eax movq %rax,PCB_ONFAULT(%r8) @@ -210,16 +210,16 @@ ENTRY(futex_xorl_smap) movq $VM_MAXUSER_ADDRESS-4,%rax cmpq %rax,%rsi ja futex_fault + stac movl (%rsi),%eax 1: movl %eax,%ecx xorl %edi,%ecx - stac #ifdef SMP lock #endif cmpxchgl %ecx,(%rsi) - clac jnz 1b + clac movl %eax,(%rdx) xorl %eax,%eax movq %rax,PCB_ONFAULT(%r8)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202105231650.14NGoboL098483>