RE: [PATCH v4 7/7] ACPI / x86: introduce acpi_os_readable() support

From: Chen, Yu C
Date: Tue Dec 15 2015 - 01:13:34 EST


Hi, Andy

> -----Original Message-----
> From: Andy Lutomirski [mailto:luto@xxxxxxxxxxxxxx]
> Sent: Tuesday, December 15, 2015 7:28 AM
> To: Zheng, Lv
> Cc: Wysocki, Rafael J; Brown, Len; Andy Lutomirski; Lv Zheng; linux-
> kernel@xxxxxxxxxxxxxxx; Linux ACPI; Chen, Yu C
> Subject: Re: [PATCH v4 7/7] ACPI / x86: introduce acpi_os_readable() support
>
> On Wed, Dec 2, 2015 at 6:43 PM, Lv Zheng <lv.zheng@xxxxxxxxx> wrote:
> > From: Chen Yu <yu.c.chen@xxxxxxxxx>
> >
> > This patch implements acpi_os_readable(). The function is used by
> > ACPICA AML debugger to validate user specified pointers for dumping
> > the memory as ACPICA descriptor objects.
> >
[cut]
> >
> > +bool __acpi_memory_readable(void *pointer, size_t length) {
> > + unsigned long obj_start, obj_end;
> > + unsigned long start_pfn, end_pfn;
>
> What does "readable" mean in this context?
'readable' means : the address provided by the user,
is a dynamically allocated virtual address -
because the acpi address space are allocated by 'kmalloc',
acpi debugger must check if this address is a valid 'kmalloc'
address before accessing it.

This function does the sanity check that, the vitual address is a:
1. dynamically allocated address (beyond PAGE_OFFSET , but lower
than high_memory, VMALLOC_START, eg)
2. besides, the physical address must be direct-mapped(so it would not be a hole).

Thanks,
yu

N‹§²æ¸›yú²X¬¶ÇvØ–)Þ{.nlj·¥Š{±‘êX§¶›¡Ü}©ž²ÆzÚj:+v‰¨¾«‘êZ+€Êzf£¢·hšˆ§~†­†Ûÿû®w¥¢¸?™¨è&¢)ßf”ùy§m…á«a¶Úÿ 0¶ìå