Re: get_unmapped_area && in_ia32_syscall (Was: [PATCH] uprobes/x86: fix detection of 32-bit user mode)

2019-08-28 Thread Oleg Nesterov
On 08/28, Dmitry Safonov wrote: > > > On 8/27/19 3:00 PM, Oleg Nesterov wrote: > > [..] > >> But to remind, there is another problem with in_ia32_syscall() && uprobes. > >> > >> get_unmapped_area() paths use in_ia32_syscall() and this is wrong in case > >> when the caller is xol_add_vma(), in this

Re: get_unmapped_area && in_ia32_syscall (Was: [PATCH] uprobes/x86: fix detection of 32-bit user mode)

2019-08-27 Thread Dmitry Safonov
-Cc my old @virtuozzo email. Previously it just ignored emails and now sends those ugly html replies. Sorry about that - I've updated .mailmap now. On 8/27/19 6:03 PM, Dmitry Safonov wrote: > Hi Oleg, > > On 8/27/19 3:00 PM, Oleg Nesterov wrote: > [..] >> But to remind, there is another problem

Re: get_unmapped_area && in_ia32_syscall (Was: [PATCH] uprobes/x86: fix detection of 32-bit user mode)

2019-08-27 Thread Dmitry Safonov
Hi Oleg, On 8/27/19 3:00 PM, Oleg Nesterov wrote: [..] > But to remind, there is another problem with in_ia32_syscall() && uprobes. > > get_unmapped_area() paths use in_ia32_syscall() and this is wrong in case > when the caller is xol_add_vma(), in this case TS_COMPAT won't be set.> > Usually

get_unmapped_area && in_ia32_syscall (Was: [PATCH] uprobes/x86: fix detection of 32-bit user mode)

2019-08-27 Thread Oleg Nesterov
Sorry for delay, vacation. On 08/24, Thomas Gleixner wrote: > > And sadly this was already mentioned here: > >8faaed1b9f50 ("uprobes/x86: Introduce sizeof_long(), cleanup > adjust_ret_addr() and arch_uretprobe_hijack_return_addr()") Yes, and I even posted a similar fix but forgot to send it

Re: [PATCH] uprobes/x86: fix detection of 32-bit user mode

2019-08-26 Thread Thomas Gleixner
On Sat, 24 Aug 2019, Thomas Gleixner wrote: > On Fri, 23 Aug 2019, Andy Lutomirski wrote: > > > On Aug 23, 2019, at 5:03 PM, Thomas Gleixner wrote: > > > > > >> On Sat, 24 Aug 2019, Thomas Gleixner wrote: > > >> On Fri, 23 Aug 2019, Andy Lutomirski wrote: > > On Aug 23, 2019, at 4:44 PM,

Re: [PATCH] uprobes/x86: fix detection of 32-bit user mode

2019-08-23 Thread Thomas Gleixner
On Fri, 23 Aug 2019, Andy Lutomirski wrote: > > On Aug 23, 2019, at 5:03 PM, Thomas Gleixner wrote: > > > >> On Sat, 24 Aug 2019, Thomas Gleixner wrote: > >> On Fri, 23 Aug 2019, Andy Lutomirski wrote: > On Aug 23, 2019, at 4:44 PM, Thomas Gleixner wrote: > > >> On Sat, 24 Aug

Re: [PATCH] uprobes/x86: fix detection of 32-bit user mode

2019-08-23 Thread Andy Lutomirski
> On Aug 23, 2019, at 5:03 PM, Thomas Gleixner wrote: > >> On Sat, 24 Aug 2019, Thomas Gleixner wrote: >> On Fri, 23 Aug 2019, Andy Lutomirski wrote: On Aug 23, 2019, at 4:44 PM, Thomas Gleixner wrote: >> On Sat, 24 Aug 2019, Thomas Gleixner wrote: >> On Sun, 28 Jul 2019,

Re: [PATCH] uprobes/x86: fix detection of 32-bit user mode

2019-08-23 Thread Thomas Gleixner
On Sat, 24 Aug 2019, Thomas Gleixner wrote: > On Fri, 23 Aug 2019, Andy Lutomirski wrote: > > > On Aug 23, 2019, at 4:44 PM, Thomas Gleixner wrote: > > > > > >> On Sat, 24 Aug 2019, Thomas Gleixner wrote: > > >>> On Sun, 28 Jul 2019, Sebastian Mayr wrote: > > >>> > > >>> -static inline int

Re: [PATCH] uprobes/x86: fix detection of 32-bit user mode

2019-08-23 Thread Thomas Gleixner
On Fri, 23 Aug 2019, Andy Lutomirski wrote: > > On Aug 23, 2019, at 4:44 PM, Thomas Gleixner wrote: > > > >> On Sat, 24 Aug 2019, Thomas Gleixner wrote: > >>> On Sun, 28 Jul 2019, Sebastian Mayr wrote: > >>> > >>> -static inline int sizeof_long(void) > >>> +static inline int sizeof_long(struct

Re: [PATCH] uprobes/x86: fix detection of 32-bit user mode

2019-08-23 Thread Andy Lutomirski
> On Aug 23, 2019, at 4:44 PM, Thomas Gleixner wrote: > >> On Sat, 24 Aug 2019, Thomas Gleixner wrote: >>> On Sun, 28 Jul 2019, Sebastian Mayr wrote: >>> >>> -static inline int sizeof_long(void) >>> +static inline int sizeof_long(struct pt_regs *regs) >>> { >>> -return in_ia32_syscall()

Re: [PATCH] uprobes/x86: fix detection of 32-bit user mode

2019-08-23 Thread Thomas Gleixner
On Sat, 24 Aug 2019, Thomas Gleixner wrote: > On Sun, 28 Jul 2019, Sebastian Mayr wrote: > > > -static inline int sizeof_long(void) > > +static inline int sizeof_long(struct pt_regs *regs) > > { > > - return in_ia32_syscall() ? 4 : 8; > > This wants a comment. > > > + return

Re: [PATCH] uprobes/x86: fix detection of 32-bit user mode

2019-08-23 Thread Thomas Gleixner
Sebastian, On Sun, 28 Jul 2019, Sebastian Mayr wrote: sorry for the delay.. > 32-bit processes running on a 64-bit kernel are not always detected > correctly, causing the process to crash when uretprobes are installed. > The reason for the crash is that in_ia32_syscall() is used to determine >

Re: [PATCH] uprobes/x86: fix detection of 32-bit user mode

2019-08-19 Thread Thomas Gleixner
On Mon, 19 Aug 2019, Sebastian Mayr wrote: > > @@ -1056,7 +1056,7 @@ bool arch_uprobe_skip_sstep(struct arch_uprobe > > *auprobe, struct pt_regs *regs) > > unsigned long > > arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, > > struct pt_regs *regs) > > { > > - int rasize =

Re: [PATCH] uprobes/x86: fix detection of 32-bit user mode

2019-08-19 Thread Sebastian Mayr
On Sun, 2019-07-28 at 17:26 +0200, Sebastian Mayr wrote: > 32-bit processes running on a 64-bit kernel are not always detected > correctly, causing the process to crash when uretprobes are > installed. > The reason for the crash is that in_ia32_syscall() is used to > determine > the process's

[PATCH] uprobes/x86: fix detection of 32-bit user mode

2019-07-28 Thread Sebastian Mayr
32-bit processes running on a 64-bit kernel are not always detected correctly, causing the process to crash when uretprobes are installed. The reason for the crash is that in_ia32_syscall() is used to determine the process's mode, which only works correctly when called from a syscall. In the case