Re: [PATCH 2/2] arm64: add KASan support

2015-04-17 Thread David Keitel
On 04/15/2015 11:04 AM, Andrey Ryabinin wrote:
> I've pushed the most fresh thing that I have in git:
>   git://github.com/aryabinin/linux.git kasan/arm64v1
> 
> It's the same patches with two simple but important fixes on top of it.

Thanks, the two commits do fix compilation issues that I've had worked around 
to get to my mapping question.

I've addressed the mapping problem using __create_page_tables in 
arch/arm64/head.S as an example.

The next roadblock I hit was running into kasan_report_error calls in 
cgroups_early_init. After a short investigation it does seem to be a false 
positive due the the kasan_zero_page size and tracking bytes being reused for 
different memory regions.

I worked around that by enabling kasan error reporting only after the 
kasan_init is run. This let me get to the shell with some real KAsan reports 
along the way. There were some other fixes and hacks to get there. I'll 
backtrack to evaluate which ones warrant an RFC.

 - David

-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] arm64: add KASan support

2015-04-17 Thread David Keitel
On 04/15/2015 11:04 AM, Andrey Ryabinin wrote:
 I've pushed the most fresh thing that I have in git:
   git://github.com/aryabinin/linux.git kasan/arm64v1
 
 It's the same patches with two simple but important fixes on top of it.

Thanks, the two commits do fix compilation issues that I've had worked around 
to get to my mapping question.

I've addressed the mapping problem using __create_page_tables in 
arch/arm64/head.S as an example.

The next roadblock I hit was running into kasan_report_error calls in 
cgroups_early_init. After a short investigation it does seem to be a false 
positive due the the kasan_zero_page size and tracking bytes being reused for 
different memory regions.

I worked around that by enabling kasan error reporting only after the 
kasan_init is run. This let me get to the shell with some real KAsan reports 
along the way. There were some other fixes and hacks to get there. I'll 
backtrack to evaluate which ones warrant an RFC.

 - David

-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] arm64: add KASan support

2015-04-14 Thread David Keitel
>>> +   pgd = __pgd(__pa(kasan_zero_pmd) | PAGE_KERNEL);
>>> +#else
>>> +   pgd = __pgd(__pa(kasan_zero_pte) | PAGE_KERNEL);
>>> +#endif
>>> +
>>> +   for (i = pgd_index(start); start < end; i++) {
>>> +   set_pgd([i], pgd);
>>> +   start += PGDIR_SIZE;
>>> +   }
>>> +}
>>
>> Same problem as above with PAGE_KERNEL. You should just use
>> pgd_populate().

Any suggestion what the correct flag setting would be here for a 4K mapping?

I tried fixing this by changing this to pud and setting the PMD_TYPE_TABLE flag 
for kasan_zero_pmd. However the MMU doesn't like it and I get a first level 
address translation fault.

If you have any updated patches to share I'd be glad to try them out.

-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] arm64: add KASan support

2015-04-14 Thread David Keitel
 +   pgd = __pgd(__pa(kasan_zero_pmd) | PAGE_KERNEL);
 +#else
 +   pgd = __pgd(__pa(kasan_zero_pte) | PAGE_KERNEL);
 +#endif
 +
 +   for (i = pgd_index(start); start  end; i++) {
 +   set_pgd(pgdp[i], pgd);
 +   start += PGDIR_SIZE;
 +   }
 +}

 Same problem as above with PAGE_KERNEL. You should just use
 pgd_populate().

Any suggestion what the correct flag setting would be here for a 4K mapping?

I tried fixing this by changing this to pud and setting the PMD_TYPE_TABLE flag 
for kasan_zero_pmd. However the MMU doesn't like it and I get a first level 
address translation fault.

If you have any updated patches to share I'd be glad to try them out.

-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/