[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ee205448-5fdd-495e-9d7c-c8a2b59f9c9e@roeck-us.net>
Date: Sun, 22 Sep 2024 15:31:38 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: Alistair Popple <apopple@...dia.com>, x86@...nel.org,
Dan Williams <dan.j.williams@...el.com>,
dave.hansen@...ux.intel.com, luto@...nel.org, peterz@...radead.org,
max8rr8@...il.com, linux-kernel@...r.kernel.org,
jhubbard@...dia.com, Kees Cook <keescook@...omium.org>,
Andrew Morton <akpm@...uxfoundation.org>,
David Hildenbrand <david@...hat.com>,
Oscar Salvador <osalvador@...e.de>, linux-mm@...ck.org
Subject: Re: x86/kaslr: Expose and use the end of the physical memory address
space
On Wed, Aug 14, 2024 at 12:29:36AM +0200, Thomas Gleixner wrote:
> iounmap() on x86 occasionally fails to unmap because the provided valid
> ioremap address is not below high_memory. It turned out that this
> happens due to KASLR.
>
[ ... ]
>
> --- a/kernel/resource.c
> +++ b/kernel/resource.c
> @@ -1826,8 +1826,7 @@ static resource_size_t gfr_start(struct
> if (flags & GFR_DESCENDING) {
> resource_size_t end;
>
> - end = min_t(resource_size_t, base->end,
> - (1ULL << MAX_PHYSMEM_BITS) - 1);
> + end = min_t(resource_size_t, base->end, PHYSMEM_END);
> return end - size + 1;
> }
When trying to build arm:allmodconfig or mips:allmodconfig (and probably
others):
Building arm:allmodconfig ... failed
--------------
Error log:
In file included from include/linux/ioport.h:15,
from kernel/resource.c:15:
kernel/resource.c: In function 'gfr_start':
include/linux/minmax.h:93:37: error: conversion from 'long long unsigned int' to 'resource_size_t' {aka 'unsigned int'} changes value from '18446744073709551615' to '4294967295' [-Werror=overflow]
93 | ({ type ux = (x); type uy = (y); __cmp(op, ux, uy); })
| ^
include/linux/minmax.h:96:9: note: in expansion of macro '__cmp_once_unique'
96 | __cmp_once_unique(op, type, x, y, __UNIQUE_ID(x_), __UNIQUE_ID(y_))
| ^~~~~~~~~~~~~~~~~
include/linux/minmax.h:213:27: note: in expansion of macro '__cmp_once'
213 | #define min_t(type, x, y) __cmp_once(min, type, x, y)
| ^~~~~~~~~~
kernel/resource.c:1874:23: note: in expansion of macro 'min_t'
1874 | end = min_t(resource_size_t, base->end, PHYSMEM_END);
| ^~~~~
kernel/resource.c: In function 'gfr_continue':
include/linux/minmax.h:93:37: error: conversion from 'long long unsigned int' to 'resource_size_t' {aka 'unsigned int'} changes value from '18446744073709551615' to '4294967295' [-Werror=overflow]
93 | ({ type ux = (x); type uy = (y); __cmp(op, ux, uy); })
| ^
include/linux/minmax.h:96:9: note: in expansion of macro '__cmp_once_unique'
96 | __cmp_once_unique(op, type, x, y, __UNIQUE_ID(x_), __UNIQUE_ID(y_))
| ^~~~~~~~~~~~~~~~~
include/linux/minmax.h:213:27: note: in expansion of macro '__cmp_once'
213 | #define min_t(type, x, y) __cmp_once(min, type, x, y)
| ^~~~~~~~~~
kernel/resource.c:1891:24: note: in expansion of macro 'min_t'
1891 | addr <= min_t(resource_size_t, base->end, PHYSMEM_END);
| ^~~~~
Guenter
Powered by blists - more mailing lists