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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1509645252.31043.91.camel@perches.com>
Date:   Thu, 02 Nov 2017 10:54:12 -0700
From:   Joe Perches <joe@...ches.com>
To:     Roman Gushchin <guro@...com>, netdev@...r.kernel.org
Cc:     Tejun Heo <tj@...nel.org>, Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        linux-kernel@...r.kernel.org, kernel-team@...com,
        "David S . Miller" <davem@...emloft.net>
Subject: Re: [PATCH v3 net-next 1/5] device_cgroup: add DEVCG_ prefix to
 ACC_* and DEV_* constants

On Thu, 2017-11-02 at 13:15 -0400, Roman Gushchin wrote:
> Rename device type and access type constants defined in
> security/device_cgroup.c by adding the DEVCG_ prefix.
> 
> The reason behind this renaming is to make them global namespace
> friendly, as they will be moved to the corresponding header file
> by following patches.
[]
> diff --git a/security/device_cgroup.c b/security/device_cgroup.c
[]
> @@ -14,14 +14,14 @@
>  #include <linux/rcupdate.h>
>  #include <linux/mutex.h>
>  
> -#define ACC_MKNOD 1
> -#define ACC_READ  2
> -#define ACC_WRITE 4
> -#define ACC_MASK (ACC_MKNOD | ACC_READ | ACC_WRITE)
> +#define DEVCG_ACC_MKNOD 1
> +#define DEVCG_ACC_READ  2
> +#define DEVCG_ACC_WRITE 4
> +#define DEVCG_ACC_MASK (DEVCG_ACC_MKNOD | DEVCG_ACC_READ | DEVCG_ACC_WRITE)

trivia:

major and minor are u32 but all the
type and access uses seem to be "short"

Perhaps u16 (or __u16 if uapi public) instead?

> -#define DEV_BLOCK 1
> -#define DEV_CHAR  2
> -#define DEV_ALL   4  /* this represents all devices */
> +#define DEVCG_DEV_BLOCK 1
> +#define DEVCG_DEV_CHAR  2
> +#define DEVCG_DEV_ALL   4  /* this represents all devices */
>  
>  static DEFINE_MUTEX(devcgroup_mutex);
>  
> @@ -245,21 +245,21 @@ static void set_access(char *acc, short access)
>  {
>  	int idx = 0;
>  	memset(acc, 0, ACCLEN);
> -	if (access & ACC_READ)
> +	if (access & DEVCG_ACC_READ)
>  		acc[idx++] = 'r';
> -	if (access & ACC_WRITE)
> +	if (access & DEVCG_ACC_WRITE)
>  		acc[idx++] = 'w';
> -	if (access & ACC_MKNOD)
> +	if (access & DEVCG_ACC_MKNOD)
>  		acc[idx++] = 'm';
>  }
>  
>  static char type_to_char(short type)
>  {
> -	if (type == DEV_ALL)
> +	if (type == DEVCG_DEV_ALL)
>  		return 'a';
> -	if (type == DEV_CHAR)
> +	if (type == DEVCG_DEV_CHAR)
>  		return 'c';
> -	if (type == DEV_BLOCK)
> +	if (type == DEVCG_DEV_BLOCK)
>  		return 'b';
>  	return 'X';
>  }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ