On Mon, Apr 08, 2019 at 09:13:58AM +0300, Elena Reshetova wrote:
> diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
> index 7bc105f47d21..38ddc213a5e9 100644
> --- a/arch/x86/entry/common.c
> +++ b/arch/x86/entry/common.c
> @@ -35,6 +35,12 @@
> #define CREATE_TRACE_POINTS
> #include <trace/events/syscalls.h>
>
> +#ifdef CONFIG_RANDOMIZE_KSTACK_OFFSET
> +#include <linux/random.h>
> +
> +void *alloca(size_t size);
> +#endif
> +
> #ifdef CONFIG_CONTEXT_TRACKING
> /* Called on entry from user mode with IRQs off. */
> __visible inline void enter_from_user_mode(void)
> @@ -273,6 +279,13 @@ __visible void do_syscall_64(unsigned long nr, struct pt_regs *regs)
> {
> struct thread_info *ti;
>
> +#ifdef CONFIG_RANDOMIZE_KSTACK_OFFSET
> + size_t offset = ((size_t)prandom_u32()) % 256;
> + char *ptr = alloca(offset);
> +
> + asm volatile("":"=m"(*ptr));
> +#endif
> +
> enter_from_user_mode();
> local_irq_enable();
> ti = current_thread_info();
Would it make sense to also do this for the compat syscalls
(do_fast_syscall_32, do_int80_syscall_32)?
--
Josh
> On Mon, Apr 08, 2019 at 09:13:58AM +0300, Elena Reshetova wrote:
> > diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
> > index 7bc105f47d21..38ddc213a5e9 100644
> > --- a/arch/x86/entry/common.c
> > +++ b/arch/x86/entry/common.c
> > @@ -35,6 +35,12 @@
> > #define CREATE_TRACE_POINTS
> > #include <trace/events/syscalls.h>
> >
> > +#ifdef CONFIG_RANDOMIZE_KSTACK_OFFSET
> > +#include <linux/random.h>
> > +
> > +void *alloca(size_t size);
> > +#endif
> > +
> > #ifdef CONFIG_CONTEXT_TRACKING
> > /* Called on entry from user mode with IRQs off. */
> > __visible inline void enter_from_user_mode(void)
> > @@ -273,6 +279,13 @@ __visible void do_syscall_64(unsigned long nr, struct
> pt_regs *regs)
> > {
> > struct thread_info *ti;
> >
> > +#ifdef CONFIG_RANDOMIZE_KSTACK_OFFSET
> > + size_t offset = ((size_t)prandom_u32()) % 256;
> > + char *ptr = alloca(offset);
> > +
> > + asm volatile("":"=m"(*ptr));
> > +#endif
> > +
> > enter_from_user_mode();
> > local_irq_enable();
> > ti = current_thread_info();
>
> Would it make sense to also do this for the compat syscalls
> (do_fast_syscall_32, do_int80_syscall_32)?
Good question.
Originally I was thinking that in-stack randomization makes sense
only for x86_64, since this is what VMAP stack on x86 depends on.
Without VMAP stack and guard pages, there are easier ways to attack,
so hardening there does not really makes that much sense IMO.
However the 32 emulation case is interesting, I didn't think of it before.
I guess if it uses VMAP-based stack, then we should support these calls also
with in-stack randomization.
Best Regards,
Elena.
On Mon, Apr 8, 2019 at 6:31 AM Reshetova, Elena
<[email protected]> wrote:
> Originally I was thinking that in-stack randomization makes sense
> only for x86_64, since this is what VMAP stack on x86 depends on.
> Without VMAP stack and guard pages, there are easier ways to attack,
> so hardening there does not really makes that much sense IMO.
> However the 32 emulation case is interesting, I didn't think of it before.
> I guess if it uses VMAP-based stack, then we should support these calls also
> with in-stack randomization.
I think there's value in the non-VMAP-stack case: e.g. if the target
is "uninitialized" values, repeated syscalls will make targeting the
area less robust. (Though one would hope anyone using stack offset
randomization would also be using one of the various "always
initialize" options too...)
--
Kees Cook
* Josh Poimboeuf <[email protected]> wrote:
> On Mon, Apr 08, 2019 at 09:13:58AM +0300, Elena Reshetova wrote:
> > diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
> > index 7bc105f47d21..38ddc213a5e9 100644
> > --- a/arch/x86/entry/common.c
> > +++ b/arch/x86/entry/common.c
> > @@ -35,6 +35,12 @@
> > #define CREATE_TRACE_POINTS
> > #include <trace/events/syscalls.h>
> >
> > +#ifdef CONFIG_RANDOMIZE_KSTACK_OFFSET
> > +#include <linux/random.h>
> > +
> > +void *alloca(size_t size);
> > +#endif
> > +
> > #ifdef CONFIG_CONTEXT_TRACKING
> > /* Called on entry from user mode with IRQs off. */
> > __visible inline void enter_from_user_mode(void)
> > @@ -273,6 +279,13 @@ __visible void do_syscall_64(unsigned long nr, struct pt_regs *regs)
> > {
> > struct thread_info *ti;
> >
> > +#ifdef CONFIG_RANDOMIZE_KSTACK_OFFSET
> > + size_t offset = ((size_t)prandom_u32()) % 256;
> > + char *ptr = alloca(offset);
> > +
> > + asm volatile("":"=m"(*ptr));
> > +#endif
> > +
> > enter_from_user_mode();
> > local_irq_enable();
> > ti = current_thread_info();
>
> Would it make sense to also do this for the compat syscalls
> (do_fast_syscall_32, do_int80_syscall_32)?
Could someone please include the full patch, with justification and
performance impact analysis etc.? Can only find the code part of the
thread on lkml, which leaves out this context.
Thanks,
Ingo
> * Josh Poimboeuf <[email protected]> wrote:
>
> > On Mon, Apr 08, 2019 at 09:13:58AM +0300, Elena Reshetova wrote:
> > > diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
> > > index 7bc105f47d21..38ddc213a5e9 100644
> > > --- a/arch/x86/entry/common.c
> > > +++ b/arch/x86/entry/common.c
> > > @@ -35,6 +35,12 @@
> > > #define CREATE_TRACE_POINTS
> > > #include <trace/events/syscalls.h>
> > >
> > > +#ifdef CONFIG_RANDOMIZE_KSTACK_OFFSET
> > > +#include <linux/random.h>
> > > +
> > > +void *alloca(size_t size);
> > > +#endif
> > > +
> > > #ifdef CONFIG_CONTEXT_TRACKING
> > > /* Called on entry from user mode with IRQs off. */
> > > __visible inline void enter_from_user_mode(void)
> > > @@ -273,6 +279,13 @@ __visible void do_syscall_64(unsigned long nr, struct
> pt_regs *regs)
> > > {
> > > struct thread_info *ti;
> > >
> > > +#ifdef CONFIG_RANDOMIZE_KSTACK_OFFSET
> > > + size_t offset = ((size_t)prandom_u32()) % 256;
> > > + char *ptr = alloca(offset);
> > > +
> > > + asm volatile("":"=m"(*ptr));
> > > +#endif
> > > +
> > > enter_from_user_mode();
> > > local_irq_enable();
> > > ti = current_thread_info();
> >
> > Would it make sense to also do this for the compat syscalls
> > (do_fast_syscall_32, do_int80_syscall_32)?
>
> Could someone please include the full patch, with justification and
> performance impact analysis etc.? Can only find the code part of the
> thread on lkml, which leaves out this context.
>
Sorry, this is very weird, I cannot find it either from lkml, but it was sent there
to begin with (and as visible from reply-to headers).
Do you want me to resent original version or with "do_fast_syscall_32,
do_int80_syscall_32" additions (I am finishing testing them now).
Best Regards,
Elena.
> > > On Mon, Apr 08, 2019 at 09:13:58AM +0300, Elena Reshetova wrote:
> > > > diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
> > > > index 7bc105f47d21..38ddc213a5e9 100644
> > > > --- a/arch/x86/entry/common.c
> > > > +++ b/arch/x86/entry/common.c
> > > > @@ -35,6 +35,12 @@
> > > > #define CREATE_TRACE_POINTS
> > > > #include <trace/events/syscalls.h>
> > > >
> > > > +#ifdef CONFIG_RANDOMIZE_KSTACK_OFFSET
> > > > +#include <linux/random.h>
> > > > +
> > > > +void *alloca(size_t size);
> > > > +#endif
> > > > +
> > > > #ifdef CONFIG_CONTEXT_TRACKING
> > > > /* Called on entry from user mode with IRQs off. */
> > > > __visible inline void enter_from_user_mode(void)
> > > > @@ -273,6 +279,13 @@ __visible void do_syscall_64(unsigned long nr, struct
> > pt_regs *regs)
> > > > {
> > > > struct thread_info *ti;
> > > >
> > > > +#ifdef CONFIG_RANDOMIZE_KSTACK_OFFSET
> > > > + size_t offset = ((size_t)prandom_u32()) % 256;
> > > > + char *ptr = alloca(offset);
> > > > +
> > > > + asm volatile("":"=m"(*ptr));
> > > > +#endif
> > > > +
> > > > enter_from_user_mode();
> > > > local_irq_enable();
> > > > ti = current_thread_info();
> > >
> > > Would it make sense to also do this for the compat syscalls
> > > (do_fast_syscall_32, do_int80_syscall_32)?
> >
> > Could someone please include the full patch, with justification and
> > performance impact analysis etc.? Can only find the code part of the
> > thread on lkml, which leaves out this context.
> >
>
> Sorry, this is very weird, I cannot find it either from lkml, but it was sent there
> to begin with (and as visible from reply-to headers).
>
> Do you want me to resent original version or with "do_fast_syscall_32,
> do_int80_syscall_32" additions (I am finishing testing them now).
I will resend the original x86_64 now since this is the one I tested and
measured properly. The 32 bit changes seem to work fine inside my 32 bit VM,
but since I don't have any real 32 bit HW, I am hesitant to send them out without
real HW testing and measuring.
This is the asm code for 32 bits (note it requires __builtin_alloca definition and not just alloca,
so I will change the 64 bit version to use it also):
#ifdef CONFIG_RANDOMIZE_KSTACK_OFFSET
size_t offset = ((size_t)prandom_u32()) % 256;
0xc10025b6 call 0xc146f7d0 <prandom_u32>
0xc10025bb movzbl %al,%eax
char *ptr = __builtin_alloca(offset);
0xc10025be add $0x12,%eax
0xc10025c1 and $0x1fc,%eax
0xc10025c6 sub %eax,%esp
0xc10025c8 lea 0x27(%esp),%eax
0xc10025cc and $0xfffffff0,%eax
Also, the result is 47 different random offsets produced,
which is slightly better than 33 offsets for x86_64.
Best Regards,
Elena
* Reshetova, Elena <[email protected]> wrote:
> > * Josh Poimboeuf <[email protected]> wrote:
> >
> > > On Mon, Apr 08, 2019 at 09:13:58AM +0300, Elena Reshetova wrote:
> > > > diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
> > > > index 7bc105f47d21..38ddc213a5e9 100644
> > > > --- a/arch/x86/entry/common.c
> > > > +++ b/arch/x86/entry/common.c
> > > > @@ -35,6 +35,12 @@
> > > > #define CREATE_TRACE_POINTS
> > > > #include <trace/events/syscalls.h>
> > > >
> > > > +#ifdef CONFIG_RANDOMIZE_KSTACK_OFFSET
> > > > +#include <linux/random.h>
> > > > +
> > > > +void *alloca(size_t size);
> > > > +#endif
> > > > +
> > > > #ifdef CONFIG_CONTEXT_TRACKING
> > > > /* Called on entry from user mode with IRQs off. */
> > > > __visible inline void enter_from_user_mode(void)
> > > > @@ -273,6 +279,13 @@ __visible void do_syscall_64(unsigned long nr, struct
> > pt_regs *regs)
> > > > {
> > > > struct thread_info *ti;
> > > >
> > > > +#ifdef CONFIG_RANDOMIZE_KSTACK_OFFSET
> > > > + size_t offset = ((size_t)prandom_u32()) % 256;
> > > > + char *ptr = alloca(offset);
> > > > +
> > > > + asm volatile("":"=m"(*ptr));
> > > > +#endif
> > > > +
> > > > enter_from_user_mode();
> > > > local_irq_enable();
> > > > ti = current_thread_info();
> > >
> > > Would it make sense to also do this for the compat syscalls
> > > (do_fast_syscall_32, do_int80_syscall_32)?
> >
> > Could someone please include the full patch, with justification and
> > performance impact analysis etc.? Can only find the code part of the
> > thread on lkml, which leaves out this context.
> >
>
> Sorry, this is very weird, I cannot find it either from lkml, but it was sent there
> to begin with (and as visible from reply-to headers).
>
> Do you want me to resent original version or with "do_fast_syscall_32,
> do_int80_syscall_32" additions (I am finishing testing them now).
The original patch would be fine to me, was missing the context.
Thanks,
Ingo
On Wed, Apr 10, 2019 at 3:24 AM Reshetova, Elena
<[email protected]> wrote:
>
>
> > > > On Mon, Apr 08, 2019 at 09:13:58AM +0300, Elena Reshetova wrote:
> > > > > diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
> > > > > index 7bc105f47d21..38ddc213a5e9 100644
> > > > > --- a/arch/x86/entry/common.c
> > > > > +++ b/arch/x86/entry/common.c
> > > > > @@ -35,6 +35,12 @@
> > > > > #define CREATE_TRACE_POINTS
> > > > > #include <trace/events/syscalls.h>
> > > > >
> > > > > +#ifdef CONFIG_RANDOMIZE_KSTACK_OFFSET
> > > > > +#include <linux/random.h>
> > > > > +
> > > > > +void *alloca(size_t size);
> > > > > +#endif
> > > > > +
> > > > > #ifdef CONFIG_CONTEXT_TRACKING
> > > > > /* Called on entry from user mode with IRQs off. */
> > > > > __visible inline void enter_from_user_mode(void)
> > > > > @@ -273,6 +279,13 @@ __visible void do_syscall_64(unsigned long nr, struct
> > > pt_regs *regs)
> > > > > {
> > > > > struct thread_info *ti;
> > > > >
> > > > > +#ifdef CONFIG_RANDOMIZE_KSTACK_OFFSET
> > > > > + size_t offset = ((size_t)prandom_u32()) % 256;
> > > > > + char *ptr = alloca(offset);
> > > > > +
> > > > > + asm volatile("":"=m"(*ptr));
> > > > > +#endif
> > > > > +
> > > > > enter_from_user_mode();
> > > > > local_irq_enable();
> > > > > ti = current_thread_info();
> > > >
> > > > Would it make sense to also do this for the compat syscalls
> > > > (do_fast_syscall_32, do_int80_syscall_32)?
> > >
> > > Could someone please include the full patch, with justification and
> > > performance impact analysis etc.? Can only find the code part of the
> > > thread on lkml, which leaves out this context.
> > >
> >
> > Sorry, this is very weird, I cannot find it either from lkml, but it was sent there
> > to begin with (and as visible from reply-to headers).
> >
> > Do you want me to resent original version or with "do_fast_syscall_32,
> > do_int80_syscall_32" additions (I am finishing testing them now).
>
> I will resend the original x86_64 now since this is the one I tested and
> measured properly. The 32 bit changes seem to work fine inside my 32 bit VM,
> but since I don't have any real 32 bit HW, I am hesitant to send them out without
> real HW testing and measuring.
>
> This is the asm code for 32 bits (note it requires __builtin_alloca definition and not just alloca,
> so I will change the 64 bit version to use it also):
>
> #ifdef CONFIG_RANDOMIZE_KSTACK_OFFSET
> size_t offset = ((size_t)prandom_u32()) % 256;
> 0xc10025b6 call 0xc146f7d0 <prandom_u32>
> 0xc10025bb movzbl %al,%eax
> char *ptr = __builtin_alloca(offset);
> 0xc10025be add $0x12,%eax
> 0xc10025c1 and $0x1fc,%eax
> 0xc10025c6 sub %eax,%esp
> 0xc10025c8 lea 0x27(%esp),%eax
> 0xc10025cc and $0xfffffff0,%eax
>
> Also, the result is 47 different random offsets produced,
> which is slightly better than 33 offsets for x86_64.
>
I would suggest that you macro-ify this thing:
#ifdef WHATEVER
#define add_random_stack_offset() do { void *addr = ... } while (0)
#else
#define add_random_stack_offset() do {} while (0)
#endif
since you'll end up with more than one call site.
> On Wed, Apr 10, 2019 at 3:24 AM Reshetova, Elena
> <[email protected]> wrote:
> >
> >
> > > > > On Mon, Apr 08, 2019 at 09:13:58AM +0300, Elena Reshetova wrote:
> > > > > > diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
> > > > > > index 7bc105f47d21..38ddc213a5e9 100644
> > > > > > --- a/arch/x86/entry/common.c
> > > > > > +++ b/arch/x86/entry/common.c
> > > > > > @@ -35,6 +35,12 @@
> > > > > > #define CREATE_TRACE_POINTS
> > > > > > #include <trace/events/syscalls.h>
> > > > > >
> > > > > > +#ifdef CONFIG_RANDOMIZE_KSTACK_OFFSET
> > > > > > +#include <linux/random.h>
> > > > > > +
> > > > > > +void *alloca(size_t size);
> > > > > > +#endif
> > > > > > +
> > > > > > #ifdef CONFIG_CONTEXT_TRACKING
> > > > > > /* Called on entry from user mode with IRQs off. */
> > > > > > __visible inline void enter_from_user_mode(void)
> > > > > > @@ -273,6 +279,13 @@ __visible void do_syscall_64(unsigned long nr,
> struct
> > > > pt_regs *regs)
> > > > > > {
> > > > > > struct thread_info *ti;
> > > > > >
> > > > > > +#ifdef CONFIG_RANDOMIZE_KSTACK_OFFSET
> > > > > > + size_t offset = ((size_t)prandom_u32()) % 256;
> > > > > > + char *ptr = alloca(offset);
> > > > > > +
> > > > > > + asm volatile("":"=m"(*ptr));
> > > > > > +#endif
> > > > > > +
> > > > > > enter_from_user_mode();
> > > > > > local_irq_enable();
> > > > > > ti = current_thread_info();
> > > > >
> > > > > Would it make sense to also do this for the compat syscalls
> > > > > (do_fast_syscall_32, do_int80_syscall_32)?
> > > >
> > > > Could someone please include the full patch, with justification and
> > > > performance impact analysis etc.? Can only find the code part of the
> > > > thread on lkml, which leaves out this context.
> > > >
> > >
> > > Sorry, this is very weird, I cannot find it either from lkml, but it was sent there
> > > to begin with (and as visible from reply-to headers).
> > >
> > > Do you want me to resent original version or with "do_fast_syscall_32,
> > > do_int80_syscall_32" additions (I am finishing testing them now).
> >
> > I will resend the original x86_64 now since this is the one I tested and
> > measured properly. The 32 bit changes seem to work fine inside my 32 bit VM,
> > but since I don't have any real 32 bit HW, I am hesitant to send them out without
> > real HW testing and measuring.
> >
> > This is the asm code for 32 bits (note it requires __builtin_alloca definition and not
> just alloca,
> > so I will change the 64 bit version to use it also):
> >
> > #ifdef CONFIG_RANDOMIZE_KSTACK_OFFSET
> > size_t offset = ((size_t)prandom_u32()) % 256;
> > 0xc10025b6 call 0xc146f7d0 <prandom_u32>
> > 0xc10025bb movzbl %al,%eax
> > char *ptr = __builtin_alloca(offset);
> > 0xc10025be add $0x12,%eax
> > 0xc10025c1 and $0x1fc,%eax
> > 0xc10025c6 sub %eax,%esp
> > 0xc10025c8 lea 0x27(%esp),%eax
> > 0xc10025cc and $0xfffffff0,%eax
> >
> > Also, the result is 47 different random offsets produced,
> > which is slightly better than 33 offsets for x86_64.
> >
>
> I would suggest that you macro-ify this thing:
>
> #ifdef WHATEVER
> #define add_random_stack_offset() do { void *addr = ... } while (0)
> #else
> #define add_random_stack_offset() do {} while (0)
> #endif
>
> since you'll end up with more than one call site.
Sure, will do. So, you are ok for this to be also called from do_fast_syscall_32
and do_int80_syscall_32? I can send the resulting patch, just cannot test on any
real 32 bit HW, only VM.
Best Regards,
Elena.
On Thu, Apr 11, 2019 at 10:36 PM Reshetova, Elena
<[email protected]> wrote:
>
> > On Wed, Apr 10, 2019 at 3:24 AM Reshetova, Elena
> > <[email protected]> wrote:
> > >
> > >
> > > > > > On Mon, Apr 08, 2019 at 09:13:58AM +0300, Elena Reshetova wrote:
> > > > > > > diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
> > > > > > > index 7bc105f47d21..38ddc213a5e9 100644
> > > > > > > --- a/arch/x86/entry/common.c
> > > > > > > +++ b/arch/x86/entry/common.c
> > > > > > > @@ -35,6 +35,12 @@
> > > > > > > #define CREATE_TRACE_POINTS
> > > > > > > #include <trace/events/syscalls.h>
> > > > > > >
> > > > > > > +#ifdef CONFIG_RANDOMIZE_KSTACK_OFFSET
> > > > > > > +#include <linux/random.h>
> > > > > > > +
> > > > > > > +void *alloca(size_t size);
> > > > > > > +#endif
> > > > > > > +
> > > > > > > #ifdef CONFIG_CONTEXT_TRACKING
> > > > > > > /* Called on entry from user mode with IRQs off. */
> > > > > > > __visible inline void enter_from_user_mode(void)
> > > > > > > @@ -273,6 +279,13 @@ __visible void do_syscall_64(unsigned long nr,
> > struct
> > > > > pt_regs *regs)
> > > > > > > {
> > > > > > > struct thread_info *ti;
> > > > > > >
> > > > > > > +#ifdef CONFIG_RANDOMIZE_KSTACK_OFFSET
> > > > > > > + size_t offset = ((size_t)prandom_u32()) % 256;
> > > > > > > + char *ptr = alloca(offset);
> > > > > > > +
> > > > > > > + asm volatile("":"=m"(*ptr));
> > > > > > > +#endif
> > > > > > > +
> > > > > > > enter_from_user_mode();
> > > > > > > local_irq_enable();
> > > > > > > ti = current_thread_info();
> > > > > >
> > > > > > Would it make sense to also do this for the compat syscalls
> > > > > > (do_fast_syscall_32, do_int80_syscall_32)?
> > > > >
> > > > > Could someone please include the full patch, with justification and
> > > > > performance impact analysis etc.? Can only find the code part of the
> > > > > thread on lkml, which leaves out this context.
> > > > >
> > > >
> > > > Sorry, this is very weird, I cannot find it either from lkml, but it was sent there
> > > > to begin with (and as visible from reply-to headers).
> > > >
> > > > Do you want me to resent original version or with "do_fast_syscall_32,
> > > > do_int80_syscall_32" additions (I am finishing testing them now).
> > >
> > > I will resend the original x86_64 now since this is the one I tested and
> > > measured properly. The 32 bit changes seem to work fine inside my 32 bit VM,
> > > but since I don't have any real 32 bit HW, I am hesitant to send them out without
> > > real HW testing and measuring.
> > >
> > > This is the asm code for 32 bits (note it requires __builtin_alloca definition and not
> > just alloca,
> > > so I will change the 64 bit version to use it also):
> > >
> > > #ifdef CONFIG_RANDOMIZE_KSTACK_OFFSET
> > > size_t offset = ((size_t)prandom_u32()) % 256;
> > > 0xc10025b6 call 0xc146f7d0 <prandom_u32>
> > > 0xc10025bb movzbl %al,%eax
> > > char *ptr = __builtin_alloca(offset);
> > > 0xc10025be add $0x12,%eax
> > > 0xc10025c1 and $0x1fc,%eax
> > > 0xc10025c6 sub %eax,%esp
> > > 0xc10025c8 lea 0x27(%esp),%eax
> > > 0xc10025cc and $0xfffffff0,%eax
> > >
> > > Also, the result is 47 different random offsets produced,
> > > which is slightly better than 33 offsets for x86_64.
> > >
> >
> > I would suggest that you macro-ify this thing:
> >
> > #ifdef WHATEVER
> > #define add_random_stack_offset() do { void *addr = ... } while (0)
> > #else
> > #define add_random_stack_offset() do {} while (0)
> > #endif
> >
> > since you'll end up with more than one call site.
>
> Sure, will do. So, you are ok for this to be also called from do_fast_syscall_32
> and do_int80_syscall_32? I can send the resulting patch, just cannot test on any
> real 32 bit HW, only VM.
>
Sounds good to me.