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: <ZRriIpYETsRdWZet@memverge.com>
Date:   Mon, 2 Oct 2023 11:30:42 -0400
From:   Gregory Price <gregory.price@...verge.com>
To:     Jonathan Cameron <Jonathan.Cameron@...wei.com>
Cc:     Gregory Price <gourry.memverge@...il.com>,
        linux-mm@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-arch@...r.kernel.org, linux-api@...r.kernel.org,
        linux-cxl@...r.kernel.org, luto@...nel.org, tglx@...utronix.de,
        mingo@...hat.com, bp@...en8.de, dave.hansen@...ux.intel.com,
        hpa@...or.com, arnd@...db.de, akpm@...ux-foundation.org,
        x86@...nel.org
Subject: Re: [RFC PATCH 2/3] mm/mempolicy: Implement set_mempolicy2 and
 get_mempolicy2 syscalls

On Mon, Oct 02, 2023 at 02:30:08PM +0100, Jonathan Cameron wrote:
> On Thu, 14 Sep 2023 19:54:56 -0400
> Gregory Price <gourry.memverge@...il.com> wrote:
> 
> > diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h
> > index abe087c53b4b..397dcf804941 100644
> > --- a/include/uapi/asm-generic/unistd.h
> > +++ b/include/uapi/asm-generic/unistd.h
> > ...
> >  #undef __NR_syscalls
> > -#define __NR_syscalls 453
> > +#define __NR_syscalls 456
> +3 for 2 additions?
> 

When i'd originally written this, there was a partially merged syscall
colliding with 453, and this hadn't been incremented yet.  Did a quick
grep and it seems like that might have been reverted, so yeah this would
drop down to 453/454 & __NR=455.

> > +	/* Legacy modes are routed through the legacy interface */
> > +	if (kargs->mode <= MPOL_LEGACY)
> > +		return false;
> > +
> > +	if (kargs->mode >= MPOL_MAX)
> > +		return false;
> > +
> > +	return true;
> 
> This is a range check, so I think equally clear (and shorter) as..
> 	/* Legacy modes are routed through the legacy interface */
> 	return kargs->mode > MPOL_LEGACY && kargs->mode < MPOL_MAX;
>

I'll combine the range, but i left the two true/false conditions
separate because it's intended that follow on patches will add logic
before true is returned.

> > +		kargs->get.allowed.err = err ? err : 0;
> > +		kargs->err |= err ? err : 1;
> 		if (err) {
> 			kargs->get.allowed.err = err;
> 			kargs->err |= err;
> 		} else {
> 			kargs->get.allowed.err = 0;
> 			kargs->err = 1;
> 	Not particularly obvious why 1 and if you get an error later it's going to be messy
>         as will 1 |= err_code

My original intent was to just allow each section to error separately,
but honestly this seems overly complicated and somewhat against the
design of almost every other syscall, so i'm going to rip all these
error code spaces out and instead just have everything return on error.

Thanks!
Gregory

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ