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

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

 



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.

> +	untagged_addr = reset_tag((void *)addr);

Likewise for reset_tag().

> +	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 *.

> +
> +	for (shadow = shadow_first; shadow <= shadow_last; shadow++) {
> +		if (*shadow != tag) {
> +			/* Report invalid-access bug here */
> +			return;

Huh? Should that be a TODO?

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