[PATCH] D37788: [ARM] builtins: Do not abort in clear_cache.

Manoj Gupta via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 25 12:31:26 PDT 2017


manojgupta added a comment.

I patched a couple of kernels to print the return value of the syscall and tested a few cases.

Atleast on Linux kernels 3.14 and 3.18, the syscall returns -EFAULT whenever PROT_WRITE is not used in mprotect call.

The following is the implementation in kernel 3.14 (http://elixir.free-electrons.com/linux/v3.14.79/source/arch/arm/kernel/traps.c#L536 )

static inline int do_cache_op(unsigned long start, unsigned long end, int flags)
{
	if (end < start || flags)

  		return -EINVAL;

if (!access_ok(VERIFY_READ, start, end - start))

  		return -EFAULT; // -EFAULT is NOT returned from here. 

return __do_cache_op(start, end); // returns -EFAULT without PROT_WRITE
}

libgcc does't check the return value of the syscall, it just makes the syscall and returns. So does gforth's implementation. Are there any other implementations I should check?


https://reviews.llvm.org/D37788





More information about the llvm-commits mailing list