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: <CANpmjNNNWcH3X+1TSeinQt0VxdB2mVdQGgJwCG36X9Stochs+w@mail.gmail.com>
Date:   Wed, 27 Apr 2022 09:47:28 +0200
From:   Marco Elver <elver@...gle.com>
To:     Li kunyu <kunyu@...china.com>
Cc:     ebiederm@...ssion.com, keescook@...omium.org, tglx@...utronix.de,
        oleg@...hat.com, legion@...nel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kernel: Optimize unused integer return values

On Wed, 27 Apr 2022 at 09:36, Li kunyu <kunyu@...china.com> wrote:
>
> Optimize unused integer return values

What is this optimizing?

Stylistically the current versions are consistent, and if in future
post_copy_siginfo_from_user32()'s implementation is changed to return
more than 0, it is easy to do.

Code-generation wise, this is de-optimizing and making code slower! In
particular, with what you've done the compiler can no longer tail-call
the functions. https://godbolt.org/z/j68MhjdzT

> Signed-off-by: Li kunyu <kunyu@...china.com>
> ---
>  kernel/signal.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/signal.c b/kernel/signal.c
> index 30cd1ca43bcd..ae58a966c8de 100644
> --- a/kernel/signal.c
> +++ b/kernel/signal.c
> @@ -3464,7 +3464,7 @@ int __copy_siginfo_to_user32(struct compat_siginfo __user *to,
>         return 0;
>  }
>
> -static int post_copy_siginfo_from_user32(kernel_siginfo_t *to,
> +static void post_copy_siginfo_from_user32(kernel_siginfo_t *to,
>                                          const struct compat_siginfo *from)
>  {
>         clear_siginfo(to);
> @@ -3548,7 +3548,8 @@ static int __copy_siginfo_from_user32(int signo, struct kernel_siginfo *to,
>                 return -EFAULT;
>
>         from.si_signo = signo;
> -       return post_copy_siginfo_from_user32(to, &from);
> +       post_copy_siginfo_from_user32(to, &from);
> +       return 0;
>  }
>
>  int copy_siginfo_from_user32(struct kernel_siginfo *to,
> @@ -3559,7 +3560,8 @@ int copy_siginfo_from_user32(struct kernel_siginfo *to,
>         if (copy_from_user(&from, ufrom, sizeof(struct compat_siginfo)))
>                 return -EFAULT;
>
> -       return post_copy_siginfo_from_user32(to, &from);
> +       post_copy_siginfo_from_user32(to, &from);
> +       return 0;
>  }
>  #endif /* CONFIG_COMPAT */
>
> --
> 2.18.2
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ