Skip to content

Instantly share code, notes, and snippets.

@agentzh
Created May 13, 2023 05:32
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save agentzh/948f77381c1f1e2cb7474c22c2c17c0e to your computer and use it in GitHub Desktop.
diff --git a/runtime/linux/addr-map.c b/runtime/linux/addr-map.c
index 1cca14220..c5ab668ea 100644
--- a/runtime/linux/addr-map.c
+++ b/runtime/linux/addr-map.c
@@ -53,20 +53,9 @@ lookup_bad_addr_user(const int type, const unsigned long addr, const size_t size
* a kernel warning). If we aren't in task context, we'll just do a
* range check.
*/
-#if !defined(in_task)
if (size == 0 || ULONG_MAX - addr < size - 1
|| !stp_access_ok(type, (void *)addr, size))
return 1;
-#else
- if (size == 0 || ULONG_MAX - addr < size - 1
- || (in_task() && !stp_access_ok(type, (void *)addr, size))
- || (!in_task()
-#if defined(user_addr_max)
- && ((user_addr_max() - size) < addr)
-#endif
- ))
- return 1;
-#endif
#if ! STP_PRIVILEGE_CONTAINS (STP_PRIVILEGE, STP_PR_STAPDEV) && \
! STP_PRIVILEGE_CONTAINS (STP_PRIVILEGE, STP_PR_STAPSYS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment