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:	Thu, 14 Feb 2008 13:38:57 -0800 (PST)
From:	David Rientjes <rientjes@...gle.com>
To:	Paul Jackson <pj@....com>
cc:	akpm@...ux-foundation.org, clameter@....com,
	Lee.Schermerhorn@...com, ak@...e.de, linux-kernel@...r.kernel.org
Subject: Re: [patch 3/4] mempolicy: add MPOL_F_STATIC_NODES flag

On Thu, 14 Feb 2008, Paul Jackson wrote:

> In mempolicy.h, the lines:
> 
>     /*
>      * The lower MPOL_FLAG_SHIFT bits of the policy mode represent the MPOL_*
>      * constants defined in enum mempolicy_mode.  The upper bits represent
>      * optional set_mempolicy() MPOL_F_* mode flags.
>      */
>     #define MPOL_FLAG_SHIFT (8)
>     #define MPOL_MODE_MASK  ((1 << MPOL_FLAG_SHIFT) - 1)
> 
>     /* Flags for set_mempolicy */
>     #define MPOL_F_STATIC_NODES     (1 << MPOL_FLAG_SHIFT)
>     #define MPOL_MODE_FLAGS (MPOL_F_STATIC_NODES)   /* legal set_mempolicy() MPOL_* mode flags */
> 
> could be simplified, to:
> 
>     /*
>      * Optional flags that modify nodemask numbering.
>      */
>     #define MPOL_F_RELATIVE_NODES (1<<14)	/* remapped relative to cpuset */
>     #define MPOL_F_STATIC_NODES (1<<15)		/* unremapped physical masks */
>     #define MPOL_MODE_FLAGS (MPOL_F_RELATIVE_NODES|MPOL_F_STATIC_NODES)
>     						/* combined MPOL_F_* mask flags */
> 
> (really, that MPOL_FLAG_SHIFT is just unnecessary distracting detail.)
> 

It would be easy to define mpol_mode() and mpol_flags() in terms of 
MPOL_MODE_FLAGS as well, yes.  But without MPOL_FLAG_SHIFT it becomes 
impossible to determine whether a user passed an invalid flag.

I think we're all in agreement that passing an invalid flag bit should be 
rejected with -EINVAL.  So to do that we need MPOL_MODE_MASK to expicitly 
define the parts of the int *policy passed from set_mempolicy() that 
represent the mode.

		David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ