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: <877co2gwkb.fsf@all.your.base.are.belong.to.us>
Date:   Wed, 04 Oct 2023 18:51:48 +0200
From:   Björn Töpel <bjorn@...nel.org>
To:     Clément Léger <cleger@...osinc.com>,
        Paul Walmsley <paul.walmsley@...ive.com>,
        Palmer Dabbelt <palmer@...belt.com>,
        Albert Ou <aou@...s.berkeley.edu>
Cc:     Clément Léger <cleger@...osinc.com>,
        Atish Patra <atishp@...osinc.com>,
        Andrew Jones <ajones@...tanamicro.com>,
        Evan Green <evan@...osinc.com>,
        Björn Topel <bjorn@...osinc.com>,
        linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org,
        Ron Minnich <rminnich@...il.com>,
        Daniel Maslowski <cyrevolt@...glemail.com>,
        Conor Dooley <conor@...nel.org>
Subject: Re: [PATCH v2 1/8] riscv: remove unused functions in
 traps_misaligned.c

Clément Léger <cleger@...osinc.com> writes:

> Replace macros by the only two function calls that are done from this
> file, store_u8() and load_u8().
>
> Signed-off-by: Clément Léger <cleger@...osinc.com>
> ---
>  arch/riscv/kernel/traps_misaligned.c | 46 +++++-----------------------
>  1 file changed, 7 insertions(+), 39 deletions(-)
>
> diff --git a/arch/riscv/kernel/traps_misaligned.c b/arch/riscv/kernel/traps_misaligned.c
> index 378f5b151443..e7bfb33089c1 100644
> --- a/arch/riscv/kernel/traps_misaligned.c
> +++ b/arch/riscv/kernel/traps_misaligned.c
> @@ -151,51 +151,19 @@
>  #define PRECISION_S 0
>  #define PRECISION_D 1
>  
> -#define DECLARE_UNPRIVILEGED_LOAD_FUNCTION(type, insn)			\
> -static inline type load_##type(const type *addr)			\
> -{									\
> -	type val;							\
> -	asm (#insn " %0, %1"						\
> -	: "=&r" (val) : "m" (*addr));					\
> -	return val;							\
> -}
> +static inline u8 load_u8(const u8 *addr)

Really a nit, and applies to the whole file: "static inline" in a .c
file is just useless.

> +{
> +	u8 val;
>  
> -#define DECLARE_UNPRIVILEGED_STORE_FUNCTION(type, insn)			\
> -static inline void store_##type(type *addr, type val)			\
> -{									\
> -	asm volatile (#insn " %0, %1\n"					\
> -	: : "r" (val), "m" (*addr));					\
> -}
> +	asm volatile("lbu %0, %1" : "=&r" (val) : "m" (*addr));

Why do you need early clobber here?


Björn

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ