[opensuse-kernel] [PATCH] unwind: update for vdso32 compat changes
Commit b0b49f2673f (x86, vdso: Remove compat vdso support) removed the FIX_VDSO macro defining the vdso area. This patch updates it to use the vdso pointer and size to define the area instead. Signed-off-by: Jeff Mahoney <jeffm@suse.com> --- arch/x86/include/asm/elf.h | 1 + arch/x86/include/asm/unwind.h | 18 +++++++++++++++--- arch/x86/vdso/vdso32-setup.c | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-) --- a/arch/x86/include/asm/elf.h +++ b/arch/x86/include/asm/elf.h @@ -76,6 +76,7 @@ typedef struct user_fxsr_struct elf_fpxr #include <asm/vdso.h> extern unsigned int vdso_enabled; +extern unsigned int vdso32_size; /* * This is used to ensure we don't load something for the wrong architecture. --- a/arch/x86/include/asm/unwind.h +++ b/arch/x86/include/asm/unwind.h @@ -66,7 +66,7 @@ struct unwind_frame_info #else /* X86_32 */ -#include <asm/fixmap.h> +#include <asm/elf.h> #define FRAME_RETADDR_OFFSET 4 @@ -81,6 +81,19 @@ struct unwind_frame_info PTREGS_INFO(di), \ PTREGS_INFO(ip) +static inline bool is_vdso32_area(struct unwind_frame_info *info) +{ + unsigned long vdso_addr; + + if (!info->task || !info->task->mm || + !info->task->mm->context.vdso) + return false; + + vdso_addr = (unsigned long)info->task->mm->context.vdso; + + return info->regs.ip >= vdso_addr && + info->regs.ip < vdso_addr + vdso32_size; +} #endif #define UNW_DEFAULT_RA(raItem, dataAlign) \ @@ -141,8 +154,7 @@ static inline int arch_unw_user_mode(/*c #else return user_mode_vm(&info->regs) || info->regs.ip < PAGE_OFFSET - || (info->regs.ip >= __fix_to_virt(FIX_VDSO) - && info->regs.ip < __fix_to_virt(FIX_VDSO) + PAGE_SIZE) + || is_vdso32_area(info) || info->regs.sp < PAGE_OFFSET; #endif } --- a/arch/x86/vdso/vdso32-setup.c +++ b/arch/x86/vdso/vdso32-setup.c @@ -71,7 +71,7 @@ EXPORT_SYMBOL_GPL(vdso_enabled); #endif static struct page **vdso32_pages; -static unsigned vdso32_size; +unsigned int vdso32_size; #ifdef CONFIG_X86_64 -- Jeff Mahoney SUSE Labs -- To unsubscribe, e-mail: opensuse-kernel+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-kernel+owner@opensuse.org
On 28.04.14 at 14:46, <jeffm@suse.com> wrote: Commit b0b49f2673f (x86, vdso: Remove compat vdso support) removed the FIX_VDSO macro defining the vdso area.
This patch updates it to use the vdso pointer and size to define the area instead.
Now that I look at it a second time I think the change can be _much_ smaller (and we won't need any backport):
@@ -141,8 +154,7 @@ static inline int arch_unw_user_mode(/*c #else return user_mode_vm(&info->regs) || info->regs.ip < PAGE_OFFSET - || (info->regs.ip >= __fix_to_virt(FIX_VDSO) - && info->regs.ip < __fix_to_virt(FIX_VDSO) + PAGE_SIZE) + || is_vdso32_area(info) || info->regs.sp < PAGE_OFFSET; #endif }
Afaict when is_vdso32_area() returns true, ->regs.ip can only ever be < PAGE_OFFSET, i.e. all we need is to delete the extra check. Jan -- To unsubscribe, e-mail: opensuse-kernel+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-kernel+owner@opensuse.org
participants (2)
-
Jan Beulich
-
Jeff Mahoney