Re: [PATCH] perf trace beauty ioctl: fix off-by-one error in table

From: Arnaldo Carvalho de Melo
Date: Fri Aug 23 2019 - 09:07:33 EST


Em Thu, Aug 22, 2019 at 08:36:25PM -0700, Benjamin Peterson escreveu:
> While tracing a program that calls isatty(3), I noticed that strace reported
> TCGETS for the request argument of the underlying ioctl(2) syscall while perf
> trace reported TCSETS. strace is corrrect. The bug in perf was due to the tty
> ioctl beauty table starting at 0x5400 rather than 0x5401.

Applied, thanks a lot!

- Arnaldo

> Fixes: 1cc47f2d46206d67285aea0ca7e8450af571da13 ("perf trace beauty ioctl: Improve 'cmd' beautifier")
> Signed-off-by: Benjamin Peterson <benjamin@xxxxxxxxxx>
> ---
> tools/perf/trace/beauty/ioctl.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/trace/beauty/ioctl.c b/tools/perf/trace/beauty/ioctl.c
> index 52242fa4072b..e19eb6ea361d 100644
> --- a/tools/perf/trace/beauty/ioctl.c
> +++ b/tools/perf/trace/beauty/ioctl.c
> @@ -21,7 +21,7 @@
> static size_t ioctl__scnprintf_tty_cmd(int nr, int dir, char *bf, size_t size)
> {
> static const char *ioctl_tty_cmd[] = {
> - "TCGETS", "TCSETS", "TCSETSW", "TCSETSF", "TCGETA", "TCSETA", "TCSETAW",
> + [_IOC_NR(TCGETS)] = "TCGETS", "TCSETS", "TCSETSW", "TCSETSF", "TCGETA", "TCSETA", "TCSETAW",
> "TCSETAF", "TCSBRK", "TCXONC", "TCFLSH", "TIOCEXCL", "TIOCNXCL", "TIOCSCTTY",
> "TIOCGPGRP", "TIOCSPGRP", "TIOCOUTQ", "TIOCSTI", "TIOCGWINSZ", "TIOCSWINSZ",
> "TIOCMGET", "TIOCMBIS", "TIOCMBIC", "TIOCMSET", "TIOCGSOFTCAR", "TIOCSSOFTCAR",
> --
> 2.20.1

--

- Arnaldo