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]
Date:   Sun, 3 Oct 2021 02:48:14 +0000
From:   Al Viro <viro@...iv.linux.org.uk>
To:     Huacai Chen <chenhuacai@...ngson.cn>
Cc:     Arnd Bergmann <arnd@...db.de>, Andy Lutomirski <luto@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Peter Zijlstra <peterz@...radead.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        David Airlie <airlied@...ux.ie>,
        Jonathan Corbet <corbet@....net>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        linux-arch@...r.kernel.org, linux-doc@...r.kernel.org,
        linux-kernel@...r.kernel.org, Xuefeng Li <lixuefeng@...ngson.cn>,
        Yanteng Si <siyanteng@...ngson.cn>,
        Huacai Chen <chenhuacai@...il.com>,
        Jiaxun Yang <jiaxun.yang@...goat.com>
Subject: Re: [PATCH V4 11/22] LoongArch: Add process management

On Mon, Sep 27, 2021 at 02:42:48PM +0800, Huacai Chen wrote:

> +/*
> + * Does the process account for user or for system time?
> + */
> +#define user_mode(regs) (((regs)->csr_prmd & PLV_MASK) == PLV_USER)
> +
> +static inline int is_syscall_success(struct pt_regs *regs)
> +{
> +	return !regs->regs[7];
> +}
>
> +static inline long regs_return_value(struct pt_regs *regs)
> +{
> +	if (is_syscall_success(regs) || !user_mode(regs))
> +		return regs->regs[4];
> +	else
> +		return -regs->regs[4];
> +}

Huh???  That looks like you've copied those from MIPS, but on MIPS we have
things like
        li      t0, -EMAXERRNO - 1      # error?
        sltu    t0, t0, v0
        sd      t0, PT_R7(sp)           # set error flag
        beqz    t0, 1f

        ld      t1, PT_R2(sp)           # syscall number
        dnegu   v0                      # error
        sd      t1, PT_R0(sp)           # save it for syscall restarting
1:      sd      v0, PT_R2(sp)           # result
right after the call of sys_...(), along with the restart logics
looking like
        if (regs->regs[0]) {
                switch(regs->regs[2]) {
                case ERESTART_RESTARTBLOCK:
                case ERESTARTNOHAND:
IOW, syscall return values from -EMAXERRNO to -1 are negated, with
regs[7] set accordingly.  Nothing of that sort is done in your
patchset after syscall, and if it had been, your restart logics in
signal handling would've been wrong anyway.

What's going on there?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ