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: <881c1f7e-6740-478d-2512-11a5a99563ec@amd.com>
Date:   Wed, 19 Apr 2023 10:30:35 +0200
From:   Christian König <christian.koenig@....com>
To:     Nico Pache <npache@...hat.com>, linux-kernel@...r.kernel.org,
        dri-devel@...ts.freedesktop.org
Cc:     matthew.auld@...el.com, arunpravin.paneerselvam@....com,
        arthurgrillo@...eup.net, davidgow@...gle.com, javierm@...hat.com,
        mairacanal@...eup.net, daniel@...ll.ch, airlied@...il.com,
        ddutile@...hat.com, kunit-dev@...glegroups.com
Subject: Re: [PATCH] kunit: drm: make DRM buddy test compatible with other
 pages sizes

Am 18.04.23 um 19:15 schrieb Nico Pache:
> The DRM buddy test uses a fixed 12 bit shift to covert from pages to
> bytes. This number is then used to confirm that (chunk_size < PAGE_SIZE)
> which can lead to a failing drm_buddy_init on systems with PAGE_SIZE > 4k.

Since the buddy allocator is used for resources which are independent of 
the CPU PAGE size the later check is actually the broken one.

E.g. neither in the buddy allocator nor in it's test cases we should 
have any of PAGE_SHIFT or PAGE_SIZE.

Otherwise the allocator wouldn't work correctly on systems with a 
PAGE_SIZE different than 4k.

Regards,
Christian.

>
> Fixes: 92937f170d3f ("drm/selftests: add drm buddy alloc range testcase")
> Signed-off-by: Nico Pache <npache@...hat.com>
> ---
>   drivers/gpu/drm/tests/drm_buddy_test.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/tests/drm_buddy_test.c b/drivers/gpu/drm/tests/drm_buddy_test.c
> index 09ee6f6af896..a62b2690d3c2 100644
> --- a/drivers/gpu/drm/tests/drm_buddy_test.c
> +++ b/drivers/gpu/drm/tests/drm_buddy_test.c
> @@ -318,8 +318,8 @@ static void mm_config(u64 *size, u64 *chunk_size)
>   	s &= -ms;
>   
>   	/* Convert from pages to bytes */
> -	*chunk_size = (u64)ms << 12;
> -	*size = (u64)s << 12;
> +	*chunk_size = (u64)ms << PAGE_SHIFT;
> +	*size = (u64)s << PAGE_SHIFT;
>   }
>   
>   static void drm_test_buddy_alloc_pathological(struct kunit *test)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ