lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230818200148.66fd9878ddd32f810c6ae860@kernel.org>
Date:   Fri, 18 Aug 2023 20:01:48 +0900
From:   Masami Hiramatsu (Google) <mhiramat@...nel.org>
To:     Florent Revest <revest@...omium.org>
Cc:     Alexei Starovoitov <alexei.starovoitov@...il.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        linux-trace-kernel@...r.kernel.org,
        LKML <linux-kernel@...r.kernel.org>,
        Martin KaFai Lau <martin.lau@...ux.dev>,
        bpf <bpf@...r.kernel.org>, Sven Schnelle <svens@...ux.ibm.com>,
        Alexei Starovoitov <ast@...nel.org>,
        Jiri Olsa <jolsa@...nel.org>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Alan Maguire <alan.maguire@...cle.com>,
        Mark Rutland <mark.rutland@....com>,
        Peter Zijlstra <peterz@...radead.org>,
        Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH v3 4/8] fprobe: rethook: Use ftrace_regs in fprobe exit
 handler and rethook

On Thu, 17 Aug 2023 10:57:40 +0200
Florent Revest <revest@...omium.org> wrote:

> On Sat, Aug 12, 2023 at 7:37 AM Masami Hiramatsu (Google)
> <mhiramat@...nel.org> wrote:
> >
> > diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
> > index 976fd594b446..d56304276318 100644
> > --- a/kernel/trace/Kconfig
> > +++ b/kernel/trace/Kconfig
> > @@ -57,6 +57,13 @@ config HAVE_DYNAMIC_FTRACE_WITH_ARGS
> >          This allows for use of ftrace_regs_get_argument() and
> >          ftrace_regs_get_stack_pointer().
> >
> > +config HAVE_PT_REGS_TO_FTRACE_REGS_CAST
> > +       bool
> > +       help
> > +        If this is set, the memory layout of the ftrace_regs data structure
> > +        is the same as the pt_regs. So the pt_regs is possible to be casted
> > +        to ftrace_regs.
> 
> What would you think of introducing a:
> 
> #ifdef HAVE_PT_REGS_TO_FTRACE_REGS_CAST
> static_assert(sizeof(struct pt_regs) == sizeof(struct ftrace_regs);
> #endif // HAVE_PT_REGS_TO_FTRACE_REGS_CAST
> 
> somewhere in ftrace.h just as a small extra safety net ? It doesn't
> exactly guarantee all we want but it should give an early warning of
> mistakes.

That's a good idea :)
OK, I'll add it in the next version.

Thank you,


-- 
Masami Hiramatsu (Google) <mhiramat@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ