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: <20200909092401.GA1431678@sol>
Date:   Wed, 9 Sep 2020 17:24:01 +0800
From:   Kent Gibson <warthog618@...il.com>
To:     linux-kernel@...r.kernel.org, linux-gpio@...r.kernel.org,
        bgolaszewski@...libre.com, linus.walleij@...aro.org
Subject: Re: [PATCH v7 07/20] gpiolib: cdev: support GPIO_V2_GET_LINE_IOCTL
 and GPIO_V2_LINE_GET_VALUES_IOCTL

On Sat, Sep 05, 2020 at 09:35:36PM +0800, Kent Gibson wrote:
> Add support for requesting lines using the GPIO_V2_GET_LINE_IOCTL, and
> returning their current values using GPIO_V2_LINE_GET_VALUES_IOCTL.
> 
> The struct linereq implementation is based on the v1 struct linehandle
> implementation.
> 
> Signed-off-by: Kent Gibson <warthog618@...il.com>
> ---
> 

[snip]

>  		if (copy_from_user(&offset, ip, sizeof(offset)))
>  			return -EFAULT;
> @@ -1104,6 +1505,25 @@ int gpiolib_cdev_register(struct gpio_device *gdev, dev_t devt)
>  		 MAJOR(devt), gdev->id);
>  
>  	return 0;
> +	/*
> +	 * array sizes must ensure 64-bit alignment and not create holes in
> +	 * the struct packing.
> +	 */
> +	BUILD_BUG_ON(IS_ALIGNED(GPIO_V2_LINES_MAX, 2));
> +	BUILD_BUG_ON(IS_ALIGNED(GPIO_MAX_NAME_SIZE, 8));
> +
> +	/*
> +	 * check that uAPI structs are 64-bit aligned for 32/64-bit
> +	 * compatibility
> +	 */
> +	BUILD_BUG_ON(IS_ALIGNED(sizeof(struct gpio_v2_line_attribute), 8));
> +	BUILD_BUG_ON(IS_ALIGNED(sizeof(struct gpio_v2_line_config_attribute), 8));
> +	BUILD_BUG_ON(IS_ALIGNED(sizeof(struct gpio_v2_line_config), 8));
> +	BUILD_BUG_ON(IS_ALIGNED(sizeof(struct gpio_v2_line_request), 8));
> +	BUILD_BUG_ON(IS_ALIGNED(sizeof(struct gpio_v2_line_info), 8));
> +	BUILD_BUG_ON(IS_ALIGNED(sizeof(struct gpio_v2_line_info_changed), 8));
> +	BUILD_BUG_ON(IS_ALIGNED(sizeof(struct gpio_v2_line_event), 8));
> +	BUILD_BUG_ON(IS_ALIGNED(sizeof(struct gpio_v2_line_values), 8));
>  }
>  

A couple of things here - these should all be !IS_ALIGNED.
And the BUILD_BUG_ON gets compiled out, and so doesn't fail, if they are
after the return.

How would you like that fixed - v8 or a patch once v7 is in?

Cheers,
Kent.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ