Re: [RFC PATCH 09/14] khwasan: add hooks implementation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 5, 2018 at 3:44 PM, Mark Rutland <mark.rutland@xxxxxxx> wrote:
> On Fri, Mar 02, 2018 at 08:44:28PM +0100, Andrey Konovalov wrote:
>>  void check_memory_region(unsigned long addr, size_t size, bool write,
>>                               unsigned long ret_ip)
>>  {
>> +     u8 tag;
>> +     u8 *shadow_first, *shadow_last, *shadow;
>> +     void *untagged_addr;
>> +
>> +     tag = get_tag((void *)addr);
>
> Please make get_tag() take a const void *, then this cast can go.

Will do in v2.

>
>> +     untagged_addr = reset_tag((void *)addr);
>
> Likewise for reset_tag().

Ack.

>
>> +     shadow_first = (u8 *)kasan_mem_to_shadow(untagged_addr);
>> +     shadow_last = (u8 *)kasan_mem_to_shadow(untagged_addr + size - 1);
>
> I don't think these u8 * casts are necessary, since
> kasan_mem_to_shadow() returns a void *.

Ack.

>
>> +
>> +     for (shadow = shadow_first; shadow <= shadow_last; shadow++) {
>> +             if (*shadow != tag) {
>> +                     /* Report invalid-access bug here */
>> +                     return;
>
> Huh? Should that be a TODO?

This is fixed in one of the next commits. I decided to split the main
runtime logic and the reporting parts, so this comment is a
placeholder, which is replaced with the proper error reporting
function call later in the patch series. I can make it a /* TODO:
comment */, if you think that looks better.

>
> Thanks,
> Mark.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux