diff --git a/.github/workflows/ci-aarchxx.yml b/.github/workflows/ci-aarchxx.yml index 2c5d396bc..bed902b6e 100644 --- a/.github/workflows/ci-aarchxx.yml +++ b/.github/workflows/ci-aarchxx.yml @@ -1,5 +1,5 @@ # ********************************************************** -# Copyright (c) 2020-2022 Google, Inc. All rights reserved. +# Copyright (c) 2020-2024 Google, Inc. All rights reserved. # ********************************************************** # Dr. Memory: the memory debugger @@ -66,13 +66,14 @@ jobs: sudo apt-get -y install doxygen jsonlint \ g++-arm-linux-gnueabihf g++-aarch64-linux-gnu sudo add-apt-repository 'deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports focal main' + apt download libunwind8:armhf libunwind-dev:armhf liblzma5:armhf \ + zlib1g:armhf zlib1g-dev:armhf mkdir ../extract - pushd ../extract - apt download libunwind8:armhf libunwind-dev:armhf liblzma5:armhf - for i in *.deb; do dpkg-deb -x $i .; done - for i in include lib; do sudo rsync -av ./usr/${i}/arm-linux-gnueabihf/ /usr/arm-linux-gnueabihf/${i}/; done - sudo rsync -av ./lib/arm-linux-gnueabihf/ /usr/arm-linux-gnueabihf/lib/ - popd + for i in *.deb; do dpkg-deb -x $i ../extract; done + for i in include lib; do sudo rsync -av ../extract/usr/${i}/arm-linux-gnueabihf/ /usr/arm-linux-gnueabihf/${i}/; done + sudo rsync -av ../extract/usr/include/ /usr/arm-linux-gnueabihf/include/ + sudo rsync -av ../extract/lib/arm-linux-gnueabihf/ /usr/arm-linux-gnueabihf/lib/ + rm *.deb - name: Run Suite working-directory: ${{ github.workspace }} diff --git a/.github/workflows/ci-clang.yml b/.github/workflows/ci-clang.yml index 0c6cb0ff6..ee5e6d8b7 100644 --- a/.github/workflows/ci-clang.yml +++ b/.github/workflows/ci-clang.yml @@ -1,5 +1,5 @@ # ********************************************************** -# Copyright (c) 2020-2021 Google, Inc. All rights reserved. +# Copyright (c) 2020-2024 Google, Inc. All rights reserved. # ********************************************************** # Dr. Memory: the memory debugger @@ -63,16 +63,21 @@ jobs: - name: Create Build Environment run: | sudo apt-get update - sudo apt-get -y install doxygen jsonlint g++-multilib libunwind-dev + sudo apt-get -y install doxygen jsonlint g++-multilib libunwind-dev \ + zlib1g zlib1g-dev sudo add-apt-repository 'deb [arch=i386] http://us.archive.ubuntu.com/ubuntu focal main' + apt download libunwind8:i386 libunwind-dev:i386 liblzma5:i386 \ + zlib1g:i386 zlib1g-dev:i386 mkdir ../extract - pushd ../extract - apt download libunwind8:i386 libunwind-dev:i386 liblzma5:i386 - for i in *.deb; do dpkg-deb -x $i .; done - sudo rsync -av ./usr/lib/i386-linux-gnu/ /lib32/ - sudo rsync -av ./lib/i386-linux-gnu/ /lib32/ - sudo rsync -av ./usr/include/i386-linux-gnu/ /usr/include/ - popd + for i in *.deb; do dpkg-deb -x $i ../extract; done + # find_package(ZLIB) doesn't find /lib32, yet ld.so seems to need lib32, + # so we do both: + sudo rsync -av ../extract/usr/lib/i386-linux-gnu/ /usr/lib/i386-linux-gnu/ + sudo rsync -av ../extract/lib/i386-linux-gnu/ /usr/lib/i386-linux-gnu/ + sudo rsync -av ../extract/usr/lib/i386-linux-gnu/ /lib32/ + sudo rsync -av ../extract/lib/i386-linux-gnu/ /lib32/ + sudo rsync -av ../extract/usr/include/i386-linux-gnu/ /usr/include/ + rm *.deb # Downgrade from cmake 3.20 to avoid 32-bit toolchain problems (DRi#4830). - name: Downgrade cmake diff --git a/.github/workflows/ci-docs.yml b/.github/workflows/ci-docs.yml index 9bc82c9b2..d48ff8ceb 100644 --- a/.github/workflows/ci-docs.yml +++ b/.github/workflows/ci-docs.yml @@ -1,5 +1,5 @@ # ********************************************************** -# Copyright (c) 2020-2021 Google, Inc. All rights reserved. +# Copyright (c) 2020-2024 Google, Inc. All rights reserved. # ********************************************************** # Dr. Memory: the memory debugger @@ -64,7 +64,7 @@ jobs: - name: Create Build Environment run: | sudo apt-get update - sudo apt-get -y install doxygen jsonlint libunwind-dev + sudo apt-get -y install doxygen jsonlint libunwind-dev zlib1g zlib1g-dev - name: Get Version id: version diff --git a/.github/workflows/ci-package.yml b/.github/workflows/ci-package.yml index 1c5a2020c..1a665061a 100644 --- a/.github/workflows/ci-package.yml +++ b/.github/workflows/ci-package.yml @@ -1,5 +1,5 @@ # ********************************************************** -# Copyright (c) 2020-2023 Google, Inc. All rights reserved. +# Copyright (c) 2020-2024 Google, Inc. All rights reserved. # ********************************************************** # Dr. Memory: the memory debugger @@ -62,16 +62,21 @@ jobs: - name: Create Build Environment run: | sudo apt-get update - sudo apt-get -y install doxygen jsonlint g++-multilib libunwind-dev + sudo apt-get -y install doxygen jsonlint g++-multilib libunwind-dev \ + zlib1g zlib1g-dev sudo add-apt-repository 'deb [arch=i386] http://us.archive.ubuntu.com/ubuntu focal main' + apt download libunwind8:i386 libunwind-dev:i386 liblzma5:i386 \ + zlib1g:i386 zlib1g-dev:i386 mkdir ../extract - pushd ../extract - apt download libunwind8:i386 libunwind-dev:i386 liblzma5:i386 - for i in *.deb; do dpkg-deb -x $i .; done - sudo rsync -av ./usr/lib/i386-linux-gnu/ /lib32/ - sudo rsync -av ./lib/i386-linux-gnu/ /lib32/ - sudo rsync -av ./usr/include/i386-linux-gnu/ /usr/include/ - popd + for i in *.deb; do dpkg-deb -x $i ../extract; done + # find_package(ZLIB) doesn't find /lib32, yet ld.so seems to need lib32, + # so we do both: + sudo rsync -av ../extract/usr/lib/i386-linux-gnu/ /usr/lib/i386-linux-gnu/ + sudo rsync -av ../extract/lib/i386-linux-gnu/ /usr/lib/i386-linux-gnu/ + sudo rsync -av ../extract/usr/lib/i386-linux-gnu/ /lib32/ + sudo rsync -av ../extract/lib/i386-linux-gnu/ /lib32/ + sudo rsync -av ../extract/usr/include/i386-linux-gnu/ /usr/include/ + rm *.deb # Downgrade from cmake 3.20 to avoid 32-bit toolchain problems (DRi#4830). - name: Downgrade cmake diff --git a/.github/workflows/ci-x86.yml b/.github/workflows/ci-x86.yml index b047fa4d8..0bbf419fb 100644 --- a/.github/workflows/ci-x86.yml +++ b/.github/workflows/ci-x86.yml @@ -1,5 +1,5 @@ # ********************************************************** -# Copyright (c) 2020-2021 Google, Inc. All rights reserved. +# Copyright (c) 2020-2024 Google, Inc. All rights reserved. # ********************************************************** # Dr. Memory: the memory debugger @@ -68,16 +68,21 @@ jobs: - name: Create Build Environment run: | sudo apt-get update - sudo apt-get -y install doxygen jsonlint g++-multilib libunwind-dev + sudo apt-get -y install doxygen jsonlint g++-multilib libunwind-dev \ + zlib1g zlib1g-dev sudo add-apt-repository 'deb [arch=i386] http://us.archive.ubuntu.com/ubuntu focal main' + apt download libunwind8:i386 libunwind-dev:i386 liblzma5:i386 \ + zlib1g:i386 zlib1g-dev:i386 mkdir ../extract - pushd ../extract - apt download libunwind8:i386 libunwind-dev:i386 liblzma5:i386 - for i in *.deb; do dpkg-deb -x $i .; done - sudo rsync -av ./usr/lib/i386-linux-gnu/ /lib32/ - sudo rsync -av ./lib/i386-linux-gnu/ /lib32/ - sudo rsync -av ./usr/include/i386-linux-gnu/ /usr/include/ - popd + for i in *.deb; do dpkg-deb -x $i ../extract; done + # find_package(ZLIB) doesn't find /lib32, yet ld.so seems to need lib32, + # so we do both: + sudo rsync -av ../extract/usr/lib/i386-linux-gnu/ /usr/lib/i386-linux-gnu/ + sudo rsync -av ../extract/lib/i386-linux-gnu/ /usr/lib/i386-linux-gnu/ + sudo rsync -av ../extract/usr/lib/i386-linux-gnu/ /lib32/ + sudo rsync -av ../extract/lib/i386-linux-gnu/ /lib32/ + sudo rsync -av ../extract/usr/include/i386-linux-gnu/ /usr/include/ + rm *.deb # Downgrade from cmake 3.20 to avoid 32-bit toolchain problems (DRi#4830). - name: Downgrade cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index d3d46c010..b2fae8afb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ # ********************************************************** -# Copyright (c) 2010-2023 Google, Inc. All rights reserved. +# Copyright (c) 2010-2024 Google, Inc. All rights reserved. # Copyright (c) 2009-2010 VMware, Inc. All rights reserved. # ********************************************************** @@ -336,10 +336,12 @@ if (UNIX) "${CMAKE_EXE_LINKER_FLAGS} -fPIE -pie -Wl,--export-dynamic") endif () endif () - # TODO i#2485: Add DWARF-5 support. - CHECK_C_COMPILER_FLAG("-gdwarf-5" have_dwarf5) - if (have_dwarf5) - set(EXTRA_FLAGS "${EXTRA_FLAGS} -gdwarf-4") + if (APPLE) + # TODO i#2485: Add DWARF-5 support to Mac. + CHECK_C_COMPILER_FLAG("-gdwarf-5" have_dwarf5) + if (have_dwarf5) + set(EXTRA_FLAGS "${EXTRA_FLAGS} -gdwarf-4") + endif () endif () # We use C++11. set(EXTRA_CXXFLAGS "-std=c++11") diff --git a/common/alloc.c b/common/alloc.c index a83a3d35b..c3f0a3c10 100644 --- a/common/alloc.c +++ b/common/alloc.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2010-2021 Google, Inc. All rights reserved. + * Copyright (c) 2010-2024 Google, Inc. All rights reserved. * Copyright (c) 2008-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -138,7 +138,7 @@ set_brk(byte *new_val) #endif static void -alloc_hook(void *wrapcxt, INOUT void **user_data); +alloc_hook(void *wrapcxt, DR_PARAM_INOUT void **user_data); static void handle_alloc_post(void *wrapcxt, void *user_data); @@ -967,7 +967,7 @@ replace_realloc_size_app(void *p) } static void -replace_realloc_size_pre(void *wrapcxt, OUT void **user_data) +replace_realloc_size_pre(void *wrapcxt, DR_PARAM_OUT void **user_data) { cls_alloc_t *pt = (cls_alloc_t *) drmgr_get_cls_field(dr_get_current_drcontext(), cls_idx_alloc); @@ -1594,7 +1594,7 @@ modname_is_libc_or_libcpp(const char *modname) static bool distinguish_operator_by_decoding(routine_type_t generic_type, - routine_type_t *specific_type OUT, + routine_type_t *specific_type DR_PARAM_OUT, const char *name, const module_data_t *mod, size_t modoffs) { @@ -1691,7 +1691,7 @@ distinguish_operator_by_decoding(routine_type_t generic_type, */ static bool distinguish_operator_no_argtypes(routine_type_t generic_type, - routine_type_t *specific_type OUT, + routine_type_t *specific_type DR_PARAM_OUT, const char *name, const module_data_t *mod, size_t modoffs) { @@ -2588,10 +2588,10 @@ malloc_wrap__unintercept(app_pc pc, routine_type_t type, alloc_routine_entry_t * */ #ifdef WINDOWS -typedef size_t (__stdcall *rtl_size_func_t)(IN reg_t /*really HANDLE*/ Heap, - IN ULONG flags, - IN PVOID ptr); -typedef size_t (*dbg_size_func_t)(IN byte *pc, int blocktype); +typedef size_t (__stdcall *rtl_size_func_t)(DR_PARAM_IN reg_t /*really HANDLE*/ Heap, + DR_PARAM_IN ULONG flags, + DR_PARAM_IN PVOID ptr); +typedef size_t (*dbg_size_func_t)(DR_PARAM_IN byte *pc, int blocktype); #else /* points at libc's version, used in initial heap walk */ alloc_size_func_t libc_malloc_usable_size; @@ -2944,7 +2944,7 @@ malloc_entry_redzone_size(malloc_entry_t *e) } static void -malloc_entry_to_info(malloc_entry_t *e, malloc_info_t *info OUT) +malloc_entry_to_info(malloc_entry_t *e, malloc_info_t *info DR_PARAM_OUT) { info->struct_size = sizeof(*info); info->base = e->start; @@ -6391,23 +6391,23 @@ handle_userinfo_pre(void *drcontext, cls_alloc_t *pt, void *wrapcxt, /* 3 related routines here: * BOOLEAN NTAPI * RtlGetUserInfoHeap( - * IN PVOID HeapHandle, - * IN ULONG Flags, - * IN PVOID BaseAddress, - * OUT PVOID *UserValue, - * OUT PULONG UserFlags); + * DR_PARAM_IN PVOID HeapHandle, + * DR_PARAM_IN ULONG Flags, + * DR_PARAM_IN PVOID BaseAddress, + * DR_PARAM_OUT PVOID *UserValue, + * DR_PARAM_OUT PULONG UserFlags); * BOOLEAN NTAPI * RtlSetUserValueHeap( - * IN PVOID HeapHandle, - * IN ULONG Flags, - * IN PVOID BaseAddress, - * IN PVOID UserValue); + * DR_PARAM_IN PVOID HeapHandle, + * DR_PARAM_IN ULONG Flags, + * DR_PARAM_IN PVOID BaseAddress, + * DR_PARAM_IN PVOID UserValue); * BOOLEAN NTAPI * RtlSetUserFlagsHeap( - * IN PVOID HeapHandle, - * IN ULONG Flags, - * IN PVOID BaseAddress, - * IN ULONG UserFlags); + * DR_PARAM_IN PVOID HeapHandle, + * DR_PARAM_IN ULONG Flags, + * DR_PARAM_IN PVOID BaseAddress, + * DR_PARAM_IN ULONG UserFlags); */ app_pc base = (app_pc) drwrap_get_arg(wrapcxt, 2); if (malloc_is_native(base, pt, true)) @@ -6526,7 +6526,7 @@ handle_alloc_pre_ex(void *drcontext, cls_alloc_t *pt, void *wrapcxt, alloc_routine_entry_t *routine); static void -alloc_hook(void *wrapcxt, INOUT void **user_data) +alloc_hook(void *wrapcxt, DR_PARAM_INOUT void **user_data) { app_pc pc = drwrap_get_func(wrapcxt); /* XXX: for -conservative we should do a lookup and not trust *user_data @@ -6957,7 +6957,7 @@ malloc_large_remove(byte *start) } bool -malloc_large_lookup(byte *addr, byte **start OUT, size_t *size OUT) +malloc_large_lookup(byte *addr, byte **start DR_PARAM_OUT, size_t *size DR_PARAM_OUT) { bool res = false; rb_node_t *node; diff --git a/common/alloc.h b/common/alloc.h index 96eb8d7db..60af96d1e 100644 --- a/common/alloc.h +++ b/common/alloc.h @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2010-2020 Google, Inc. All rights reserved. + * Copyright (c) 2010-2024 Google, Inc. All rights reserved. * Copyright (c) 2008-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -194,7 +194,7 @@ malloc_add(app_pc start, app_pc end, app_pc real_end, /* Looks up mallocs in the "large malloc table" (for mallocs used as stacks) */ bool -malloc_large_lookup(byte *addr, byte **start OUT, size_t *size OUT); +malloc_large_lookup(byte *addr, byte **start DR_PARAM_OUT, size_t *size DR_PARAM_OUT); bool malloc_is_pre_us_ex(app_pc start, bool ok_if_invalid); @@ -275,17 +275,17 @@ alloc_replace_in_cur_arena(byte *addr); /* overlap check includes redzone */ bool alloc_replace_overlaps_delayed_free(byte *start, byte *end, - malloc_info_t *info INOUT); + malloc_info_t *info DR_PARAM_INOUT); /* overlap check includes redzone */ bool alloc_replace_overlaps_any_free(byte *start, byte *end, - malloc_info_t *info INOUT); + malloc_info_t *info DR_PARAM_INOUT); /* overlap check includes redzone */ bool alloc_replace_overlaps_malloc(byte *start, byte *end, - malloc_info_t *info INOUT); + malloc_info_t *info DR_PARAM_INOUT); /* Allocate application memory for clients. * This function can only be used with -replace_malloc and @@ -379,7 +379,7 @@ client_handle_realloc_null(app_pc pc, dr_mcontext_t *mc); * For wrapping: * Up to the caller to delay, via its return value. * Returns the value to pass to free(). Return "tofree" for no change. - * The Windows heap param is INOUT so it can be changed as well. + * The Windows heap param is DR_PARAM_INOUT so it can be changed as well. * client_data is from client_add_malloc_routine(). * For replacing: * The return value is ignored. Frees are always delayed, unless @@ -394,7 +394,7 @@ client_handle_realloc_null(app_pc pc, dr_mcontext_t *mc); app_pc client_handle_free(malloc_info_t *info, byte *tofree, dr_mcontext_t *mc, app_pc free_routine, void *routine_set_data, bool for_reuse - _IF_WINDOWS(ptr_int_t *auxarg INOUT)); + _IF_WINDOWS(ptr_int_t *auxarg DR_PARAM_INOUT)); /* For wrapping: * Never called. diff --git a/common/alloc_replace.c b/common/alloc_replace.c index 8c5a9de5a..54d9c88b0 100644 --- a/common/alloc_replace.c +++ b/common/alloc_replace.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2012-2021 Google, Inc. All rights reserved. + * Copyright (c) 2012-2024 Google, Inc. All rights reserved. * **********************************************************/ /* Dr. Memory: the memory debugger @@ -1139,7 +1139,7 @@ arena_delayed_list_full(arena_header_t *arena) static inline chunk_header_t * next_chunk_forward(arena_header_t *arena, chunk_header_t *head, - arena_header_t **container_out OUT) + arena_header_t **container_out DR_PARAM_OUT) { arena_header_t *container; byte *start = ptr_from_header(head); @@ -2396,11 +2396,11 @@ alloc_iterate(malloc_iter_cb_t cb, void *iter_data, bool only_live) static bool overlap_helper(chunk_header_t *head, - malloc_info_t *info INOUT, + malloc_info_t *info DR_PARAM_INOUT, uint positive_flags, uint negative_flags) { - /* XXX: this is the one INOUT case of this structure. Once we extend it, + /* XXX: this is the one DR_PARAM_INOUT case of this structure. Once we extend it, * we need to handle back-compat struct size here. For now, header_to_info() * is used here and by above internal code that doesn't set struct-size. */ @@ -2421,7 +2421,7 @@ overlap_helper(chunk_header_t *head, /* Considers alloc_size to overlap, but returns request size in *found_end */ static bool alloc_replace_overlaps_region(byte *start, byte *end, - malloc_info_t *info INOUT, + malloc_info_t *info DR_PARAM_INOUT, uint positive_flags, uint negative_flags) { @@ -2514,21 +2514,21 @@ alloc_replace_overlaps_region(byte *start, byte *end, bool alloc_replace_overlaps_delayed_free(byte *start, byte *end, - malloc_info_t *info OUT) + malloc_info_t *info DR_PARAM_OUT) { return alloc_replace_overlaps_region(start, end, info, CHUNK_DELAY_FREE, 0); } bool alloc_replace_overlaps_any_free(byte *start, byte *end, - malloc_info_t *info OUT) + malloc_info_t *info DR_PARAM_OUT) { return alloc_replace_overlaps_region(start, end, info, CHUNK_FREED, 0); } bool alloc_replace_overlaps_malloc(byte *start, byte *end, - malloc_info_t *info OUT) + malloc_info_t *info DR_PARAM_OUT) { return alloc_replace_overlaps_region(start, end, info, 0, CHUNK_FREED); } @@ -3574,7 +3574,7 @@ replace_context_exit(void *drcontext, bool thread_exit) } static void -replace_start_nosy_sequence(void *wrapcxt, OUT void **user_data) +replace_start_nosy_sequence(void *wrapcxt, DR_PARAM_OUT void **user_data) { cls_replace_t *data = (cls_replace_t *) drmgr_get_cls_field(dr_get_current_drcontext(), cls_idx_replace); @@ -3588,7 +3588,7 @@ replace_start_nosy_sequence(void *wrapcxt, OUT void **user_data) } static void -replace_stop_nosy_sequence(void *wrapcxt, OUT void **user_data) +replace_stop_nosy_sequence(void *wrapcxt, DR_PARAM_OUT void **user_data) { cls_replace_t *data = (cls_replace_t *) drmgr_get_cls_field(dr_get_current_drcontext(), cls_idx_replace); @@ -4201,7 +4201,8 @@ replace_ignore_arg5(void *arg1, void *arg2, void *arg3, void *arg4, void *arg5) * RtlHeap iteration replacement routines */ -typedef NTSTATUS (*PHEAP_ENUMERATION_ROUTINE)(IN PVOID HeapHandle, IN PVOID UserParam); +typedef NTSTATUS (*PHEAP_ENUMERATION_ROUTINE)(DR_PARAM_IN PVOID HeapHandle, + DR_PARAM_IN PVOID UserParam); typedef struct _getheaps_data_t { ULONG actual_len; @@ -4700,7 +4701,8 @@ alloc_entering_replace_routine(app_pc pc) static bool func_interceptor(routine_type_t type, bool check_mismatch, bool check_winapi_match, - void **routine OUT, bool *at_entry OUT, uint *stack OUT) + void **routine DR_PARAM_OUT, bool *at_entry DR_PARAM_OUT, + uint *stack DR_PARAM_OUT) { /* almost everything is at the callee entry */ *at_entry = true; diff --git a/common/asm_utils.h b/common/asm_utils.h index be7a28a00..dbc3d6ef5 100644 --- a/common/asm_utils.h +++ b/common/asm_utils.h @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2010-2021 Google, Inc. All rights reserved. + * Copyright (c) 2010-2024 Google, Inc. All rights reserved. * Copyright (c) 2007-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -25,11 +25,12 @@ /* Returns the current values of xsp and xbp */ void -get_stack_registers(reg_t *xsp OUT, reg_t *xbp OUT); +get_stack_registers(reg_t *xsp DR_PARAM_OUT, reg_t *xbp DR_PARAM_OUT); /* Returns the current values of xsp and xbp */ void -get_unwind_registers(reg_t *xsp OUT, reg_t *xbp OUT, app_pc *xip OUT); +get_unwind_registers(reg_t *xsp DR_PARAM_OUT, reg_t *xbp DR_PARAM_OUT, + app_pc *xip DR_PARAM_OUT); #ifdef UNIX ptr_int_t diff --git a/common/callstack.c b/common/callstack.c index e00ae65d1..da99594e0 100644 --- a/common/callstack.c +++ b/common/callstack.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2010-2021 Google, Inc. All rights reserved. + * Copyright (c) 2010-2024 Google, Inc. All rights reserved. * Copyright (c) 2008-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -290,10 +290,12 @@ static hashtable_t retaddr_table; static dr_emit_flags_t event_basic_block_analysis(void *drcontext, void *tag, instrlist_t *bb, - bool for_trace, bool translating, OUT void **user_data); + bool for_trace, bool translating, + DR_PARAM_OUT void **user_data); static bool -module_lookup(byte *pc, app_pc *start OUT, size_t *size OUT, modname_info_t **name OUT); +module_lookup(byte *pc, app_pc *start DR_PARAM_OUT, size_t *size DR_PARAM_OUT, + modname_info_t **name DR_PARAM_OUT); static void modname_info_free(void *p); @@ -497,7 +499,8 @@ callstack_thread_exit(void *drcontext) static dr_emit_flags_t event_basic_block_analysis(void *drcontext, void *tag, instrlist_t *bb, - bool for_trace, bool translating, OUT void **user_data) + bool for_trace, bool translating, + DR_PARAM_OUT void **user_data) { instr_t *instr; ASSERT(!TEST(FP_SEARCH_ALLOW_UNSEEN_RETADDR, ops.fp_flags), "hashtable not init!"); @@ -517,7 +520,7 @@ event_basic_block_analysis(void *drcontext, void *tag, instrlist_t *bb, /***************************************************************************/ static void -init_symbolized_frame(symbolized_frame_t *frame OUT, uint frame_num) +init_symbolized_frame(symbolized_frame_t *frame DR_PARAM_OUT, uint frame_num) { memset(frame, 0, sizeof(*frame)); frame->num = frame_num; @@ -527,8 +530,8 @@ init_symbolized_frame(symbolized_frame_t *frame OUT, uint frame_num) /* Symbol lookup: i#44/PR 243532 */ static void -lookup_func_and_line(symbolized_frame_t *frame OUT, - modname_info_t *name_info IN, size_t modoffs) +lookup_func_and_line(symbolized_frame_t *frame DR_PARAM_OUT, + modname_info_t *name_info DR_PARAM_IN, size_t modoffs) { drsym_error_t symres; drsym_info_t sym; @@ -672,7 +675,7 @@ dump_app_stack(void *drcontext, tls_callstack_t *pt, dr_mcontext_t *mc, size_t a #endif static bool -frame_include_srcfile(symbolized_frame_t *frame IN) +frame_include_srcfile(symbolized_frame_t *frame DR_PARAM_IN) { return (frame->fname[0] != '\0' && /* i#589: support hiding source files matching pattern */ @@ -694,7 +697,7 @@ frame_include_srcfile(symbolized_frame_t *frame IN) * 5 KERNEL32.dll!BaseProcessStart+0x27 (0x7d4e9982 ) */ static void -print_file_and_line(symbolized_frame_t *frame IN, +print_file_and_line(symbolized_frame_t *frame DR_PARAM_IN, char *buf, size_t bufsz, size_t *sofar, uint print_flags, const char *prefix, bool include_srcfile) @@ -754,7 +757,7 @@ print_file_and_line(symbolized_frame_t *frame IN, #endif static void -print_frame(symbolized_frame_t *frame IN, +print_frame(symbolized_frame_t *frame DR_PARAM_IN, char *buf, size_t bufsz, size_t *sofar, bool use_custom_flags, uint custom_flags, size_t max_func_len, const char *prefix) @@ -867,7 +870,8 @@ print_frame(symbolized_frame_t *frame IN, * sub1_sym is for PR 543863: subtract one from retaddrs in callstacks */ static bool -address_to_frame(symbolized_frame_t *frame OUT, packed_callstack_t *pcs OUT, +address_to_frame(symbolized_frame_t *frame DR_PARAM_OUT, + packed_callstack_t *pcs DR_PARAM_OUT, app_pc pc, module_data_t *mod_in /*optional*/, bool skip_non_module, bool sub1_sym, uint frame_num) { @@ -961,7 +965,7 @@ static bool print_address_common(char *buf, size_t bufsz, size_t *sofar, app_pc pc, module_data_t *mod_in /*optional*/, bool skip_non_module, bool sub1_sym, bool for_log, - bool *last_frame OUT, uint frame_num) + bool *last_frame DR_PARAM_OUT, uint frame_num) { symbolized_frame_t frame; /* 480 bytes but our stack can handle it */ if (address_to_frame(&frame, NULL, pc, mod_in, skip_non_module, sub1_sym, 0)) { @@ -2197,7 +2201,8 @@ packed_callstack_first_frame_retaddr(packed_callstack_t *pcs) /* Returns false if a syscall. If returns true, also fills in the OUT params. */ static bool packed_callstack_frame_modinfo(packed_callstack_t *pcs, uint frame, - modname_info_t **name_info OUT, size_t *modoffs OUT) + modname_info_t **name_info DR_PARAM_OUT, + size_t *modoffs DR_PARAM_OUT) { modname_info_t *info = NULL; size_t offs = 0; @@ -2241,8 +2246,8 @@ packed_callstack_frame_modinfo(packed_callstack_t *pcs, uint frame, } static void -packed_frame_to_symbolized(packed_callstack_t *pcs IN, symbolized_frame_t *frame OUT, - uint idx) +packed_frame_to_symbolized(packed_callstack_t *pcs DR_PARAM_IN, + symbolized_frame_t *frame DR_PARAM_OUT, uint idx) { modname_info_t *info = NULL; size_t offs; @@ -2327,8 +2332,8 @@ packed_callstack_print(packed_callstack_t *pcs, uint num_frames, } void -packed_callstack_to_symbolized(packed_callstack_t *pcs IN, - symbolized_callstack_t *scs OUT) +packed_callstack_to_symbolized(packed_callstack_t *pcs DR_PARAM_IN, + symbolized_callstack_t *scs DR_PARAM_OUT) { uint i; STATS_INC(callstacks_symbolized); @@ -2598,7 +2603,7 @@ packed_callstack_add_to_table(hashtable_t *table, packed_callstack_t *pcs */ void -symbolized_callstack_print(const symbolized_callstack_t *scs IN, +symbolized_callstack_print(const symbolized_callstack_t *scs DR_PARAM_IN, char *buf, size_t bufsz, size_t *sofar, const char *prefix, bool for_log) { @@ -2841,7 +2846,7 @@ callstack_module_remove_region(app_pc start, app_pc end) static void callstack_module_get_text_bounds(const module_data_t *info, bool loaded, - app_pc *start OUT, app_pc *end OUT) + app_pc *start DR_PARAM_OUT, app_pc *end DR_PARAM_OUT) { ASSERT(loaded, "only supports fully loaded modules"); #ifdef UNIX @@ -2968,7 +2973,8 @@ callstack_module_unload(void *drcontext, const module_data_t *info) } static bool -module_lookup(byte *pc, app_pc *start OUT, size_t *size OUT, modname_info_t **name) +module_lookup(byte *pc, app_pc *start DR_PARAM_OUT, size_t *size DR_PARAM_OUT, + modname_info_t **name) { rb_node_t *node; bool res = false; @@ -3053,7 +3059,7 @@ module_lookup_preferred_name(byte *pc) } void * -module_lookup_user_data(byte *pc, app_pc *start OUT, size_t *size OUT) +module_lookup_user_data(byte *pc, app_pc *start DR_PARAM_OUT, size_t *size DR_PARAM_OUT) { modname_info_t *name_info; bool found = module_lookup(pc, NULL, NULL, &name_info); diff --git a/common/callstack.h b/common/callstack.h index cf69238f2..33438b28f 100644 --- a/common/callstack.h +++ b/common/callstack.h @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2010-2021 Google, Inc. All rights reserved. + * Copyright (c) 2010-2024 Google, Inc. All rights reserved. * Copyright (c) 2008-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -383,7 +383,7 @@ module_lookup_preferred_name(byte *pc); * Optionally returns the module bounds as well. */ void * -module_lookup_user_data(byte *pc, app_pc *start OUT, size_t *size OUT); +module_lookup_user_data(byte *pc, app_pc *start DR_PARAM_OUT, size_t *size DR_PARAM_OUT); /* Warns once about modules that don't have symbols, and records them in a * logfile so they can be fetched at the end of execution. @@ -411,11 +411,11 @@ typedef struct _symbolized_callstack_t { } symbolized_callstack_t; void -packed_callstack_to_symbolized(packed_callstack_t *pcs IN, - symbolized_callstack_t *scs OUT); +packed_callstack_to_symbolized(packed_callstack_t *pcs DR_PARAM_IN, + symbolized_callstack_t *scs DR_PARAM_OUT); void -symbolized_callstack_print(const symbolized_callstack_t *scs IN, +symbolized_callstack_print(const symbolized_callstack_t *scs DR_PARAM_IN, char *buf, size_t bufsz, size_t *sofar, const char *prefix, bool for_log); diff --git a/common/heap.c b/common/heap.c index db3120c15..cb1df262c 100644 --- a/common/heap.c +++ b/common/heap.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2011-2021 Google, Inc. All rights reserved. + * Copyright (c) 2011-2024 Google, Inc. All rights reserved. * Copyright (c) 2009-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -185,7 +185,7 @@ get_ntdll_base(void) * just one libc. */ app_pc -get_libc_base(app_pc *libc_end_out OUT) +get_libc_base(app_pc *libc_end_out DR_PARAM_OUT) { static app_pc libc_base, libc_end; /* cached values */ if (libc_base == NULL) { @@ -293,15 +293,15 @@ static app_pc ld_so_data_end; #endif #ifdef WINDOWS -DECLARE_NTDLL(RtlLockHeap, (IN HANDLE Heap)); -DECLARE_NTDLL(RtlUnlockHeap, (IN HANDLE Heap)); -DECLARE_NTDLL(RtlGetProcessHeaps, (IN ULONG count, - OUT HANDLE *Heaps)); -DECLARE_NTDLL(RtlWalkHeap, (IN HANDLE Heap, - OUT rtl_process_heap_entry_t *Info)); -DECLARE_NTDLL(RtlSizeHeap, (IN HANDLE Heap, - IN ULONG flags, - IN PVOID ptr)); +DECLARE_NTDLL(RtlLockHeap, (DR_PARAM_IN HANDLE Heap)); +DECLARE_NTDLL(RtlUnlockHeap, (DR_PARAM_IN HANDLE Heap)); +DECLARE_NTDLL(RtlGetProcessHeaps, (DR_PARAM_IN ULONG count, + DR_PARAM_OUT HANDLE *Heaps)); +DECLARE_NTDLL(RtlWalkHeap, (DR_PARAM_IN HANDLE Heap, + DR_PARAM_OUT rtl_process_heap_entry_t *Info)); +DECLARE_NTDLL(RtlSizeHeap, (DR_PARAM_IN HANDLE Heap, + DR_PARAM_IN ULONG flags, + DR_PARAM_IN PVOID ptr)); static void heap_walk_init(void) @@ -329,7 +329,7 @@ static void walk_individual_heap(byte *heap, void (*cb_region)(app_pc,app_pc _IF_WINDOWS(HANDLE)), void (*cb_chunk)(app_pc,app_pc), - byte **allocated_end OUT) + byte **allocated_end DR_PARAM_OUT) { rtl_process_heap_entry_t heap_info; size_t size, commit_size, sub_size; diff --git a/common/heap.h b/common/heap.h index 27a8fc3eb..89e709229 100644 --- a/common/heap.h +++ b/common/heap.h @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2011-2015 Google, Inc. All rights reserved. + * Copyright (c) 2011-2024 Google, Inc. All rights reserved. * Copyright (c) 2007-2009 VMware, Inc. All rights reserved. * **********************************************************/ @@ -41,7 +41,7 @@ get_ntdll_base(void); #endif app_pc -get_libc_base(app_pc *libc_end OUT); +get_libc_base(app_pc *libc_end DR_PARAM_OUT); bool pc_is_in_libc(app_pc pc); diff --git a/common/redblack.c b/common/redblack.c index 98f5f7b52..48a48cb48 100644 --- a/common/redblack.c +++ b/common/redblack.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2011-2012 Google, Inc. All rights reserved. + * Copyright (c) 2011-2024 Google, Inc. All rights reserved. * Copyright (c) 2007-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -75,7 +75,8 @@ ptrmax(byte *val1, byte *val2) /* Retrieve copies of fields. The node pointer is then no longer needed. */ void -rb_node_fields(rb_node_t *node, byte **base OUT, size_t *size OUT, void **client OUT) +rb_node_fields(rb_node_t *node, byte **base DR_PARAM_OUT, size_t *size DR_PARAM_OUT, + void **client DR_PARAM_OUT) { ASSERT(node != NULL, "invalid param"); if (base != NULL) diff --git a/common/redblack.h b/common/redblack.h index 6ed7a3208..b4f534f1d 100644 --- a/common/redblack.h +++ b/common/redblack.h @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2012 Google, Inc. All rights reserved. + * Copyright (c) 2012-2024 Google, Inc. All rights reserved. * Copyright (c) 2007-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -54,7 +54,8 @@ rb_tree_destroy(rb_tree_t *tree); /* Retrieve copies of fields. The node pointer is then no longer needed. */ void -rb_node_fields(rb_node_t *node, byte **base OUT, size_t *size OUT, void **client OUT); +rb_node_fields(rb_node_t *node, byte **base DR_PARAM_OUT, size_t *size DR_PARAM_OUT, + void **client DR_PARAM_OUT); /* Modify the client field of a node. */ void diff --git a/common/utils.c b/common/utils.c index ba926f654..40307c146 100644 --- a/common/utils.c +++ b/common/utils.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2011-2021 Google, Inc. All rights reserved. + * Copyright (c) 2011-2024 Google, Inc. All rights reserved. * Copyright (c) 2007-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -699,16 +699,16 @@ typedef struct _THREAD_BASIC_INFORMATION { // Information Class 0 #define OBJ_CASE_INSENSITIVE 0x00000040L -GET_NTDLL(NtQueryInformationThread, (IN HANDLE ThreadHandle, - IN THREADINFOCLASS ThreadInformationClass, - OUT PVOID ThreadInformation, - IN ULONG ThreadInformationLength, - OUT PULONG ReturnLength OPTIONAL)); +GET_NTDLL(NtQueryInformationThread, (DR_PARAM_IN HANDLE ThreadHandle, + DR_PARAM_IN THREADINFOCLASS ThreadInformationClass, + DR_PARAM_OUT PVOID ThreadInformation, + DR_PARAM_IN ULONG ThreadInformationLength, + DR_PARAM_OUT PULONG ReturnLength OPTIONAL)); -GET_NTDLL(NtOpenThread, (OUT PHANDLE ThreadHandle, - IN ACCESS_MASK DesiredAccess, - IN POBJECT_ATTRIBUTES ObjectAttributes, - IN PCLIENT_ID ClientId)); +GET_NTDLL(NtOpenThread, (DR_PARAM_OUT PHANDLE ThreadHandle, + DR_PARAM_IN ACCESS_MASK DesiredAccess, + DR_PARAM_IN POBJECT_ATTRIBUTES ObjectAttributes, + DR_PARAM_IN PCLIENT_ID ClientId)); TEB * get_TEB(void) @@ -940,7 +940,7 @@ get_windows_version(void) } void -get_windows_version_string(char *buf OUT, size_t bufsz) +get_windows_version_string(char *buf DR_PARAM_OUT, size_t bufsz) { if (os_version.version == 0) init_os_version(); @@ -950,10 +950,10 @@ get_windows_version_string(char *buf OUT, size_t bufsz) buf[bufsz - 1] = '\0'; } -GET_NTDLL(NtQuerySystemInformation, (IN SYSTEM_INFORMATION_CLASS info_class, - OUT PVOID info, - IN ULONG info_size, - OUT PULONG bytes_received)); +GET_NTDLL(NtQuerySystemInformation, (DR_PARAM_IN SYSTEM_INFORMATION_CLASS info_class, + DR_PARAM_OUT PVOID info, + DR_PARAM_IN ULONG info_size, + DR_PARAM_OUT PULONG bytes_received)); app_pc get_highest_user_address(void) diff --git a/common/utils.h b/common/utils.h index aadc00e98..040d093d5 100644 --- a/common/utils.h +++ b/common/utils.h @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2010-2021 Google, Inc. All rights reserved. + * Copyright (c) 2010-2024 Google, Inc. All rights reserved. * Copyright (c) 2007-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -917,7 +917,7 @@ dr_os_version_t get_windows_version(void); void -get_windows_version_string(char *buf OUT, size_t bufsz); +get_windows_version_string(char *buf DR_PARAM_OUT, size_t bufsz); app_pc get_highest_user_address(void); @@ -1037,8 +1037,8 @@ text_contains_any_string(const char *text, const char *patterns, bool ignore_cas * in "sol" and the end of the line (prior to any whitespace, if skip_ws) in "eol". */ const char * -find_next_line(const char *start, const char *eof, const char **sol OUT, - const char **eol OUT, bool skip_ws); +find_next_line(const char *start, const char *eof, const char **sol DR_PARAM_OUT, + const char **eol DR_PARAM_OUT, bool skip_ws); /*************************************************************************** * REGISTER CONVERSION UTILITIES diff --git a/common/utils_shared.c b/common/utils_shared.c index 4859b13dd..8cfca94a9 100755 --- a/common/utils_shared.c +++ b/common/utils_shared.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2011-2020 Google, Inc. All rights reserved. + * Copyright (c) 2011-2024 Google, Inc. All rights reserved. * Copyright (c) 2007-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -113,7 +113,7 @@ drmem_strndup(const char *src, size_t max, heapstat_t type) /* see description in header */ const char * find_next_line(const char *start, const char *eof, const char **sol, - const char **eol OUT, bool skip_ws) + const char **eol DR_PARAM_OUT, bool skip_ws) { const char *line = start, *newline, *next_line; /* First, set "line" to start of line and "newline" to end (pre-whitespace) */ diff --git a/common/windefs.h b/common/windefs.h index 2077a7614..d6766405a 100644 --- a/common/windefs.h +++ b/common/windefs.h @@ -815,17 +815,17 @@ typedef struct _KEY_VALUE_ENTRY { typedef VOID (*PKNORMAL_ROUTINE) ( - IN PVOID NormalContext, - IN PVOID SystemArgument1, - IN PVOID SystemArgument2 + DR_PARAM_IN PVOID NormalContext, + DR_PARAM_IN PVOID SystemArgument1, + DR_PARAM_IN PVOID SystemArgument2 ); typedef VOID (NTAPI *PIO_APC_ROUTINE) ( - IN PVOID ApcContext, - IN PIO_STATUS_BLOCK IoStatusBlock, - IN ULONG Reserved + DR_PARAM_IN PVOID ApcContext, + DR_PARAM_IN PIO_STATUS_BLOCK IoStatusBlock, + DR_PARAM_IN ULONG Reserved ); #ifdef X64 @@ -981,7 +981,7 @@ typedef enum { /* NOTE - these are speculative */ THREAD_INFO_ELEMENT_NT_PATH_TO_EXE = 0x5, /* buffer is wchar * path to exe * [ i.e. L"\??\c:\foo.exe" ] - IN */ THREAD_INFO_ELEMENT_EXE_STUFF = 0x6, /* buffer is exe_stuff_t (see above) - * - INOUT */ + * - DR_PARAM_INOUT */ THREAD_INFO_ELEMENT_UNKNOWN_1 = 0x9, /* Unknown - ptr_uint_t sized * [ observed 1 ] - IN */ } thread_info_elm_buf_type_t; @@ -994,7 +994,7 @@ typedef struct _thread_info_element_t { /* NOTE - this is speculative */ } thread_info_elm_t; typedef struct _exe_stuff_t { /* NOTE - this is speculative */ - OUT void *exe_entrypoint_addr; /* Entry point to the exe being started. */ + DR_PARAM_OUT void *exe_entrypoint_addr; /* Entry point to the exe being started. */ // ratio of uint32 to ptr_uint_t assumes no larger changes between 32 and 64-bit ptr_uint_t unknown1[3]; // possibly intermixed with uint32s below IN? OUT? uint unknown2[8]; // possible intermixed with ptr_uint_ts above IN? OUT? diff --git a/drfuzz/drfuzz.c b/drfuzz/drfuzz.c index 492cfd440..7a69d77ee 100644 --- a/drfuzz/drfuzz.c +++ b/drfuzz/drfuzz.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2015-2016 Google, Inc. All rights reserved. + * Copyright (c) 2015-2024 Google, Inc. All rights reserved. * **********************************************************/ /* @@ -196,7 +196,7 @@ bb_event(void *drcontext, void *tag, instrlist_t *bb, bool for_trace, bool translating); static void -pre_fuzz_handler(void *wrapcxt, INOUT void **user_data); +pre_fuzz_handler(void *wrapcxt, DR_PARAM_INOUT void **user_data); static void post_fuzz_handler(void *wrapcxt, void *user_data); @@ -547,7 +547,7 @@ drfuzz_get_target_num_bbs(generic_func_t func_pc, uint64 *num_bbs) DR_EXPORT drmf_status_t drfuzz_get_arg(void *fuzzcxt, generic_func_t target_pc, int arg, bool original, - OUT void **arg_value) + DR_PARAM_OUT void **arg_value) { fuzz_pass_context_t *fp = (fuzz_pass_context_t *) fuzzcxt; pass_target_t *target; @@ -580,7 +580,7 @@ drfuzz_set_arg(void *fuzzcxt, int arg, void *val) } DR_EXPORT drmf_status_t -drfuzz_get_target_user_data(IN generic_func_t target_pc, OUT void **user_data) +drfuzz_get_target_user_data(DR_PARAM_IN generic_func_t target_pc, DR_PARAM_OUT void **user_data) { fuzz_target_t *target = hashtable_lookup(&fuzz_target_htable, target_pc); @@ -592,8 +592,8 @@ drfuzz_get_target_user_data(IN generic_func_t target_pc, OUT void **user_data) } DR_EXPORT drmf_status_t -drfuzz_set_target_user_data(IN generic_func_t target_pc, IN void *user_data, - IN void (*delete_callback)(void *user_data)) +drfuzz_set_target_user_data(DR_PARAM_IN generic_func_t target_pc, DR_PARAM_IN void *user_data, + DR_PARAM_IN void (*delete_callback)(void *user_data)) { fuzz_target_t *target = hashtable_lookup(&fuzz_target_htable, target_pc); @@ -606,8 +606,8 @@ drfuzz_set_target_user_data(IN generic_func_t target_pc, IN void *user_data, } DR_EXPORT drmf_status_t -drfuzz_get_target_per_thread_user_data(IN void *fuzzcxt, IN generic_func_t target_pc, - OUT void **user_data) +drfuzz_get_target_per_thread_user_data(DR_PARAM_IN void *fuzzcxt, DR_PARAM_IN generic_func_t target_pc, + DR_PARAM_OUT void **user_data) { fuzz_pass_context_t *fp = (fuzz_pass_context_t *) fuzzcxt; pass_target_t *target; @@ -626,9 +626,9 @@ drfuzz_get_target_per_thread_user_data(IN void *fuzzcxt, IN generic_func_t targe } DR_EXPORT drmf_status_t -drfuzz_set_target_per_thread_user_data(IN void *fuzzcxt, IN generic_func_t target_pc, - IN void *user_data, - IN void (*delete_callback)(void *fuzzcxt, +drfuzz_set_target_per_thread_user_data(DR_PARAM_IN void *fuzzcxt, DR_PARAM_IN generic_func_t target_pc, + DR_PARAM_IN void *user_data, + DR_PARAM_IN void (*delete_callback)(void *fuzzcxt, void *user_data)) { fuzz_pass_context_t *fp = (fuzz_pass_context_t *) fuzzcxt; @@ -649,7 +649,7 @@ drfuzz_set_target_per_thread_user_data(IN void *fuzzcxt, IN generic_func_t targe } static void -pre_fuzz_handler(void *wrapcxt, INOUT void **user_data) +pre_fuzz_handler(void *wrapcxt, DR_PARAM_INOUT void **user_data) { void *dcontext = drwrap_get_drcontext(wrapcxt); app_pc target_to_fuzz = drwrap_get_func(wrapcxt); @@ -1058,7 +1058,7 @@ static drfuzz_mutator_api_t default_mutator = { }; DR_EXPORT drmf_status_t -drfuzz_mutator_load(IN const char *lib_path, INOUT drfuzz_mutator_api_t *api) +drfuzz_mutator_load(DR_PARAM_IN const char *lib_path, DR_PARAM_INOUT drfuzz_mutator_api_t *api) { int *ver_compat, *ver_cur; char *func; @@ -1112,7 +1112,7 @@ drfuzz_mutator_load(IN const char *lib_path, INOUT drfuzz_mutator_api_t *api) } DR_EXPORT drmf_status_t -drfuzz_mutator_unload(IN drfuzz_mutator_api_t *api) +drfuzz_mutator_unload(DR_PARAM_IN drfuzz_mutator_api_t *api) { if (api == NULL) return DRMF_ERROR_INVALID_PARAMETER; diff --git a/drfuzz/drfuzz.h b/drfuzz/drfuzz.h index 6f6bb8fce..285863a91 100644 --- a/drfuzz/drfuzz.h +++ b/drfuzz/drfuzz.h @@ -1,5 +1,5 @@ /* ************************************************************** - * Copyright (c) 2015 Google, Inc. All rights reserved. + * Copyright (c) 2015-2024 Google, Inc. All rights reserved. * **************************************************************/ /* @@ -386,7 +386,7 @@ DR_EXPORT * fuzzing function in the case of nested fuzzing. */ drmf_status_t -drfuzz_get_target_num_bbs(IN generic_func_t target_pc, OUT uint64 *num_bbs); +drfuzz_get_target_num_bbs(DR_PARAM_IN generic_func_t target_pc, DR_PARAM_OUT uint64 *num_bbs); DR_EXPORT /** @@ -404,7 +404,7 @@ DR_EXPORT */ drmf_status_t drfuzz_get_arg(void *fuzzcxt, generic_func_t target_pc, int arg, bool original, - OUT void **arg_value); + DR_PARAM_OUT void **arg_value); DR_EXPORT /** @@ -422,7 +422,7 @@ DR_EXPORT * Get the user data associated with the \p target_pc. */ drmf_status_t -drfuzz_get_target_user_data(IN generic_func_t target_pc, OUT void **user_data); +drfuzz_get_target_user_data(DR_PARAM_IN generic_func_t target_pc, DR_PARAM_OUT void **user_data); DR_EXPORT /** @@ -432,8 +432,8 @@ DR_EXPORT * \note: Only one slot is provided for the data, so multiple writes will overwrite. */ drmf_status_t -drfuzz_set_target_user_data(IN generic_func_t target_pc, IN void *user_data, - IN void (*delete_callback)(void *user_data)); +drfuzz_set_target_user_data(DR_PARAM_IN generic_func_t target_pc, DR_PARAM_IN void *user_data, + DR_PARAM_IN void (*delete_callback)(void *user_data)); DR_EXPORT /** @@ -441,8 +441,8 @@ DR_EXPORT * \p fuzzcxt is NULL, the fuzzcxt for the current thread will be used (if any). */ drmf_status_t -drfuzz_get_target_per_thread_user_data(IN void *fuzzcxt, IN generic_func_t target_pc, - OUT void **user_data); +drfuzz_get_target_per_thread_user_data(DR_PARAM_IN void *fuzzcxt, DR_PARAM_IN generic_func_t target_pc, + DR_PARAM_OUT void **user_data); DR_EXPORT /** @@ -454,9 +454,9 @@ DR_EXPORT * \note: Only one slot is provided for the data, so multiple writes will overwrite. */ drmf_status_t -drfuzz_set_target_per_thread_user_data(IN void *fuzzcxt, IN generic_func_t target_pc, - IN void *user_data, - IN void (*delete_callback)(void *fuzzcxt, +drfuzz_set_target_per_thread_user_data(DR_PARAM_IN void *fuzzcxt, DR_PARAM_IN generic_func_t target_pc, + DR_PARAM_IN void *user_data, + DR_PARAM_IN void (*delete_callback)(void *fuzzcxt, void *user_data)); DR_EXPORT @@ -506,14 +506,14 @@ DR_EXPORT * DRMF_SUCCESS on success. */ drmf_status_t -drfuzz_mutator_load(IN const char *lib_path, INOUT drfuzz_mutator_api_t *api); +drfuzz_mutator_load(DR_PARAM_IN const char *lib_path, DR_PARAM_INOUT drfuzz_mutator_api_t *api); DR_EXPORT /** * Unloads a custom mutator library. Returns DRMF_SUCCESS on success. */ drmf_status_t -drfuzz_mutator_unload(IN drfuzz_mutator_api_t *lib); +drfuzz_mutator_unload(DR_PARAM_IN drfuzz_mutator_api_t *lib); /*@}*/ /* end doxygen group */ diff --git a/drfuzz/drfuzz_mutator.c b/drfuzz/drfuzz_mutator.c index 1a298e949..c44354a81 100644 --- a/drfuzz/drfuzz_mutator.c +++ b/drfuzz/drfuzz_mutator.c @@ -1,5 +1,5 @@ /* ************************************************************** - * Copyright (c) 2015-2016 Google, Inc. All rights reserved. + * Copyright (c) 2015-2024 Google, Inc. All rights reserved. * **************************************************************/ /* @@ -443,8 +443,10 @@ drfuzz_mutator_set_options(drfuzz_mutator_t *mutator_in, */ LIB_EXPORT drmf_status_t -drfuzz_mutator_start(OUT drfuzz_mutator_t **mutator_out, IN void *input_seed, - IN size_t size, IN int argc, IN const char *argv[]) +drfuzz_mutator_start(DR_PARAM_OUT drfuzz_mutator_t **mutator_out, + DR_PARAM_IN void *input_seed, + DR_PARAM_IN size_t size, DR_PARAM_IN int argc, + DR_PARAM_IN const char *argv[]) { mutator_t *mutator; drmf_status_t res; @@ -505,7 +507,8 @@ drfuzz_mutator_has_next_value(drfuzz_mutator_t *mutator_in) } LIB_EXPORT drmf_status_t -drfuzz_mutator_get_current_value(IN drfuzz_mutator_t *mutator_in, OUT void *buffer) +drfuzz_mutator_get_current_value(DR_PARAM_IN drfuzz_mutator_t *mutator_in, + DR_PARAM_OUT void *buffer) { mutator_t *mutator = (mutator_t *) mutator_in; memcpy(buffer, mutator->current_value, mutator->size); @@ -683,7 +686,7 @@ get_next_random_value(mutator_t *mutator, void *buffer) } LIB_EXPORT drmf_status_t -drfuzz_mutator_get_next_value(drfuzz_mutator_t *mutator_in, IN void *buffer) +drfuzz_mutator_get_next_value(drfuzz_mutator_t *mutator_in, DR_PARAM_IN void *buffer) { mutator_t *mutator = (mutator_t *) mutator_in; drmf_status_t res; diff --git a/drfuzz/drfuzz_mutator.h b/drfuzz/drfuzz_mutator.h index 947a7838a..14ff47217 100644 --- a/drfuzz/drfuzz_mutator.h +++ b/drfuzz/drfuzz_mutator.h @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2015 Google, Inc. All rights reserved. + * Copyright (c) 2015-2024 Google, Inc. All rights reserved. * Copyright (c) 2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -103,8 +103,10 @@ LIB_EXPORT * @param[in] argv An array of \p argc arguments to customize the mutator. */ drmf_status_t -LIBFUNC(drfuzz_mutator_start)(OUT drfuzz_mutator_t **mutator, IN void *input_seed, - IN size_t size, IN int argc, IN const char *argv[]); +LIBFUNC(drfuzz_mutator_start)(DR_PARAM_OUT drfuzz_mutator_t **mutator, + DR_PARAM_IN void *input_seed, + DR_PARAM_IN size_t size, DR_PARAM_IN int argc, + DR_PARAM_IN const char *argv[]); LIB_EXPORT /** @@ -119,14 +121,16 @@ LIB_EXPORT * Provides a copy of the current mutator value. Returns DRMF_SUCCESS on success. */ drmf_status_t -LIBFUNC(drfuzz_mutator_get_current_value)(IN drfuzz_mutator_t *mutator, OUT void *buffer); +LIBFUNC(drfuzz_mutator_get_current_value)(DR_PARAM_IN drfuzz_mutator_t *mutator, + DR_PARAM_OUT void *buffer); LIB_EXPORT /** * Writes the next fuzz value to the provided buffer. Returns DRMF_SUCCESS on success. */ drmf_status_t -LIBFUNC(drfuzz_mutator_get_next_value)(drfuzz_mutator_t *mutator, OUT void *buffer); +LIBFUNC(drfuzz_mutator_get_next_value)(drfuzz_mutator_t *mutator, + DR_PARAM_OUT void *buffer); LIB_EXPORT /** diff --git a/drheapstat/drheapstat.c b/drheapstat/drheapstat.c index 7f642ad0c..920f75020 100644 --- a/drheapstat/drheapstat.c +++ b/drheapstat/drheapstat.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2010-2021 Google, Inc. All rights reserved. + * Copyright (c) 2010-2024 Google, Inc. All rights reserved. * Copyright (c) 2009-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -1293,7 +1293,7 @@ insert_instr_counter(void *drcontext, instrlist_t *bb, static dr_emit_flags_t event_bb_app2app(void *drcontext, void *tag, instrlist_t *bb, - bool for_trace, bool translating, void **user_data OUT) + bool for_trace, bool translating, void **user_data DR_PARAM_OUT) { /* we pass bi among all 4 phases */ instru_info_t *ii = thread_alloc(drcontext, sizeof(*ii), HEAPSTAT_PERBB); diff --git a/drltrace/drltrace.cpp b/drltrace/drltrace.cpp index a8f015d4b..3c0e436a6 100644 --- a/drltrace/drltrace.cpp +++ b/drltrace/drltrace.cpp @@ -1,5 +1,5 @@ /* *************************************************************************** - * Copyright (c) 2013-2023 Google, Inc. All rights reserved. + * Copyright (c) 2013-2024 Google, Inc. All rights reserved. * ***************************************************************************/ /* @@ -235,7 +235,7 @@ print_symbolic_args(const char *name, void *wrapcxt, app_pc func) */ static void -lib_entry(void *wrapcxt, INOUT void **user_data) +lib_entry(void *wrapcxt, DR_PARAM_INOUT void **user_data) { const char *name = (const char *) *user_data; const char *modname = NULL; diff --git a/drmemory/alloc_drmem.c b/drmemory/alloc_drmem.c index 618ec7dcd..cff8ba0a6 100644 --- a/drmemory/alloc_drmem.c +++ b/drmemory/alloc_drmem.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2010-2021 Google, Inc. All rights reserved. + * Copyright (c) 2010-2024 Google, Inc. All rights reserved. * Copyright (c) 2008-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -327,7 +327,7 @@ mmap_tree_remove(byte *base, size_t size) } bool -mmap_anon_lookup(byte *addr, byte **start OUT, size_t *size OUT) +mmap_anon_lookup(byte *addr, byte **start DR_PARAM_OUT, size_t *size DR_PARAM_OUT) { dr_mutex_lock(mmap_tree_lock); bool res = false; @@ -718,7 +718,7 @@ print_free_tree(rb_node_t *node, void *data) * pointer. Caller must hold lock. */ static app_pc -next_to_free(delay_free_info_t *info, int idx _IF_WINDOWS(ptr_int_t *auxarg OUT), +next_to_free(delay_free_info_t *info, int idx _IF_WINDOWS(ptr_int_t *auxarg DR_PARAM_OUT), const char *reason) { app_pc pass_to_free = NULL; @@ -765,12 +765,12 @@ next_to_free(delay_free_info_t *info, int idx _IF_WINDOWS(ptr_int_t *auxarg OUT) } /* Returns the value to pass to free(). Return "tofree" for no change. - * The auxarg param is INOUT so it can be changed as well. + * The auxarg param is DR_PARAM_INOUT so it can be changed as well. */ app_pc client_handle_free(malloc_info_t *mal, byte *tofree, dr_mcontext_t *mc, app_pc free_routine, void *routine_set_data, bool for_reuse - _IF_WINDOWS(ptr_int_t *auxarg INOUT)) + _IF_WINDOWS(ptr_int_t *auxarg DR_PARAM_INOUT)) { report_malloc(mal->base, mal->base + mal->request_size, "free", mc); @@ -1016,9 +1016,9 @@ client_handle_heap_destroy(void *drcontext, HANDLE heap, void *client_data) bool overlaps_delayed_free(byte *start, byte *end, - byte **free_start OUT, /* app base */ - byte **free_end OUT, /* app request size */ - packed_callstack_t **pcs OUT, + byte **free_start DR_PARAM_OUT, /* app base */ + byte **free_end DR_PARAM_OUT, /* app request size */ + packed_callstack_t **pcs DR_PARAM_OUT, bool delayed_only) { bool res = false; @@ -1663,7 +1663,7 @@ event_kernel_xfer(void *drcontext, const dr_kernel_xfer_info_t *info) #ifdef X86 /* replacement should avoid needing to port this to ARM */ static bool is_rawmemchr_pattern(void *drcontext, bool write, app_pc pc, app_pc next_pc, - app_pc addr, uint sz, instr_t *inst, bool *now_addressable OUT) + app_pc addr, uint sz, instr_t *inst, bool *now_addressable DR_PARAM_OUT) { /* PR 406535: glibc's rawmemchr does some bit tricks that can end * up using unaddressable or undefined values. The erroneous load @@ -1763,7 +1763,7 @@ is_rawmemchr_pattern(void *drcontext, bool write, app_pc pc, app_pc next_pc, bool is_alloca_pattern(void *drcontext, app_pc pc, app_pc next_pc, instr_t *inst, - bool *now_addressable OUT) + bool *now_addressable DR_PARAM_OUT) { /* Check for alloca probes to trigger guard pages. * So far we've seen just a handful of different sequences: @@ -1974,7 +1974,7 @@ is_alloca_pattern(void *drcontext, app_pc pc, app_pc next_pc, instr_t *inst, #ifdef X86 /* replacement should avoid needing to port this to ARM */ static bool is_strlen_pattern(void *drcontext, bool write, app_pc pc, app_pc next_pc, - app_pc addr, uint sz, instr_t *inst, bool *now_addressable OUT) + app_pc addr, uint sz, instr_t *inst, bool *now_addressable DR_PARAM_OUT) { /* Check for intel\strlen.asm case where it reads 4 bytes for efficiency: * it only does so if aligned, so no danger of touching next page, and @@ -2074,7 +2074,7 @@ is_strlen_pattern(void *drcontext, bool write, app_pc pc, app_pc next_pc, static bool is_strcpy_pattern(void *drcontext, bool write, app_pc pc, app_pc next_pc, - app_pc addr, uint sz, instr_t *inst, bool *now_addressable OUT) + app_pc addr, uint sz, instr_t *inst, bool *now_addressable DR_PARAM_OUT) { instr_t next; app_pc dpc = next_pc; @@ -2148,7 +2148,7 @@ is_strcpy_pattern(void *drcontext, bool write, app_pc pc, app_pc next_pc, static bool is_prefetch(void *drcontext, bool write, app_pc pc, app_pc next_pc, - app_pc addr, uint sz, instr_t *inst, bool *now_addressable OUT, + app_pc addr, uint sz, instr_t *inst, bool *now_addressable DR_PARAM_OUT, app_loc_t *loc, dr_mcontext_t *mc) { /* i#585: prefetch should not raise an unaddr error, only a warning */ @@ -2171,7 +2171,7 @@ is_prefetch(void *drcontext, bool write, app_pc pc, app_pc next_pc, #ifdef WINDOWS static bool is_heap_seh(void *drcontext, bool write, app_pc pc, app_pc next_pc, - app_pc addr, uint sz, instr_t *inst, bool *now_addressable OUT, + app_pc addr, uint sz, instr_t *inst, bool *now_addressable DR_PARAM_OUT, app_loc_t *loc, dr_mcontext_t *mc) { /* i#689: Rtl*Heap SEH finalizer reads Heap to unlock the Heap's critsec. @@ -2645,11 +2645,11 @@ region_overlap_with_malloc_block(malloc_iter_data_t *iter_data) */ bool region_in_redzone(byte *addr, size_t size, - packed_callstack_t **alloc_pcs OUT, - app_pc *app_start OUT, - app_pc *app_end OUT, - app_pc *redzone_start OUT, - app_pc *redzone_end OUT) + packed_callstack_t **alloc_pcs DR_PARAM_OUT, + app_pc *app_start DR_PARAM_OUT, + app_pc *app_end DR_PARAM_OUT, + app_pc *redzone_start DR_PARAM_OUT, + app_pc *redzone_end DR_PARAM_OUT) { malloc_iter_data_t iter_data = {addr, size, NULL, NULL, NULL, false, false}; if (options.replace_malloc) { diff --git a/drmemory/alloc_drmem.h b/drmemory/alloc_drmem.h index 316e65425..e80b8202e 100644 --- a/drmemory/alloc_drmem.h +++ b/drmemory/alloc_drmem.h @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2013-2020 Google, Inc. All rights reserved. + * Copyright (c) 2013-2024 Google, Inc. All rights reserved. * Copyright (c) 2008-2009 VMware, Inc. All rights reserved. * **********************************************************/ @@ -47,7 +47,7 @@ dr_signal_action_t event_signal_alloc(void *drcontext, dr_siginfo_t *info); bool -mmap_anon_lookup(byte *addr, byte **start OUT, size_t *size OUT); +mmap_anon_lookup(byte *addr, byte **start DR_PARAM_OUT, size_t *size DR_PARAM_OUT); #endif void @@ -67,14 +67,14 @@ check_reachability(bool at_exit); */ bool overlaps_delayed_free(byte *start, byte *end, - byte **free_start OUT, /* app base */ - byte **free_end OUT, /* app request size */ - packed_callstack_t **pcs OUT, + byte **free_start DR_PARAM_OUT, /* app base */ + byte **free_end DR_PARAM_OUT, /* app request size */ + packed_callstack_t **pcs DR_PARAM_OUT, bool delayed_only); bool is_alloca_pattern(void *drcontext, app_pc pc, app_pc next_pc, instr_t *inst, - bool *now_addressable OUT); + bool *now_addressable DR_PARAM_OUT); /* check if region [addr, addr + size) overlaps with any malloc redzone, * - if overlaps, return true and fill all the passed in parameters, @@ -82,11 +82,11 @@ is_alloca_pattern(void *drcontext, app_pc pc, app_pc next_pc, instr_t *inst, */ bool region_in_redzone(byte *addr, size_t size, - packed_callstack_t **alloc_pcs OUT, - app_pc *app_start OUT, - app_pc *app_end OUT, - app_pc *redzone_start OUT, - app_pc *redzone_end OUT); + packed_callstack_t **alloc_pcs DR_PARAM_OUT, + app_pc *app_start DR_PARAM_OUT, + app_pc *app_end DR_PARAM_OUT, + app_pc *redzone_start DR_PARAM_OUT, + app_pc *redzone_end DR_PARAM_OUT); /* Synchronizes access to malloc callstacks (malloc_get_client_data()) */ void diff --git a/drmemory/docs/using.dox b/drmemory/docs/using.dox index 53751b6fc..56228a751 100644 --- a/drmemory/docs/using.dox +++ b/drmemory/docs/using.dox @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2011-2023 Google, Inc. All rights reserved. + * Copyright (c) 2011-2024 Google, Inc. All rights reserved. * Copyright (c) 2009-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -204,10 +204,10 @@ These cross-platform steps apply to Linux, Mac, and Windows. In order to obtain line number information, compile your target application with debugging information enabled. -On Linux, Dr. Memory supports ELF files with DWARF2 line information. -On Mac, Dr. Memory supports Mach-O files with DWARF2 line information. On +On Linux, Dr. Memory supports ELF files with DWARF line information. +On Mac, Dr. Memory supports Mach-O files with DWARF line information. On Windows, Dr. Memory supports PDB debug information (produced by Visual -Studio) as well as PECOFF files with DWARF2 line information (produced by +Studio) as well as PECOFF files with DWARF line information (produced by MinGW gcc). ******************** @@ -228,15 +228,11 @@ but should eliminate skipped frames. ******************** \section sec_prep_linux Linux -Dr. Memory currently only supports DWARF2 through DWARF4 line information, not -stabs nor DWARF5. DWARF4 can be requested from the compiler with the `-gdwarf-4` -flag. - Here is a sample command line for compiling your application that combines all of the above recommendations: \verbatim -g++ -g -gdwarf-4 -fno-inline -fno-omit-frame-pointer myfile1.cpp myfile2.cpp -o myapp +g++ -g -fno-inline -fno-omit-frame-pointer myfile1.cpp myfile2.cpp -o myapp \endverbatim ******************** @@ -244,9 +240,9 @@ g++ -g -gdwarf-4 -fno-inline -fno-omit-frame-pointer myfile1.cpp myfile2.cpp -o Ensure your compiler is able to build 32-bit applications. -Dr. Memory currently only supports DWARF2 through DWARF4 line information, not -stabs nor DWARF5. DWARF4 can be requested from the compiler with the `-gdwarf-4` -flag. +Dr. Memory currently only supports DWARF2 through DWARF4 line information on +Mac, not stabs nor DWARF5. DWARF4 can be requested from the compiler with the +`-gdwarf-4` flag. Here is a sample command line for compiling your application that combines all of the above recommendations: @@ -324,10 +320,10 @@ cl /Zi /MT /EHsc /Oy- /Ob0 /Femyapp.exe *.cpp \section sec_prep_mingw Windows MinGW Dr. Memory supports applications compiled with the MinGW gcc or g++ -compilers, but will only provide line number information if DWARF2 +compilers, but will only provide line number information if DWARF debugging information is present. The default for MinGW gcc prior to version 4.3 is to use the stabs format, which is not supported by -Dr. Memory. Pass the \p -ggdb option to gcc to generate DWARF2 format +Dr. Memory. Pass the \p -ggdb option to gcc to generate DWARF format instead. You install the MinGW compiler in a Cygwin installation by running the diff --git a/drmemory/drmemory.c b/drmemory/drmemory.c index aa8f792bf..4b278390f 100644 --- a/drmemory/drmemory.c +++ b/drmemory/drmemory.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2010-2021 Google, Inc. All rights reserved. + * Copyright (c) 2010-2024 Google, Inc. All rights reserved. * Copyright (c) 2007-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -150,7 +150,7 @@ up_one_dir(const char *string) * dr_get_client_path()/../fname */ bool -obtain_configfile_path(char *buf OUT, size_t bufsz, const char *fname) +obtain_configfile_path(char *buf DR_PARAM_OUT, size_t bufsz, const char *fname) { const char *mypath = dr_get_client_path(client_id); /* Windows kernel doesn't like paths with .. (0xc0000033 = @@ -354,7 +354,7 @@ typedef struct _persist_data_t { static size_t event_persist_ro_size(void *drcontext, void *perscxt, size_t file_offs, - void **user_data OUT) + void **user_data DR_PARAM_OUT) { return sizeof(persist_data_t) + instrument_persist_ro_size(drcontext, perscxt); @@ -376,7 +376,7 @@ event_persist_ro(void *drcontext, void *perscxt, file_t fd, void *user_data) } static bool -event_resurrect_ro(void *drcontext, void *perscxt, byte **map INOUT) +event_resurrect_ro(void *drcontext, void *perscxt, byte **map DR_PARAM_INOUT) { persist_data_t *pd = (persist_data_t *) *map; *map += sizeof(*pd); diff --git a/drmemory/drmemory.h b/drmemory/drmemory.h index 8586deb81..869e401ca 100644 --- a/drmemory/drmemory.h +++ b/drmemory/drmemory.h @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2011-2021 Google, Inc. All rights reserved. + * Copyright (c) 2011-2024 Google, Inc. All rights reserved. * Copyright (c) 2007-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -99,7 +99,7 @@ extern uint num_nudges; #endif /* STATISTICS */ bool -obtain_configfile_path(char *buf OUT, size_t bufsz, const char *fname); +obtain_configfile_path(char *buf DR_PARAM_OUT, size_t bufsz, const char *fname); #ifdef UNIX diff --git a/drmemory/fuzzer.c b/drmemory/fuzzer.c index 498b48fbb..64f813b04 100644 --- a/drmemory/fuzzer.c +++ b/drmemory/fuzzer.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2015-2017 Google, Inc. All rights reserved. + * Copyright (c) 2015-2024 Google, Inc. All rights reserved. * **********************************************************/ /* Dr. Memory: the memory debugger @@ -819,7 +819,8 @@ log_target_buffer(void *dcontext, uint loglevel, fuzz_state_t *thread) } size_t -fuzzer_error_report(IN void *dcontext, OUT char *notify, IN size_t notify_size, int eid) +fuzzer_error_report(DR_PARAM_IN void *dcontext, DR_PARAM_OUT char *notify, + DR_PARAM_IN size_t notify_size, int eid) { ssize_t len = 0; size_t sofar = 0; @@ -1079,7 +1080,7 @@ create_shadow_state(void *dcontext) } static bool -init_thread_shadow_state(OUT shadow_state_t **shadow_out) +init_thread_shadow_state(DR_PARAM_OUT shadow_state_t **shadow_out) { drmf_status_t res; shadow_state_t *shadow; @@ -1807,8 +1808,8 @@ tokenizer_exit_with_usage_error() } static bool -tokenizer_copy_to(IN tokenizer_t *t, IN const char *to, OUT size_t *len, - OUT char **token) +tokenizer_copy_to(DR_PARAM_IN tokenizer_t *t, DR_PARAM_IN const char *to, + DR_PARAM_OUT size_t *len, DR_PARAM_OUT char **token) { *len = (to + 1/*null-term*/ - t->src); *token = global_alloc(*len, t->type); @@ -1823,7 +1824,7 @@ tokenizer_copy_to(IN tokenizer_t *t, IN const char *to, OUT size_t *len, } static bool -tokenizer_has_next(IN tokenizer_t *t, IN char delimiter) +tokenizer_has_next(DR_PARAM_IN tokenizer_t *t, DR_PARAM_IN char delimiter) { const char *next_ptr = NULL; @@ -1834,8 +1835,9 @@ tokenizer_has_next(IN tokenizer_t *t, IN char delimiter) } static bool -tokenizer_find_next(IN tokenizer_t *t, OUT const char **src_ptr_out, IN char delim, - IN char raw_delim, IN const char *field_name) +tokenizer_find_next(DR_PARAM_IN tokenizer_t *t, DR_PARAM_OUT const char **src_ptr_out, + DR_PARAM_IN char delim, DR_PARAM_IN char raw_delim, + DR_PARAM_IN const char *field_name) { const char *src_ptr = NULL; @@ -1858,8 +1860,9 @@ tokenizer_find_next(IN tokenizer_t *t, OUT const char **src_ptr_out, IN char del } static bool -tokenizer_copy_next(IN tokenizer_t *t, OUT size_t *len, OUT char **token, - IN char delimiter, IN const char *field_name) +tokenizer_copy_next(DR_PARAM_IN tokenizer_t *t, DR_PARAM_OUT size_t *len, + DR_PARAM_OUT char **token, DR_PARAM_IN char delimiter, + DR_PARAM_IN const char *field_name) { const char *src_ptr = NULL; @@ -1870,8 +1873,9 @@ tokenizer_copy_next(IN tokenizer_t *t, OUT size_t *len, OUT char **token, } static bool -tokenizer_next_int(IN tokenizer_t *t, OUT byte *dst, IN char delimiter, - IN bool hex, IN bool is_64, IN const char *field_name) +tokenizer_next_int(DR_PARAM_IN tokenizer_t *t, DR_PARAM_OUT byte *dst, + DR_PARAM_IN char delimiter, DR_PARAM_IN bool hex, + DR_PARAM_IN bool is_64, DR_PARAM_IN const char *field_name) { size_t len; char *src; @@ -1892,7 +1896,8 @@ tokenizer_next_int(IN tokenizer_t *t, OUT byte *dst, IN char delimiter, * `chrs`. If found, return true and point `res` to that character within `t->src`. */ static bool -tokenizer_strchrs(IN tokenizer_t *t, OUT const char **res, IN const char *chrs) +tokenizer_strchrs(DR_PARAM_IN tokenizer_t *t, DR_PARAM_OUT const char **res, + DR_PARAM_IN const char *chrs) { const char *c, *c_ptr, *first_match = NULL; uint first_match_len = 0xffffffff; diff --git a/drmemory/fuzzer.h b/drmemory/fuzzer.h index 7a451c84b..c7d20ca31 100644 --- a/drmemory/fuzzer.h +++ b/drmemory/fuzzer.h @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2015 Google, Inc. All rights reserved. + * Copyright (c) 2015-2024 Google, Inc. All rights reserved. * **********************************************************/ /* Dr. Memory: the memory debugger @@ -88,7 +88,7 @@ fuzzer_set_singleton_input(const char *input_value); * true if any thread was fuzzing; i.e., if anything was written to user_message. */ size_t -fuzzer_error_report(IN void *dcontext, OUT char *user_message, IN size_t size, - int error_id); +fuzzer_error_report(DR_PARAM_IN void *dcontext, DR_PARAM_OUT char *user_message, + DR_PARAM_IN size_t size, int error_id); #endif /* _FUZZER_H_ */ diff --git a/drmemory/handlecheck.c b/drmemory/handlecheck.c index f8e659c76..b741d5d7f 100644 --- a/drmemory/handlecheck.c +++ b/drmemory/handlecheck.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2012-2014 Google, Inc. All rights reserved. + * Copyright (c) 2012-2024 Google, Inc. All rights reserved. * **********************************************************/ /* Dr. Memory: the memory debugger @@ -83,15 +83,15 @@ static hashtable_t gdi_handle_table; static hashtable_t user_handle_table; /* handle enumeration data structures and routines */ -GET_NTDLL(NtQuerySystemInformation, (IN SYSTEM_INFORMATION_CLASS info_class, - OUT PVOID info, - IN ULONG info_size, - OUT PULONG bytes_received)); -GET_NTDLL(NtQueryInformationProcess, (IN HANDLE ProcessHandle, - IN PROCESSINFOCLASS ProcessInformationClass, - OUT PVOID ProcessInformation, - IN ULONG ProcessInformationLength, - OUT PULONG ReturnLength OPTIONAL)); +GET_NTDLL(NtQuerySystemInformation, (DR_PARAM_IN SYSTEM_INFORMATION_CLASS info_class, + DR_PARAM_OUT PVOID info, + DR_PARAM_IN ULONG info_size, + DR_PARAM_OUT PULONG bytes_received)); +GET_NTDLL(NtQueryInformationProcess, (DR_PARAM_IN HANDLE ProcessHandle, + DR_PARAM_IN PROCESSINFOCLASS ProcessInformationClass, + DR_PARAM_OUT PVOID ProcessInformation, + DR_PARAM_IN ULONG ProcessInformationLength, + DR_PARAM_OUT PULONG ReturnLength OPTIONAL)); #define SYSTEM_HANDLE_INFORMATION_SIZE_INIT 0x10000 #define SYSTEM_HANDLE_INFORMATION_LIST_SIZE(x) \ @@ -127,7 +127,7 @@ print_handle_list(SYSTEM_HANDLE_INFORMATION *list) /* the caller must free the list by calling free_system_handle_list */ static SYSTEM_HANDLE_INFORMATION * -get_system_handle_list(OUT size_t *size_out) +get_system_handle_list(DR_PARAM_OUT size_t *size_out) { NTSTATUS res; SYSTEM_HANDLE_INFORMATION *list; @@ -450,7 +450,7 @@ handlecheck_handle_add(hashtable_t *table, HANDLE handle, /* the caller must hold the handle table lock */ static bool handlecheck_handle_remove(hashtable_t *table, HANDLE handle, - handle_callstack_info_t **hci OUT) + handle_callstack_info_t **hci DR_PARAM_OUT) { bool res; diff --git a/drmemory/instru.c b/drmemory/instru.c index 24a158261..04fb0f5a2 100644 --- a/drmemory/instru.c +++ b/drmemory/instru.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2010-2021 Google, Inc. All rights reserved. + * Copyright (c) 2010-2024 Google, Inc. All rights reserved. * Copyright (c) 2008-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -91,7 +91,7 @@ bool first_bb = true; #ifdef TOOL_DR_MEMORY static dr_emit_flags_t instru_event_bb_app2app(void *drcontext, void *tag, instrlist_t *bb, - bool for_trace, bool translating, OUT void **user_data); + bool for_trace, bool translating, DR_PARAM_OUT void **user_data); static dr_emit_flags_t instru_event_bb_analysis(void *drcontext, void *tag, instrlist_t *bb, @@ -481,7 +481,7 @@ populate_us2app_table(void) #endif bool -instrument_resurrect_ro(void *drcontext, void *perscxt, byte **map INOUT) +instrument_resurrect_ro(void *drcontext, void *perscxt, byte **map DR_PARAM_INOUT) { bool ok = true; if (!INSTRUMENT_MEMREFS()) @@ -931,7 +931,7 @@ convert_repstr_to_loop(void *drcontext, instrlist_t *bb, bb_info_t *bi, /* Conversions to app code itself that should happen before instrumentation */ static dr_emit_flags_t instru_event_bb_app2app(void *drcontext, void *tag, instrlist_t *bb, - bool for_trace, bool translating, OUT void **user_data) + bool for_trace, bool translating, DR_PARAM_OUT void **user_data) { bb_info_t *bi; diff --git a/drmemory/instru.h b/drmemory/instru.h index 433fd5e79..353fa9372 100644 --- a/drmemory/instru.h +++ b/drmemory/instru.h @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2010-2015 Google, Inc. All rights reserved. + * Copyright (c) 2010-2024 Google, Inc. All rights reserved. * Copyright (c) 2008-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -52,7 +52,7 @@ bool instrument_persist_ro(void *drcontext, void *perscxt, file_t fd); bool -instrument_resurrect_ro(void *drcontext, void *perscxt, byte **map INOUT); +instrument_resurrect_ro(void *drcontext, void *perscxt, byte **map DR_PARAM_INOUT); void bb_save_add_entry(app_pc key, bb_saved_info_t *save); diff --git a/drmemory/leak.c b/drmemory/leak.c index 208f19639..f35520896 100644 --- a/drmemory/leak.c +++ b/drmemory/leak.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2011-2021 Google, Inc. All rights reserved. + * Copyright (c) 2011-2024 Google, Inc. All rights reserved. * Copyright (c) 2008-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -1309,7 +1309,7 @@ malloc_iterate_build_tree_cb(malloc_info_t *info, void *iter_data) } static void -prepare_thread_for_scan(void *drcontext, bool *was_app_state OUT) +prepare_thread_for_scan(void *drcontext, bool *was_app_state DR_PARAM_OUT) { ASSERT(was_app_state != NULL, "invalid param"); *was_app_state = dr_using_app_state(drcontext); diff --git a/drmemory/replace.c b/drmemory/replace.c index 68727dcc7..0d3ad4e77 100644 --- a/drmemory/replace.c +++ b/drmemory/replace.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2010-2021 Google, Inc. All rights reserved. + * Copyright (c) 2010-2024 Google, Inc. All rights reserved. * Copyright (c) 2008-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -1227,7 +1227,7 @@ find_syms_regex(sym_enum_data_t *edata, const char *regex) * RPC_STATUS UuidCreate(UUID __RPC_FAR *Uuid); */ static void -wrap_UuidCreate_pre(void *wrapcxt, OUT void **user_data) +wrap_UuidCreate_pre(void *wrapcxt, DR_PARAM_OUT void **user_data) { /* Save arg to mark as initialized afterwards. */ *user_data = drwrap_get_arg(wrapcxt, 0); diff --git a/drmemory/report.c b/drmemory/report.c index 1138ce839..18760fd6e 100644 --- a/drmemory/report.c +++ b/drmemory/report.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2010-2021 Google, Inc. All rights reserved. + * Copyright (c) 2010-2024 Google, Inc. All rights reserved. * Copyright (c) 2008-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -587,7 +587,7 @@ suppress_spec_finish(suppress_spec_t *spec, static bool suppress_spec_prefix_line(suppress_spec_t *spec, const char *cstack_start, const char *line_in, size_t line_len, int brace_line, - const char *line, bool *skip OUT) + const char *line, bool *skip DR_PARAM_OUT) { const char *c; if (skip != NULL) @@ -1110,7 +1110,7 @@ stack_matches_suppression(const error_callstack_t *ecs, const suppress_spec_t *s static bool on_suppression_list_helper(uint type, error_callstack_t *ecs, - suppress_spec_t **matched OUT) + suppress_spec_t **matched DR_PARAM_OUT) { suppress_spec_t *spec; ASSERT(type >= 0 && type < ERROR_MAX_VAL, "invalid error type"); @@ -1134,7 +1134,7 @@ on_suppression_list_helper(uint type, error_callstack_t *ecs, } static bool -on_suppression_list(uint type, error_callstack_t *ecs, suppress_spec_t **matched OUT) +on_suppression_list(uint type, error_callstack_t *ecs, suppress_spec_t **matched DR_PARAM_OUT) { ASSERT(type >= 0 && type < ERROR_MAX_VAL, "invalid error type"); if (on_suppression_list_helper(type, ecs, matched)) @@ -2215,7 +2215,7 @@ record_error(uint type, packed_callstack_t *pcs, app_loc_t *loc, dr_mcontext_t * * This two-part scheme allows putting heap info in the error title (i#1593). */ static void -gather_heap_info(INOUT error_toprint_t *etp, app_pc addr, size_t sz) +gather_heap_info(DR_PARAM_INOUT error_toprint_t *etp, app_pc addr, size_t sz) { byte *start, *end; ssize_t size; @@ -2404,8 +2404,9 @@ gather_heap_info(INOUT error_toprint_t *etp, app_pc addr, size_t sz) * XXX PR 423750: provide this info on dups not just 1st unique. */ static void -report_heap_info(IN error_toprint_t *etp, OUT char *buf, size_t bufsz, size_t *sofar, - app_pc addr, size_t sz, bool invalid_heap_arg, bool for_log) +report_heap_info(DR_PARAM_IN error_toprint_t *etp, DR_PARAM_OUT char *buf, size_t bufsz, + size_t *sofar, app_pc addr, size_t sz, bool invalid_heap_arg, + bool for_log) { void *drcontext = dr_get_current_drcontext(); ssize_t len = 0; diff --git a/drmemory/shadow.c b/drmemory/shadow.c index 6db0369dd..0127a5da5 100644 --- a/drmemory/shadow.c +++ b/drmemory/shadow.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2010-2021 Google, Inc. All rights reserved. + * Copyright (c) 2010-2024 Google, Inc. All rights reserved. * Copyright (c) 2007-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -356,7 +356,7 @@ shadow_get_special(app_pc addr, uint *val) */ /* it also has the racy problem on accessing partial byte, xref i#271 */ uint -shadow_get_byte(INOUT umbra_shadow_memory_info_t *info, app_pc addr) +shadow_get_byte(DR_PARAM_INOUT umbra_shadow_memory_info_t *info, app_pc addr) { ptr_uint_t idx; if (addr < info->app_base || addr >= info->app_base + info->app_size) { @@ -384,7 +384,7 @@ shadow_get_byte(INOUT umbra_shadow_memory_info_t *info, app_pc addr) /* Returns the byte that shadows the 4-byte-aligned address */ /* see comment in shadow_get_byte about using umbra_shadow_memory_info_t */ uint -shadow_get_dword(INOUT umbra_shadow_memory_info_t *info, app_pc addr) +shadow_get_dword(DR_PARAM_INOUT umbra_shadow_memory_info_t *info, app_pc addr) { ptr_uint_t idx; if (addr < info->app_base || addr >= info->app_base + info->app_size) { @@ -411,7 +411,7 @@ shadow_get_dword(INOUT umbra_shadow_memory_info_t *info, app_pc addr) #ifdef X64 uint -shadow_get_qword(INOUT umbra_shadow_memory_info_t *info, app_pc addr) +shadow_get_qword(DR_PARAM_INOUT umbra_shadow_memory_info_t *info, app_pc addr) { ptr_uint_t idx; if (addr < info->app_base || addr >= info->app_base + info->app_size) { @@ -438,7 +438,7 @@ shadow_get_qword(INOUT umbra_shadow_memory_info_t *info, app_pc addr) #endif uint -shadow_get_ptrsz(INOUT umbra_shadow_memory_info_t *info, app_pc addr) +shadow_get_ptrsz(DR_PARAM_INOUT umbra_shadow_memory_info_t *info, app_pc addr) { #ifdef X64 return shadow_get_qword(info, addr); @@ -450,7 +450,7 @@ shadow_get_ptrsz(INOUT umbra_shadow_memory_info_t *info, app_pc addr) /* Sets the two bits for the byte at the passed-in address */ /* see comment in shadow_get_byte about using umbra_shadow_memory_info_t */ void -shadow_set_byte(INOUT umbra_shadow_memory_info_t *info, app_pc addr, uint val) +shadow_set_byte(DR_PARAM_INOUT umbra_shadow_memory_info_t *info, app_pc addr, uint val) { ASSERT(val <= 4, "invalid shadow value"); if (addr < info->app_base || addr >= info->app_base + info->app_size) { diff --git a/drmemory/shadow.h b/drmemory/shadow.h index cb48a4e8c..82d0ba24d 100644 --- a/drmemory/shadow.h +++ b/drmemory/shadow.h @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2010-2017 Google, Inc. All rights reserved. + * Copyright (c) 2010-2024 Google, Inc. All rights reserved. * Copyright (c) 2007-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -173,27 +173,27 @@ shadow_get_special(app_pc addr, uint *val); */ /* it also has the racy problem on accessing partial byte, xref i#271 */ uint -shadow_get_byte(INOUT umbra_shadow_memory_info_t *info, app_pc addr); +shadow_get_byte(DR_PARAM_INOUT umbra_shadow_memory_info_t *info, app_pc addr); /* Returns the byte that shadows the 4-byte-aligned address */ /* see comment in shadow_get_byte about using umbra_shadow_memory_info_t */ uint -shadow_get_dword(INOUT umbra_shadow_memory_info_t *info, app_pc addr); +shadow_get_dword(DR_PARAM_INOUT umbra_shadow_memory_info_t *info, app_pc addr); #ifdef X64 /* Returns the byte that shadows the 8-byte-aligned address */ /* see comment in shadow_get_byte about using umbra_shadow_memory_info_t */ uint -shadow_get_qword(INOUT umbra_shadow_memory_info_t *info, app_pc addr); +shadow_get_qword(DR_PARAM_INOUT umbra_shadow_memory_info_t *info, app_pc addr); #endif uint -shadow_get_ptrsz(INOUT umbra_shadow_memory_info_t *info, app_pc addr); +shadow_get_ptrsz(DR_PARAM_INOUT umbra_shadow_memory_info_t *info, app_pc addr); /* Sets the two bits for the byte at the passed-in address */ /* see comment in shadow_get_byte about using umbra_shadow_memory_info_t */ void -shadow_set_byte(INOUT umbra_shadow_memory_info_t *info, app_pc addr, uint val); +shadow_set_byte(DR_PARAM_INOUT umbra_shadow_memory_info_t *info, app_pc addr, uint val); /* Converts the special shadow block for addr to non-special * and returns a pointer to the same offset within the new diff --git a/drmemory/slowpath.c b/drmemory/slowpath.c index 27e65e3a0..cdcf02399 100644 --- a/drmemory/slowpath.c +++ b/drmemory/slowpath.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2010-2017 Google, Inc. All rights reserved. + * Copyright (c) 2010-2024 Google, Inc. All rights reserved. * Copyright (c) 2008-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -329,7 +329,7 @@ shadow_combine_init(shadow_combine_t *comb, instr_t *inst, uint opcode, uint max * comb->dst to be assigned to the destination. */ static void -integrate_register_shadow(shadow_combine_t *comb INOUT, int opnum, +integrate_register_shadow(shadow_combine_t *comb DR_PARAM_INOUT, int opnum, reg_id_t reg, uint shadow, bool pushpop) { uint i, sz; @@ -374,7 +374,7 @@ integrate_register_shadow(shadow_combine_t *comb INOUT, int opnum, /* Assigns the array of source shadow_vals to the destination register shadow */ static void -assign_register_shadow(shadow_combine_t *comb INOUT, int opnum, opnd_t opnd, +assign_register_shadow(shadow_combine_t *comb DR_PARAM_INOUT, int opnum, opnd_t opnd, reg_id_t reg, bool pushpop) { uint shift = 0; @@ -1425,7 +1425,7 @@ bool handle_mem_ref_internal(uint flags, app_loc_t *loc, app_pc addr, size_t sz, dr_mcontext_t *mc, /* these 2 are required for MEMREF_USE_VALUES */ - int opnum, shadow_combine_t *comb INOUT) + int opnum, shadow_combine_t *comb DR_PARAM_INOUT) { uint i; bool allgood = true; @@ -1760,7 +1760,7 @@ handle_mem_ref(uint flags, app_loc_t *loc, app_pc addr, size_t sz, dr_mcontext_t bool check_mem_opnd(uint opc, uint flags, app_loc_t *loc, opnd_t opnd, uint sz, - dr_mcontext_t *mc, int opnum, shadow_combine_t *comb INOUT) + dr_mcontext_t *mc, int opnum, shadow_combine_t *comb DR_PARAM_INOUT) { app_pc addr = NULL; #ifdef TOOL_DR_MEMORY diff --git a/drmemory/slowpath.h b/drmemory/slowpath.h index 7174d13ca..a80bb8358 100644 --- a/drmemory/slowpath.h +++ b/drmemory/slowpath.h @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2010-2018 Google, Inc. All rights reserved. + * Copyright (c) 2010-2024 Google, Inc. All rights reserved. * Copyright (c) 2008-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -66,7 +66,7 @@ enum { MEMREF_WRITE = 0x001, MEMREF_PUSHPOP = 0x002, /* the stack slot mem ref of push/pop */ MEMREF_CHECK_DEFINEDNESS = 0x004, - MEMREF_USE_VALUES = 0x008, /* for read, OUT; for write, IN */ + MEMREF_USE_VALUES = 0x008, /* for read, OUT; for write, DR_PARAM_IN */ MEMREF_SINGLE_BYTE = 0x010, /* keep using 1st byte in array */ MEMREF_SINGLE_WORD = 0x020, /* keep using 1st 2 bytes in array */ MEMREF_SINGLE_DWORD = 0x040, /* keep using 1st 4 bytes in array */ diff --git a/drmemory/slowpath_arch.h b/drmemory/slowpath_arch.h index 0340fe0d8..bd3b40e1e 100644 --- a/drmemory/slowpath_arch.h +++ b/drmemory/slowpath_arch.h @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2010-2015 Google, Inc. All rights reserved. + * Copyright (c) 2010-2024 Google, Inc. All rights reserved. * Copyright (c) 2008-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -134,22 +134,22 @@ register_shadow_mark_defined(reg_id_t reg, size_t sz); * what's already there. */ void -map_src_to_dst(shadow_combine_t *comb INOUT, int opnum, int src_bytenum, uint shadow); +map_src_to_dst(shadow_combine_t *comb DR_PARAM_INOUT, int opnum, int src_bytenum, uint shadow); /* Returns whether the definedness values changed at all */ bool check_andor_sources(void *drcontext, dr_mcontext_t *mc, instr_t *inst, - shadow_combine_t *comb INOUT, app_pc next_pc); + shadow_combine_t *comb DR_PARAM_INOUT, app_pc next_pc); /* Returns whether to skip the general integration */ bool -integrate_register_shadow_arch(shadow_combine_t *comb INOUT, int opnum, +integrate_register_shadow_arch(shadow_combine_t *comb DR_PARAM_INOUT, int opnum, reg_id_t reg, uint shadow, bool pushpop); /* Returns whether to skip the general assignment code */ bool -assign_register_shadow_arch(shadow_combine_t *comb INOUT, int opnum, opnd_t opnd, - reg_id_t reg, bool pushpop, uint *shift INOUT); +assign_register_shadow_arch(shadow_combine_t *comb DR_PARAM_INOUT, int opnum, opnd_t opnd, + reg_id_t reg, bool pushpop, uint *shift DR_PARAM_INOUT); /* Returns whether it handled the instruction */ bool @@ -160,11 +160,11 @@ slowpath_update_app_loc_arch(uint opc, app_pc decode_pc, app_loc_t *loc); bool check_mem_opnd(uint opc, uint flags, app_loc_t *loc, opnd_t opnd, uint sz, - dr_mcontext_t *mc, int opnum, shadow_combine_t *comb INOUT); + dr_mcontext_t *mc, int opnum, shadow_combine_t *comb DR_PARAM_INOUT); bool check_mem_opnd_arch(uint opc, uint flags, app_loc_t *loc, opnd_t opnd, uint sz, - dr_mcontext_t *mc, int opnum, shadow_combine_t *comb INOUT); + dr_mcontext_t *mc, int opnum, shadow_combine_t *comb DR_PARAM_INOUT); bool check_undefined_exceptions(bool pushpop, bool write, app_loc_t *loc, app_pc addr, diff --git a/drmemory/slowpath_arm.c b/drmemory/slowpath_arm.c index 9563aa026..04a41faa9 100644 --- a/drmemory/slowpath_arm.c +++ b/drmemory/slowpath_arm.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2015-2018 Google, Inc. All rights reserved. + * Copyright (c) 2015-2024 Google, Inc. All rights reserved. * **********************************************************/ /* Dr. Memory: the memory debugger @@ -230,7 +230,7 @@ opc_dst_subreg_nonlow(int opc) * what's already there. */ void -map_src_to_dst(shadow_combine_t *comb INOUT, int opnum, int src_bytenum, uint shadow) +map_src_to_dst(shadow_combine_t *comb DR_PARAM_INOUT, int opnum, int src_bytenum, uint shadow) { ASSERT_NOT_IMPLEMENTED(); /* FIXME i#1726: NYI */ } @@ -247,7 +247,7 @@ instr_needs_all_srcs_and_vals(instr_t *inst) /* Returns whether the definedness values changed at all */ bool check_andor_sources(void *drcontext, dr_mcontext_t *mc, instr_t *inst, - shadow_combine_t *comb INOUT, app_pc next_pc) + shadow_combine_t *comb DR_PARAM_INOUT, app_pc next_pc) { ASSERT_NOT_IMPLEMENTED(); /* FIXME i#1726: NYI */ return false; @@ -255,7 +255,7 @@ check_andor_sources(void *drcontext, dr_mcontext_t *mc, instr_t *inst, /* Returns whether to skip the general integration */ bool -integrate_register_shadow_arch(shadow_combine_t *comb INOUT, int opnum, +integrate_register_shadow_arch(shadow_combine_t *comb DR_PARAM_INOUT, int opnum, reg_id_t reg, uint shadow, bool pushpop) { return false; @@ -263,8 +263,8 @@ integrate_register_shadow_arch(shadow_combine_t *comb INOUT, int opnum, /* Returns whether to skip the general assignment code */ bool -assign_register_shadow_arch(shadow_combine_t *comb INOUT, int opnum, opnd_t opnd, - reg_id_t reg, bool pushpop, uint *shift INOUT) +assign_register_shadow_arch(shadow_combine_t *comb DR_PARAM_INOUT, int opnum, opnd_t opnd, + reg_id_t reg, bool pushpop, uint *shift DR_PARAM_INOUT) { return false; } @@ -300,7 +300,7 @@ slowpath_update_app_loc_arch(uint opc, app_pc decode_pc, app_loc_t *loc) bool check_mem_opnd_arch(uint opc, uint flags, app_loc_t *loc, opnd_t opnd, uint sz, - dr_mcontext_t *mc, int opnum, shadow_combine_t *comb INOUT) + dr_mcontext_t *mc, int opnum, shadow_combine_t *comb DR_PARAM_INOUT) { return false; } diff --git a/drmemory/slowpath_x86.c b/drmemory/slowpath_x86.c index 4adce0848..9a4aedcee 100644 --- a/drmemory/slowpath_x86.c +++ b/drmemory/slowpath_x86.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2010-2019 Google, Inc. All rights reserved. + * Copyright (c) 2010-2024 Google, Inc. All rights reserved. * Copyright (c) 2008-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -957,8 +957,8 @@ opc_dst_subreg_nonlow(int opc) * allowing for use on packed shifts as well as GPR shifts. */ static bool -map_src_to_dst_shift(shadow_combine_t *comb INOUT, uint opc, int opnum, int src_bytenum, - uint src_offs, uint opsz, uint shadow) +map_src_to_dst_shift(shadow_combine_t *comb DR_PARAM_INOUT, uint opc, int opnum, + int src_bytenum, uint src_offs, uint opsz, uint shadow) { reg_t shift; /* Be sure to use opsz, the element size, NOT comb->opsz; similarly, use @@ -1044,7 +1044,8 @@ map_src_to_dst_shift(shadow_combine_t *comb INOUT, uint opc, int opnum, int src_ * what's already there. */ void -map_src_to_dst(shadow_combine_t *comb INOUT, int opnum, int src_bytenum, uint shadow) +map_src_to_dst(shadow_combine_t *comb DR_PARAM_INOUT, int opnum, int src_bytenum, + uint shadow) { int opc = comb->opcode; uint opsz = comb->opsz; @@ -1586,7 +1587,7 @@ xor_bitfield_mark_defined(opnd_t op, dr_mcontext_t *mc, opnd_t and_src, opnd_t a static bool xor_bitfield_check_instr(void *drcontext, dr_mcontext_t *mc, instr_t *and, instr_t *xor, - shadow_combine_t *comb INOUT, size_t sz) + shadow_combine_t *comb DR_PARAM_INOUT, size_t sz) { bool matches = false; /* While someone could construct an L4 OP_and where src0==dst0 (or @@ -1626,7 +1627,7 @@ xor_bitfield_check_instr(void *drcontext, dr_mcontext_t *mc, instr_t *and, instr static bool check_xor_bitfield(void *drcontext, dr_mcontext_t *mc, instr_t *inst, - shadow_combine_t *comb INOUT, size_t sz, app_pc next_pc) + shadow_combine_t *comb DR_PARAM_INOUT, size_t sz, app_pc next_pc) { bool matches = false; instr_t xor; @@ -1753,7 +1754,7 @@ check_and_not_test(void *drcontext, dr_mcontext_t *mc, instr_t *and, app_pc next static bool -check_andor_bitmask_immed(int opc, size_t sz, reg_t immed, bool *byte_bounds OUT) +check_andor_bitmask_immed(int opc, size_t sz, reg_t immed, bool *byte_bounds DR_PARAM_OUT) { /* For i#849, we're looking for OP_and with a constant that sets a contiguous * sequence of bits to 0 and leaves the rest alone: used to initialize @@ -1809,7 +1810,7 @@ check_andor_bitmask_immed(int opc, size_t sz, reg_t immed, bool *byte_bounds OUT /* Returns whether the definedness values changed at all */ bool check_andor_sources(void *drcontext, dr_mcontext_t *mc, instr_t *inst, - shadow_combine_t *comb INOUT, app_pc next_pc) + shadow_combine_t *comb DR_PARAM_INOUT, app_pc next_pc) { /* The two sources have been laid out side-by-side in comb->dst. * We need to combine, with special rules that suppress undefinedness @@ -1956,7 +1957,7 @@ check_andor_sources(void *drcontext, dr_mcontext_t *mc, instr_t *inst, /* Returns whether to skip the general integration */ bool -integrate_register_shadow_arch(shadow_combine_t *comb INOUT, int opnum, +integrate_register_shadow_arch(shadow_combine_t *comb DR_PARAM_INOUT, int opnum, reg_id_t reg, uint shadow, bool pushpop) { uint opc = comb->opcode; @@ -1968,8 +1969,8 @@ integrate_register_shadow_arch(shadow_combine_t *comb INOUT, int opnum, /* Returns whether to skip the general assignment code */ bool -assign_register_shadow_arch(shadow_combine_t *comb INOUT, int opnum, opnd_t opnd, - reg_id_t reg, bool pushpop, uint *shift INOUT) +assign_register_shadow_arch(shadow_combine_t *comb DR_PARAM_INOUT, int opnum, opnd_t opnd, + reg_id_t reg, bool pushpop, uint *shift DR_PARAM_INOUT) { int opc = comb->opcode; @@ -2373,7 +2374,7 @@ get_stringop_range(reg_t base, reg_t count, reg_t eflags, uint opsz, bool check_mem_opnd_arch(uint opc, uint flags, app_loc_t *loc, opnd_t opnd, uint sz, - dr_mcontext_t *mc, int opnum, shadow_combine_t *comb INOUT) + dr_mcontext_t *mc, int opnum, shadow_combine_t *comb DR_PARAM_INOUT) { app_pc addr = NULL, end; if (opc_is_stringop_loop(opc) && diff --git a/drmemory/stack.c b/drmemory/stack.c index d114ee6d1..c8b6c5a00 100644 --- a/drmemory/stack.c +++ b/drmemory/stack.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2011-2019 Google, Inc. All rights reserved. + * Copyright (c) 2011-2024 Google, Inc. All rights reserved. * Copyright (c) 2008-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -100,7 +100,7 @@ check_stack_size_vs_threshold(void *drcontext, size_t stack_size) * If addr is in a small malloc this routine will fail. */ static bool -get_stack_region_bounds(byte *addr, byte **base OUT, size_t *size OUT) +get_stack_region_bounds(byte *addr, byte **base DR_PARAM_OUT, size_t *size DR_PARAM_OUT) { if (is_in_heap_region(addr)) { return malloc_large_lookup(addr, base, size); diff --git a/drmemory/syscall_driver.c b/drmemory/syscall_driver.c index a958e2c91..5ba6a2c3a 100755 --- a/drmemory/syscall_driver.c +++ b/drmemory/syscall_driver.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2011-2014 Google, Inc. All rights reserved. + * Copyright (c) 2011-2024 Google, Inc. All rights reserved. * **********************************************************/ /* Dr. Memory: the memory debugger @@ -39,16 +39,16 @@ */ #define MAX_WRITES_TO_RECORD 64 -GET_NTDLL(NtDeviceIoControlFile, (IN HANDLE FileHandle, - IN HANDLE Event OPTIONAL, - IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, - IN PVOID ApcContext OPTIONAL, - OUT PIO_STATUS_BLOCK IoStatusBlock, - IN ULONG IoControlCode, - IN PVOID InputBuffer OPTIONAL, - IN ULONG InputBufferLength, - OUT PVOID OutputBuffer OPTIONAL, - IN ULONG OutputBufferLength)); +GET_NTDLL(NtDeviceIoControlFile, (DR_PARAM_IN HANDLE FileHandle, + DR_PARAM_IN HANDLE Event OPTIONAL, + DR_PARAM_IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, + DR_PARAM_IN PVOID ApcContext OPTIONAL, + DR_PARAM_OUT PIO_STATUS_BLOCK IoStatusBlock, + DR_PARAM_IN ULONG IoControlCode, + DR_PARAM_IN PVOID InputBuffer OPTIONAL, + DR_PARAM_IN ULONG InputBufferLength, + DR_PARAM_OUT PVOID OutputBuffer OPTIONAL, + DR_PARAM_IN ULONG OutputBufferLength)); /* from winioctl.h */ #define FILE_ANY_ACCESS 0 diff --git a/drsymcache/drsymcache.c b/drsymcache/drsymcache.c index 8f0ebe4f3..9d2288796 100644 --- a/drsymcache/drsymcache.c +++ b/drsymcache/drsymcache.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2011-2021 Google, Inc. All rights reserved. + * Copyright (c) 2011-2024 Google, Inc. All rights reserved. * **********************************************************/ /* Dr. Memory: the memory debugger @@ -706,7 +706,7 @@ drsymcache_init(client_id_t client_id, DR_EXPORT drmf_status_t -drsymcache_is_initialized(bool *is_initialized OUT) +drsymcache_is_initialized(bool *is_initialized DR_PARAM_OUT) { if (is_initialized == NULL) return DRMF_ERROR_INVALID_PARAMETER; @@ -954,7 +954,8 @@ drsymcache_add(const module_data_t *mod, const char *symbol, size_t offs) DR_EXPORT drmf_status_t drsymcache_lookup(const module_data_t *mod, const char *symbol, - size_t **offs_array OUT, uint *num_entries OUT, size_t *offs_single OUT) + size_t **offs_array DR_PARAM_OUT, uint *num_entries DR_PARAM_OUT, + size_t *offs_single DR_PARAM_OUT) { offset_list_t *olist; offset_entry_t *e; diff --git a/drsymcache/drsymcache.h b/drsymcache/drsymcache.h index 465be4ff3..3b634b8a3 100755 --- a/drsymcache/drsymcache.h +++ b/drsymcache/drsymcache.h @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2011-2014 Google, Inc. All rights reserved. + * Copyright (c) 2011-2024 Google, Inc. All rights reserved. * **********************************************************/ /* Dr. Memory: the memory debugger @@ -120,7 +120,7 @@ DR_EXPORT * \return success code. */ drmf_status_t -drsymcache_is_initialized(OUT bool *initialized); +drsymcache_is_initialized(DR_PARAM_OUT bool *initialized); DR_EXPORT /** @@ -132,7 +132,7 @@ DR_EXPORT * \return success code. */ drmf_status_t -drsymcache_module_is_cached(const module_data_t *mod, OUT bool *cached); +drsymcache_module_is_cached(const module_data_t *mod, DR_PARAM_OUT bool *cached); DR_EXPORT /** @@ -146,7 +146,7 @@ DR_EXPORT * \return success code. */ drmf_status_t -drsymcache_module_has_debug_info(const module_data_t *mod, OUT bool *has_debug); +drsymcache_module_has_debug_info(const module_data_t *mod, DR_PARAM_OUT bool *has_debug); DR_EXPORT /** @@ -203,8 +203,8 @@ DR_EXPORT */ drmf_status_t drsymcache_lookup(const module_data_t *mod, const char *symbol, - OUT size_t **offs_array, OUT uint *num_entries, - OUT size_t *offs_single); + DR_PARAM_OUT size_t **offs_array, DR_PARAM_OUT uint *num_entries, + DR_PARAM_OUT size_t *offs_single); DR_EXPORT /** diff --git a/drsyscall/drsyscall.c b/drsyscall/drsyscall.c index 36ffd65de..7a212ce4e 100644 --- a/drsyscall/drsyscall.c +++ b/drsyscall/drsyscall.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2010-2017 Google, Inc. All rights reserved. + * Copyright (c) 2010-2024 Google, Inc. All rights reserved. * Copyright (c) 2007-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -122,7 +122,7 @@ static int drsys_init_count; void *systable_lock; static drsys_param_type_t -map_to_exported_type(uint sysarg_type, size_t *sz_out OUT); +map_to_exported_type(uint sysarg_type, size_t *sz_out DR_PARAM_OUT); /*************************************************************************** * SYSTEM CALLS @@ -216,7 +216,7 @@ check_syscall_gateway(instr_t *inst) DR_EXPORT drmf_status_t -drsys_number_to_syscall(drsys_sysnum_t sysnum, drsys_syscall_t **syscall OUT) +drsys_number_to_syscall(drsys_sysnum_t sysnum, drsys_syscall_t **syscall DR_PARAM_OUT) { syscall_info_t *sysinfo = syscall_lookup(sysnum, true/*resolve 2ndary*/); if (syscall == NULL) @@ -232,7 +232,7 @@ drsys_number_to_syscall(drsys_sysnum_t sysnum, drsys_syscall_t **syscall OUT) DR_EXPORT drmf_status_t -drsys_name_to_syscall(const char *name, drsys_syscall_t **syscall OUT) +drsys_name_to_syscall(const char *name, drsys_syscall_t **syscall DR_PARAM_OUT) { drsys_sysnum_t sysnum; syscall_info_t *sysinfo; @@ -331,7 +331,7 @@ static const syscall_info_t unknown_info_template = DR_EXPORT drmf_status_t -drsys_syscall_is_known(drsys_syscall_t *syscall, bool *known OUT) +drsys_syscall_is_known(drsys_syscall_t *syscall, bool *known DR_PARAM_OUT) { syscall_info_t *sysinfo = (syscall_info_t *) syscall; if (syscall == NULL || known == NULL) @@ -418,7 +418,7 @@ handle_pre_unknown_syscall(void *drcontext, cls_syscall_t *cpt, sysnum.number, sysnum.secondary, i, start); if (ALIGNED(start, 4) && is_byte_addressable(start)) { /* This looks like a memory parameter. It might contain OUT - * values mixed with IN, so we do not stop at the first undefined + * values mixed with DR_PARAM_IN, so we do not stop at the first undefined * byte: instead we stop at an unaddr or at the max size. * We need two passes to know how far we can safely read, * so we go ahead and use dynamically sized memory as well. @@ -621,7 +621,7 @@ get_cur_syscall(cls_syscall_t *pt) DR_EXPORT drmf_status_t -drsys_cur_syscall(void *drcontext, drsys_syscall_t **syscall OUT) +drsys_cur_syscall(void *drcontext, drsys_syscall_t **syscall DR_PARAM_OUT) { cls_syscall_t *pt = (cls_syscall_t *) drmgr_get_cls_field(drcontext, cls_idx_drsys); if (drcontext == NULL || syscall == NULL) @@ -632,7 +632,7 @@ drsys_cur_syscall(void *drcontext, drsys_syscall_t **syscall OUT) DR_EXPORT drmf_status_t -drsys_syscall_succeeded(drsys_syscall_t *syscall, reg_t result, bool *success OUT) +drsys_syscall_succeeded(drsys_syscall_t *syscall, reg_t result, bool *success DR_PARAM_OUT) { #ifdef MACOS /* XXX: we actually could return a value for Mach syscalls */ @@ -651,7 +651,8 @@ drsys_syscall_succeeded(drsys_syscall_t *syscall, reg_t result, bool *success OU static void get_syscall_result(syscall_info_t *sysinfo, cls_syscall_t *pt, - OUT bool *success, OUT uint64 *value, OUT uint *error_code) + DR_PARAM_OUT bool *success, DR_PARAM_OUT uint64 *value, + DR_PARAM_OUT uint *error_code) { bool res = os_syscall_succeeded(sysinfo->num, sysinfo, pt); dr_mcontext_t *mc = &pt->mc; @@ -684,8 +685,8 @@ get_syscall_result(syscall_info_t *sysinfo, cls_syscall_t *pt, DR_EXPORT drmf_status_t -drsys_cur_syscall_result(void *drcontext, OUT bool *success, OUT uint64 *value, - OUT uint *error_code) +drsys_cur_syscall_result(void *drcontext, DR_PARAM_OUT bool *success, + DR_PARAM_OUT uint64 *value, DR_PARAM_OUT uint *error_code) { cls_syscall_t *pt; syscall_info_t *sysinfo; @@ -699,7 +700,7 @@ drsys_cur_syscall_result(void *drcontext, OUT bool *success, OUT uint64 *value, DR_EXPORT drmf_status_t -drsys_pre_syscall_arg(void *drcontext, uint argnum, ptr_uint_t *value OUT) +drsys_pre_syscall_arg(void *drcontext, uint argnum, ptr_uint_t *value DR_PARAM_OUT) { cls_syscall_t *pt = (cls_syscall_t *) drmgr_get_cls_field(drcontext, cls_idx_drsys); if (value == NULL || argnum >= SYSCALL_NUM_ARG_STORE) @@ -710,7 +711,7 @@ drsys_pre_syscall_arg(void *drcontext, uint argnum, ptr_uint_t *value OUT) DR_EXPORT drmf_status_t -drsys_pre_syscall_arg64(void *drcontext, uint argnum, uint64 *value OUT) +drsys_pre_syscall_arg64(void *drcontext, uint argnum, uint64 *value DR_PARAM_OUT) { cls_syscall_t *pt = (cls_syscall_t *) drmgr_get_cls_field(drcontext, cls_idx_drsys); if (value == NULL || argnum >= SYSCALL_NUM_ARG_STORE) @@ -721,7 +722,7 @@ drsys_pre_syscall_arg64(void *drcontext, uint argnum, uint64 *value OUT) DR_EXPORT drmf_status_t -drsys_syscall_name(drsys_syscall_t *syscall, const char **name OUT) +drsys_syscall_name(drsys_syscall_t *syscall, const char **name DR_PARAM_OUT) { syscall_info_t *sysinfo = (syscall_info_t *) syscall; if (syscall == NULL || name == NULL) @@ -732,7 +733,7 @@ drsys_syscall_name(drsys_syscall_t *syscall, const char **name OUT) DR_EXPORT drmf_status_t -drsys_syscall_number(drsys_syscall_t *syscall, drsys_sysnum_t *sysnum OUT) +drsys_syscall_number(drsys_syscall_t *syscall, drsys_sysnum_t *sysnum DR_PARAM_OUT) { syscall_info_t *sysinfo = (syscall_info_t *) syscall; if (syscall == NULL || sysnum == NULL) @@ -743,7 +744,7 @@ drsys_syscall_number(drsys_syscall_t *syscall, drsys_sysnum_t *sysnum OUT) DR_EXPORT drmf_status_t -drsys_get_mcontext(void *drcontext, dr_mcontext_t **mc OUT) +drsys_get_mcontext(void *drcontext, dr_mcontext_t **mc DR_PARAM_OUT) { cls_syscall_t *pt = (cls_syscall_t *) drmgr_get_cls_field(drcontext, cls_idx_drsys); if (mc == NULL) @@ -754,7 +755,7 @@ drsys_get_mcontext(void *drcontext, dr_mcontext_t **mc OUT) DR_EXPORT drmf_status_t -drsys_syscall_return_type(drsys_syscall_t *syscall, drsys_param_type_t *type OUT) +drsys_syscall_return_type(drsys_syscall_t *syscall, drsys_param_type_t *type DR_PARAM_OUT) { syscall_info_t *sysinfo = (syscall_info_t *) syscall; if (syscall == NULL || type == NULL) @@ -851,7 +852,7 @@ mode_from_flags(uint arg_flags) } static drsys_param_type_t -map_to_exported_type(uint sysarg_type, size_t *sz_out OUT) +map_to_exported_type(uint sysarg_type, size_t *sz_out DR_PARAM_OUT) { size_t sz = 0; drsys_param_type_t type = (drsys_param_type_t) sysarg_type; @@ -1609,7 +1610,7 @@ process_post_syscall_reads_and_writes(cls_syscall_t *pt, sysarg_iter_info_t *ii) static syscall_info_t * get_sysinfo(void *drcontext, cls_syscall_t *pt, int initial_num, - drsys_sysnum_t *sysnum OUT) + drsys_sysnum_t *sysnum DR_PARAM_OUT) { syscall_info_t *sysinfo; ASSERT(sysnum != NULL, "invalid param"); diff --git a/drsyscall/drsyscall.h b/drsyscall/drsyscall.h index 93ec1c3bd..a3c9759c3 100755 --- a/drsyscall/drsyscall.h +++ b/drsyscall/drsyscall.h @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2012-2019 Google, Inc. All rights reserved. + * Copyright (c) 2012-2024 Google, Inc. All rights reserved. * **********************************************************/ /* Dr. Memory: the memory debugger @@ -551,7 +551,7 @@ DR_EXPORT * \return success code. */ drmf_status_t -drsys_name_to_syscall(const char *name, OUT drsys_syscall_t **syscall); +drsys_name_to_syscall(const char *name, DR_PARAM_OUT drsys_syscall_t **syscall); DR_EXPORT /** @@ -567,7 +567,7 @@ DR_EXPORT * \return success code. */ drmf_status_t -drsys_number_to_syscall(drsys_sysnum_t sysnum, OUT drsys_syscall_t **syscall); +drsys_number_to_syscall(drsys_sysnum_t sysnum, DR_PARAM_OUT drsys_syscall_t **syscall); DR_EXPORT /** @@ -582,7 +582,7 @@ DR_EXPORT * \return success code. */ drmf_status_t -drsys_syscall_name(drsys_syscall_t *syscall, OUT const char **name); +drsys_syscall_name(drsys_syscall_t *syscall, DR_PARAM_OUT const char **name); DR_EXPORT /** @@ -597,7 +597,7 @@ DR_EXPORT * \return success code. */ drmf_status_t -drsys_syscall_number(drsys_syscall_t *syscall, OUT drsys_sysnum_t *sysnum); +drsys_syscall_number(drsys_syscall_t *syscall, DR_PARAM_OUT drsys_sysnum_t *sysnum); DR_EXPORT /** @@ -612,7 +612,7 @@ DR_EXPORT * \return success code. */ drmf_status_t -drsys_syscall_type(drsys_syscall_t *syscall, OUT drsys_syscall_type_t *type); +drsys_syscall_type(drsys_syscall_t *syscall, DR_PARAM_OUT drsys_syscall_type_t *type); DR_EXPORT /** @@ -627,7 +627,7 @@ DR_EXPORT * \return success code. */ drmf_status_t -drsys_syscall_is_known(drsys_syscall_t *syscall, OUT bool *known); +drsys_syscall_is_known(drsys_syscall_t *syscall, DR_PARAM_OUT bool *known); DR_EXPORT /** @@ -657,7 +657,7 @@ DR_EXPORT * \return success code. */ drmf_status_t -drsys_syscall_succeeded(drsys_syscall_t *syscall, reg_t result, OUT bool *success); +drsys_syscall_succeeded(drsys_syscall_t *syscall, reg_t result, DR_PARAM_OUT bool *success); DR_EXPORT /** @@ -678,7 +678,7 @@ DR_EXPORT * \return success code. */ drmf_status_t -drsys_syscall_return_type(drsys_syscall_t *syscall, OUT drsys_param_type_t *type); +drsys_syscall_return_type(drsys_syscall_t *syscall, DR_PARAM_OUT drsys_param_type_t *type); #ifdef WINDOWS DR_EXPORT @@ -747,7 +747,7 @@ DR_EXPORT * \return success code. */ drmf_status_t -drsys_cur_syscall(void *drcontext, OUT drsys_syscall_t **syscall); +drsys_cur_syscall(void *drcontext, DR_PARAM_OUT drsys_syscall_t **syscall); DR_EXPORT /** @@ -779,8 +779,8 @@ DR_EXPORT * \return success code. */ drmf_status_t -drsys_cur_syscall_result(void *drcontext, OUT bool *success, OUT uint64 *value, - OUT uint *error_code); +drsys_cur_syscall_result(void *drcontext, DR_PARAM_OUT bool *success, DR_PARAM_OUT uint64 *value, + DR_PARAM_OUT uint *error_code); DR_EXPORT /** @@ -807,7 +807,7 @@ DR_EXPORT * slot. */ drmf_status_t -drsys_pre_syscall_arg(void *drcontext, uint argnum, OUT ptr_uint_t *value); +drsys_pre_syscall_arg(void *drcontext, uint argnum, DR_PARAM_OUT ptr_uint_t *value); DR_EXPORT /** @@ -829,7 +829,7 @@ DR_EXPORT * slot. */ drmf_status_t -drsys_pre_syscall_arg64(void *drcontext, uint argnum, OUT uint64 *value); +drsys_pre_syscall_arg64(void *drcontext, uint argnum, DR_PARAM_OUT uint64 *value); DR_EXPORT /** @@ -851,7 +851,7 @@ DR_EXPORT * \return success code. */ drmf_status_t -drsys_get_mcontext(void *drcontext, OUT dr_mcontext_t **mc); +drsys_get_mcontext(void *drcontext, DR_PARAM_OUT dr_mcontext_t **mc); /*************************************************************************** @@ -1000,7 +1000,8 @@ DR_EXPORT * \note Windows-only. */ drmf_status_t -drsys_find_sysnum_libs(OUT char **sysnum_lib_paths, INOUT size_t *num_sysnum_libs); +drsys_find_sysnum_libs(DR_PARAM_OUT char **sysnum_lib_paths, + DR_PARAM_INOUT size_t *num_sysnum_libs); DR_EXPORT /** diff --git a/drsyscall/drsyscall_driver.c b/drsyscall/drsyscall_driver.c index cfcb015de..8625ea64a 100755 --- a/drsyscall/drsyscall_driver.c +++ b/drsyscall/drsyscall_driver.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2011-2014 Google, Inc. All rights reserved. + * Copyright (c) 2011-2024 Google, Inc. All rights reserved. * **********************************************************/ /* Dr. Memory: the memory debugger @@ -38,16 +38,16 @@ */ #define MAX_WRITES_TO_RECORD 64 -GET_NTDLL(NtDeviceIoControlFile, (IN HANDLE FileHandle, - IN HANDLE Event OPTIONAL, - IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, - IN PVOID ApcContext OPTIONAL, - OUT PIO_STATUS_BLOCK IoStatusBlock, - IN ULONG IoControlCode, - IN PVOID InputBuffer OPTIONAL, - IN ULONG InputBufferLength, - OUT PVOID OutputBuffer OPTIONAL, - IN ULONG OutputBufferLength)); +GET_NTDLL(NtDeviceIoControlFile, (DR_PARAM_IN HANDLE FileHandle, + DR_PARAM_IN HANDLE Event OPTIONAL, + DR_PARAM_IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, + DR_PARAM_IN PVOID ApcContext OPTIONAL, + DR_PARAM_OUT PIO_STATUS_BLOCK IoStatusBlock, + DR_PARAM_IN ULONG IoControlCode, + DR_PARAM_IN PVOID InputBuffer OPTIONAL, + DR_PARAM_IN ULONG InputBufferLength, + DR_PARAM_OUT PVOID OutputBuffer OPTIONAL, + DR_PARAM_IN ULONG OutputBufferLength)); /* from winioctl.h */ #define FILE_ANY_ACCESS 0 diff --git a/drsyscall/drsyscall_linux.c b/drsyscall/drsyscall_linux.c index fc79c3dd7..f8c3261cd 100644 --- a/drsyscall/drsyscall_linux.c +++ b/drsyscall/drsyscall_linux.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2010-2016 Google, Inc. All rights reserved. + * Copyright (c) 2010-2024 Google, Inc. All rights reserved. * Copyright (c) 2009-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -182,7 +182,7 @@ drsyscall_os_module_load(void *drcontext, const module_data_t *info, bool loaded } bool -os_syscall_get_num(const char *name, drsys_sysnum_t *num_out OUT) +os_syscall_get_num(const char *name, drsys_sysnum_t *num_out DR_PARAM_OUT) { drsys_sysnum_t *num = (drsys_sysnum_t *) hashtable_lookup(&name2num_table, (void *)name); @@ -246,7 +246,7 @@ drsyscall_os_get_sysparam_location(cls_syscall_t *pt, uint argnum, drsys_arg_t * } drmf_status_t -drsys_syscall_type(drsys_syscall_t *syscall, drsys_syscall_type_t *type OUT) +drsys_syscall_type(drsys_syscall_t *syscall, drsys_syscall_type_t *type DR_PARAM_OUT) { if (syscall == NULL || type == NULL) return DRMF_ERROR_INVALID_PARAMETER; diff --git a/drsyscall/drsyscall_macos.c b/drsyscall/drsyscall_macos.c index ca4aea6a8..36bc5b600 100644 --- a/drsyscall/drsyscall_macos.c +++ b/drsyscall/drsyscall_macos.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2014-2019 Google, Inc. All rights reserved. + * Copyright (c) 2014-2024 Google, Inc. All rights reserved. * **********************************************************/ /* Dr. Memory: the memory debugger @@ -244,7 +244,7 @@ drsyscall_os_module_load(void *drcontext, const module_data_t *info, bool loaded } bool -os_syscall_get_num(const char *name, drsys_sysnum_t *num_out OUT) +os_syscall_get_num(const char *name, drsys_sysnum_t *num_out DR_PARAM_OUT) { drsys_sysnum_t *num = (drsys_sysnum_t *) hashtable_lookup(&name2num_table, (void *)name); @@ -280,7 +280,7 @@ drsyscall_os_get_sysparam_location(cls_syscall_t *pt, uint argnum, drsys_arg_t * } drmf_status_t -drsys_syscall_type(drsys_syscall_t *syscall, drsys_syscall_type_t *type OUT) +drsys_syscall_type(drsys_syscall_t *syscall, drsys_syscall_type_t *type DR_PARAM_OUT) { if (syscall == NULL || type == NULL) return DRMF_ERROR_INVALID_PARAMETER; diff --git a/drsyscall/drsyscall_os.h b/drsyscall/drsyscall_os.h index 6553c6013..b203d27b3 100644 --- a/drsyscall/drsyscall_os.h +++ b/drsyscall/drsyscall_os.h @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2010-2019 Google, Inc. All rights reserved. + * Copyright (c) 2010-2024 Google, Inc. All rights reserved. * Copyright (c) 2007-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -449,7 +449,7 @@ os_syscall_ret_small_write_last(syscall_info_t *info, ptr_int_t res); #endif bool -os_syscall_get_num(const char *name, drsys_sysnum_t *num OUT); +os_syscall_get_num(const char *name, drsys_sysnum_t *num DR_PARAM_OUT); uint sysnum_hash(void *val); diff --git a/drsyscall/drsyscall_windows.c b/drsyscall/drsyscall_windows.c index 2094fba00..993a0fb6b 100755 --- a/drsyscall/drsyscall_windows.c +++ b/drsyscall/drsyscall_windows.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2011-2020 Google, Inc. All rights reserved. + * Copyright (c) 2011-2024 Google, Inc. All rights reserved. * Copyright (c) 2007-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -545,7 +545,7 @@ syscall_num_from_wrapper(void *drcontext, byte *entry) bool syscall_num_from_name(void *drcontext, const module_data_t *info, const char *name, const char *optional_prefix, - bool sym_lookup, drsys_sysnum_t *num_out OUT) + bool sym_lookup, drsys_sysnum_t *num_out DR_PARAM_OUT) { app_pc entry = (app_pc) dr_get_proc_address(info->handle, name); int num = -1; @@ -585,7 +585,7 @@ syscall_num_from_name(void *drcontext, const module_data_t *info, } bool -os_syscall_get_num(const char *name, drsys_sysnum_t *num OUT) +os_syscall_get_num(const char *name, drsys_sysnum_t *num DR_PARAM_OUT) { name2num_entry_t *e = (name2num_entry_t *) hashtable_lookup(&name2num_table, (void *)name); @@ -626,7 +626,7 @@ check_syscall_entry(void *drcontext, const module_data_t *info, syscall_info_t * static bool get_primary_syscall_num(void *drcontext, const module_data_t *info, - syscall_info_t *syslist OUT, const char *optional_prefix) + syscall_info_t *syslist DR_PARAM_OUT, const char *optional_prefix) { bool ok = false; /* Windows version-specific entry feature */ @@ -1236,7 +1236,7 @@ os_syscall_succeeded(drsys_sysnum_t sysnum, syscall_info_t *info, cls_syscall_t DR_EXPORT drmf_status_t -drsys_syscall_type(drsys_syscall_t *syscall, drsys_syscall_type_t *type OUT) +drsys_syscall_type(drsys_syscall_t *syscall, drsys_syscall_type_t *type DR_PARAM_OUT) { syscall_info_t *sysinfo = (syscall_info_t *) syscall; if (syscall == NULL || type == NULL) @@ -2016,11 +2016,11 @@ typedef struct _PROCESS_BASIC_INFORMATION { } PROCESS_BASIC_INFORMATION; typedef PROCESS_BASIC_INFORMATION *PPROCESS_BASIC_INFORMATION; -GET_NTDLL(NtQueryInformationProcess, (IN HANDLE ProcessHandle, - IN PROCESSINFOCLASS ProcessInformationClass, - OUT PVOID ProcessInformation, - IN ULONG ProcessInformationLength, - OUT PULONG ReturnLength OPTIONAL)); +GET_NTDLL(NtQueryInformationProcess, (DR_PARAM_IN HANDLE ProcessHandle, + DR_PARAM_IN PROCESSINFOCLASS ProcessInformationClass, + DR_PARAM_OUT PVOID ProcessInformation, + DR_PARAM_IN ULONG ProcessInformationLength, + DR_PARAM_OUT PULONG ReturnLength OPTIONAL)); static TEB * get_TEB(void) @@ -2656,16 +2656,16 @@ handle_TraceControl(void *drcontext, cls_syscall_t *pt, sysarg_iter_info_t *ii) /* NTSYSAPI NTSTATUS NTAPI ZwDeviceIoControlFile( - IN HANDLE FileHandle, - IN HANDLE Event OPTIONAL, - IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, - IN PVOID ApcContext OPTIONAL, - OUT PIO_STATUS_BLOCK IoStatusBlock, - IN ULONG IoControlCode, - IN PVOID InputBuffer OPTIONAL, - IN ULONG InputBufferLength, - OUT PVOID OutputBuffer OPTIONAL, - IN ULONG OutputBufferLength + DR_PARAM_IN HANDLE FileHandle, + DR_PARAM_IN HANDLE Event OPTIONAL, + DR_PARAM_IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, + DR_PARAM_IN PVOID ApcContext OPTIONAL, + DR_PARAM_OUT PIO_STATUS_BLOCK IoStatusBlock, + DR_PARAM_IN ULONG IoControlCode, + DR_PARAM_IN PVOID InputBuffer OPTIONAL, + DR_PARAM_IN ULONG InputBufferLength, + DR_PARAM_OUT PVOID OutputBuffer OPTIONAL, + DR_PARAM_IN ULONG OutputBufferLength ); */ diff --git a/drsyscall/drsyscall_windows.h b/drsyscall/drsyscall_windows.h index 159a93e88..c5a466f53 100755 --- a/drsyscall/drsyscall_windows.h +++ b/drsyscall/drsyscall_windows.h @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2011-2016 Google, Inc. All rights reserved. + * Copyright (c) 2011-2024 Google, Inc. All rights reserved. * **********************************************************/ /* Dr. Memory: the memory debugger @@ -35,7 +35,7 @@ name2num_entry_add(const char *name, drsys_sysnum_t num, bool dup_Zw, bool dup_n bool syscall_num_from_name(void *drcontext, const module_data_t *info, const char *name, const char *optional_prefix, - bool sym_lookup, drsys_sysnum_t *num_out OUT); + bool sym_lookup, drsys_sysnum_t *num_out DR_PARAM_OUT); bool read_sysnum_file(void *drcontext, const char *sysnum_file, module_data_t *ntdll_data); @@ -82,6 +82,6 @@ wingdi_process_arg(sysarg_iter_info_t *iter_info, */ bool wingdi_syscall_succeeded(drsys_sysnum_t sysnum, syscall_info_t *info, ptr_int_t res, - bool *success OUT); + bool *success DR_PARAM_OUT); #endif /* _DRSYSCALL_WINDOWS_H_ */ diff --git a/drsyscall/drsyscall_wingdi.c b/drsyscall/drsyscall_wingdi.c index 17784b330..9e47c8d73 100644 --- a/drsyscall/drsyscall_wingdi.c +++ b/drsyscall/drsyscall_wingdi.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2011-2020 Google, Inc. All rights reserved. + * Copyright (c) 2011-2024 Google, Inc. All rights reserved. * **********************************************************/ /* Dr. Memory: the memory debugger @@ -2137,7 +2137,7 @@ wingdi_shadow_process_syscall(void *drcontext, cls_syscall_t *pt, sysarg_iter_in bool wingdi_syscall_succeeded(drsys_sysnum_t sysnum, syscall_info_t *info, ptr_int_t res, - bool *success OUT) + bool *success DR_PARAM_OUT) { /* Custom success criteria */ if (drsys_sysnums_equal(&sysnum, &sysnum_GdiDescribePixelFormat)) { diff --git a/drsyscall/table_windows_kernel32.c b/drsyscall/table_windows_kernel32.c index a1e1a1b4e..8336021f6 100644 --- a/drsyscall/table_windows_kernel32.c +++ b/drsyscall/table_windows_kernel32.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2011-2016 Google, Inc. All rights reserved. + * Copyright (c) 2011-2024 Google, Inc. All rights reserved. * **********************************************************/ /* Dr. Memory: the memory debugger @@ -40,7 +40,7 @@ */ syscall_info_t syscall_kernel32_info[] = { - /* wchar_t *locale OUT, size_t locale_sz (assuming size in bytes) */ + /* wchar_t *locale DR_PARAM_OUT, size_t locale_sz (assuming size in bytes) */ {{0,0},"NtWow64CsrBasepNlsGetUserInfo", OK, RNTST, 2, { {0, -1, W|CT, SYSARG_TYPE_CSTRING_WIDE}, diff --git a/drsyscall/table_windows_ntoskrnl.c b/drsyscall/table_windows_ntoskrnl.c index 1901e00b4..37e11de80 100644 --- a/drsyscall/table_windows_ntoskrnl.c +++ b/drsyscall/table_windows_ntoskrnl.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2011-2019 Google, Inc. All rights reserved. + * Copyright (c) 2011-2024 Google, Inc. All rights reserved. * Copyright (c) 2007-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -58,7 +58,7 @@ * - need to add post-syscall write size entries: I put in a handful. * should look at all OUT params whose (requested) size comes from an IN param. * e.g., NtQueryValueKey: should use IN param to check addressability, but - * OUT ResultLength for what was actually written to. + * DR_PARAM_OUT ResultLength for what was actually written to. * The strategy for these is to use a double entry with the second typically * using WI to indicate that the OUT size needs to be dereferenced (PR 408536). * E.g.: diff --git a/dynamorio b/dynamorio index bbd4ffadd..3e3b976e3 160000 --- a/dynamorio +++ b/dynamorio @@ -1 +1 @@ -Subproject commit bbd4ffadd03a7630b6143035c369bf7714357eeb +Subproject commit 3e3b976e316e9469ca36338fb7f3fa086739d03a diff --git a/tests/framework/umbra_client_consistency.c b/tests/framework/umbra_client_consistency.c index a97976598..e0557836a 100644 --- a/tests/framework/umbra_client_consistency.c +++ b/tests/framework/umbra_client_consistency.c @@ -1,5 +1,5 @@ /* ************************************************************** - * Copyright (c) 2017 Google, Inc. All rights reserved. + * Copyright (c) 2017-2024 Google, Inc. All rights reserved. * **************************************************************/ /* @@ -48,7 +48,7 @@ static umbra_map_t *umbra_map; static dr_emit_flags_t event_app_analysis(void *drcontext, void *tag, instrlist_t *bb, - bool for_trace, bool translating, OUT void **user_data); + bool for_trace, bool translating, DR_PARAM_OUT void **user_data); static dr_emit_flags_t event_app_instruction(void *drcontext, void *tag, instrlist_t *ilist, instr_t *where, @@ -134,7 +134,7 @@ instrument_mem(void *drcontext, instrlist_t *ilist, instr_t *where, opnd_t ref, static dr_emit_flags_t event_app_analysis(void *drcontext, void *tag, instrlist_t *bb, - bool for_trace, bool translating, OUT void **user_data) + bool for_trace, bool translating, DR_PARAM_OUT void **user_data) { instr_t *inst; bool prev_was_mov_const = false; diff --git a/tests/framework/umbra_client_insert_app_to_shadow.c b/tests/framework/umbra_client_insert_app_to_shadow.c index de45c733f..84f017c1d 100644 --- a/tests/framework/umbra_client_insert_app_to_shadow.c +++ b/tests/framework/umbra_client_insert_app_to_shadow.c @@ -52,7 +52,7 @@ static umbra_map_t *umbra_map; static dr_emit_flags_t event_app_analysis(void *drcontext, void *tag, instrlist_t *bb, bool for_trace, - bool translating, OUT void **user_data); + bool translating, DR_PARAM_OUT void **user_data); static dr_emit_flags_t event_app_instruction(void *drcontext, void *tag, instrlist_t *ilist, instr_t *where, @@ -228,7 +228,7 @@ instrument_read_shadow(void *drcontext, instrlist_t *ilist, instr_t *where, static dr_emit_flags_t event_app_analysis(void *drcontext, void *tag, instrlist_t *bb, bool for_trace, - bool translating, OUT void **user_data) + bool translating, DR_PARAM_OUT void **user_data) { instr_t *inst; bool prev_was_mov_const = false; diff --git a/tests/framework/umbra_client_shadow_mem.c b/tests/framework/umbra_client_shadow_mem.c index 0d51dc415..dbc70219e 100644 --- a/tests/framework/umbra_client_shadow_mem.c +++ b/tests/framework/umbra_client_shadow_mem.c @@ -1,5 +1,5 @@ /* ************************************************************** - * Copyright (c) 2017 Google, Inc. All rights reserved. + * Copyright (c) 2017-2024 Google, Inc. All rights reserved. * **************************************************************/ /* @@ -48,7 +48,7 @@ static umbra_map_t *umbra_map; static dr_emit_flags_t event_app_analysis(void *drcontext, void *tag, instrlist_t *bb, - bool for_trace, bool translating, OUT void **user_data); + bool for_trace, bool translating, DR_PARAM_OUT void **user_data); static dr_emit_flags_t event_app_instruction(void *drcontext, void *tag, instrlist_t *ilist, instr_t *where, @@ -144,7 +144,7 @@ instrument_mem(void *drcontext, instrlist_t *ilist, instr_t *where, opnd_t ref, static dr_emit_flags_t event_app_analysis(void *drcontext, void *tag, instrlist_t *bb, - bool for_trace, bool translating, OUT void **user_data) + bool for_trace, bool translating, DR_PARAM_OUT void **user_data) { instr_t *inst; bool prev_was_mov_const = false; diff --git a/tests/fuzz/custom_mutator.c b/tests/fuzz/custom_mutator.c index 85956c4f1..09719ba3a 100644 --- a/tests/fuzz/custom_mutator.c +++ b/tests/fuzz/custom_mutator.c @@ -46,8 +46,10 @@ typedef struct _mutator_t { #define DEFAULT_TOADD 0xf0f00a0a LIB_EXPORT drmf_status_t -drfuzz_mutator_start(OUT drfuzz_mutator_t **mutator_out, IN void *input_seed, - IN size_t size, IN int argc, IN const char *argv[]) +drfuzz_mutator_start(DR_PARAM_OUT drfuzz_mutator_t **mutator_out, + DR_PARAM_IN void *input_seed, + DR_PARAM_IN size_t size, DR_PARAM_IN int argc, + DR_PARAM_IN const char *argv[]) { mutator_t *mutator; int i; @@ -94,7 +96,8 @@ drfuzz_mutator_has_next_value(drfuzz_mutator_t *mutator_in) } LIB_EXPORT drmf_status_t -drfuzz_mutator_get_current_value(IN drfuzz_mutator_t *mutator_in, OUT void *buffer) +drfuzz_mutator_get_current_value(DR_PARAM_IN drfuzz_mutator_t *mutator_in, + DR_PARAM_OUT void *buffer) { mutator_t *mutator = (mutator_t *) mutator_in; memcpy(buffer, mutator->current_value, mutator->size); @@ -102,7 +105,7 @@ drfuzz_mutator_get_current_value(IN drfuzz_mutator_t *mutator_in, OUT void *buff } LIB_EXPORT drmf_status_t -drfuzz_mutator_get_next_value(drfuzz_mutator_t *mutator_in, IN void *buffer) +drfuzz_mutator_get_next_value(drfuzz_mutator_t *mutator_in, DR_PARAM_IN void *buffer) { mutator_t *mutator = (mutator_t *) mutator_in; int val = *(int *)mutator->current_value; diff --git a/tests/rtl_memory_zones.c b/tests/rtl_memory_zones.c index a9729b2c5..46db157cf 100644 --- a/tests/rtl_memory_zones.c +++ b/tests/rtl_memory_zones.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2011-2019 Google, Inc. All rights reserved. + * Copyright (c) 2011-2024 Google, Inc. All rights reserved. * **********************************************************/ /* Dr. Memory: the memory debugger @@ -31,8 +31,8 @@ NTSTATUS (NTAPI *RtlGetProcessHeaps)( - IN ULONG count, - OUT HANDLE *Heaps + DR_PARAM_IN ULONG count, + DR_PARAM_OUT HANDLE *Heaps ); static int diff --git a/tests/run_in_bg.c b/tests/run_in_bg.c index cb257d413..37d8452ea 100644 --- a/tests/run_in_bg.c +++ b/tests/run_in_bg.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2016 Google, Inc. All rights reserved. + * Copyright (c) 2016-2024 Google, Inc. All rights reserved. * Copyright (c) 2009 VMware, Inc. All rights reserved. * **********************************************************/ @@ -140,11 +140,11 @@ typedef struct _PROCESS_BASIC_INFORMATION { } PROCESS_BASIC_INFORMATION; NTSYSAPI NTSTATUS NTAPI -NtQueryInformationProcess(IN HANDLE ProcessHandle, - IN ULONG ProcessInformationClass, - OUT PVOID ProcessInformation, - IN ULONG ProcessInformationLength, - OUT PULONG ReturnLength OPTIONAL); +NtQueryInformationProcess(DR_PARAM_IN HANDLE ProcessHandle, + DR_PARAM_IN ULONG ProcessInformationClass, + DR_PARAM_OUT PVOID ProcessInformation, + DR_PARAM_IN ULONG ProcessInformationLength, + DR_PARAM_OUT PULONG ReturnLength OPTIONAL); static int process_id_from_handle(HANDLE h) diff --git a/umbra/umbra.c b/umbra/umbra.c index 21ffe4226..3ce19accb 100644 --- a/umbra/umbra.c +++ b/umbra/umbra.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2012-2021 Google, Inc. All rights reserved. + * Copyright (c) 2012-2024 Google, Inc. All rights reserved. * **********************************************************/ /* Dr. Memory: the memory debugger @@ -373,8 +373,8 @@ umbra_exit(void) DR_EXPORT drmf_status_t -umbra_create_mapping(IN umbra_map_options_t *ops, - OUT umbra_map_t **map_out) +umbra_create_mapping(DR_PARAM_IN umbra_map_options_t *ops, + DR_PARAM_OUT umbra_map_t **map_out) { drmf_status_t res; if (!umbra_initialized) @@ -389,7 +389,7 @@ umbra_create_mapping(IN umbra_map_options_t *ops, DR_EXPORT drmf_status_t -umbra_destroy_mapping(IN umbra_map_t *map) +umbra_destroy_mapping(DR_PARAM_IN umbra_map_t *map) { if (map == NULL || map->magic != UMBRA_MAP_MAGIC) { ASSERT(false, "invalid umbra_map"); @@ -415,12 +415,12 @@ umbra_destroy_mapping(IN umbra_map_t *map) */ DR_EXPORT drmf_status_t -umbra_create_shadow_memory(IN umbra_map_t *map, - IN uint flags, - IN app_pc app_addr, - IN size_t app_size, - IN ptr_uint_t value, - IN size_t value_size) +umbra_create_shadow_memory(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN umbra_shadow_memory_flags_t flags, + DR_PARAM_IN app_pc app_addr, + DR_PARAM_IN size_t app_size, + DR_PARAM_IN ptr_uint_t value, + DR_PARAM_IN size_t value_size) { if (map == NULL || map->magic != UMBRA_MAP_MAGIC) { ASSERT(false, "invalid umbra_map"); @@ -438,9 +438,9 @@ umbra_create_shadow_memory(IN umbra_map_t *map, DR_EXPORT drmf_status_t -umbra_delete_shadow_memory(IN umbra_map_t *map, - IN app_pc app_addr, - IN size_t app_size) +umbra_delete_shadow_memory(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN app_pc app_addr, + DR_PARAM_IN size_t app_size) { if (map == NULL || map->magic != UMBRA_MAP_MAGIC) { ASSERT(false, "invalid umbra_map"); @@ -453,7 +453,7 @@ umbra_delete_shadow_memory(IN umbra_map_t *map, DR_EXPORT drmf_status_t -umbra_num_scratch_regs_for_translation(OUT int *num_regs) +umbra_num_scratch_regs_for_translation(DR_PARAM_OUT int *num_regs) { if (num_regs == NULL) { ASSERT(false, "num_regs must not be NULL"); @@ -465,13 +465,13 @@ umbra_num_scratch_regs_for_translation(OUT int *num_regs) DR_EXPORT drmf_status_t -umbra_insert_app_to_shadow(IN void *drcontext, - IN umbra_map_t *map, - IN instrlist_t *ilist, - IN instr_t *where, - IN reg_id_t addr_reg, - IN reg_id_t *scratch_regs, - IN int num_scratch_regs) +umbra_insert_app_to_shadow(DR_PARAM_IN void *drcontext, + DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN instrlist_t *ilist, + DR_PARAM_IN instr_t *where, + DR_PARAM_IN reg_id_t addr_reg, + DR_PARAM_IN reg_id_t *scratch_regs, + DR_PARAM_IN int num_scratch_regs) { if (map == NULL || map->magic != UMBRA_MAP_MAGIC) { ASSERT(false, "invalid umbra_map"); @@ -487,11 +487,11 @@ umbra_insert_app_to_shadow(IN void *drcontext, DR_EXPORT drmf_status_t -umbra_read_shadow_memory(IN umbra_map_t *map, - IN app_pc app_addr, - IN size_t app_size, - OUT size_t *shadow_size, - IN byte *buffer) +umbra_read_shadow_memory(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN app_pc app_addr, + DR_PARAM_IN size_t app_size, + DR_PARAM_OUT size_t *shadow_size, + DR_PARAM_IN byte *buffer) { if (map == NULL || map->magic != UMBRA_MAP_MAGIC) { ASSERT(false, "invalid umbra_map"); @@ -513,11 +513,11 @@ umbra_read_shadow_memory(IN umbra_map_t *map, DR_EXPORT drmf_status_t -umbra_write_shadow_memory(IN umbra_map_t *map, - IN app_pc app_addr, - IN size_t app_size, - OUT size_t *shadow_size, - IN byte *buffer) +umbra_write_shadow_memory(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN app_pc app_addr, + DR_PARAM_IN size_t app_size, + DR_PARAM_OUT size_t *shadow_size, + DR_PARAM_IN byte *buffer) { if (map == NULL || map->magic != UMBRA_MAP_MAGIC) { ASSERT(false, "invalid umbra_map"); @@ -536,12 +536,12 @@ umbra_write_shadow_memory(IN umbra_map_t *map, DR_EXPORT drmf_status_t -umbra_shadow_set_range(IN umbra_map_t *map, - IN app_pc app_addr, - IN size_t app_size, - OUT size_t *shadow_size, - IN ptr_uint_t value, - IN size_t value_size) +umbra_shadow_set_range(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN app_pc app_addr, + DR_PARAM_IN size_t app_size, + DR_PARAM_OUT size_t *shadow_size, + DR_PARAM_IN ptr_uint_t value, + DR_PARAM_IN size_t value_size) { if (map == NULL || map->magic != UMBRA_MAP_MAGIC) { ASSERT(false, "invalid umbra_map"); @@ -562,11 +562,11 @@ umbra_shadow_set_range(IN umbra_map_t *map, DR_EXPORT drmf_status_t -umbra_shadow_copy_range(IN umbra_map_t *map, - IN app_pc app_src, - IN app_pc app_dst, - IN size_t app_size, - OUT size_t *shadow_size) +umbra_shadow_copy_range(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN app_pc app_src, + DR_PARAM_IN app_pc app_dst, + DR_PARAM_IN size_t app_size, + DR_PARAM_OUT size_t *shadow_size) { if (map == NULL || map->magic != UMBRA_MAP_MAGIC) { ASSERT(false, "invalid umbra_map"); @@ -584,12 +584,12 @@ umbra_shadow_copy_range(IN umbra_map_t *map, DR_EXPORT drmf_status_t -umbra_value_in_shadow_memory(IN umbra_map_t *map, - INOUT app_pc *app_addr, - IN size_t app_size, - IN ptr_uint_t value, - IN size_t value_size, - OUT bool *found) +umbra_value_in_shadow_memory(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_INOUT app_pc *app_addr, + DR_PARAM_IN size_t app_size, + DR_PARAM_IN ptr_uint_t value, + DR_PARAM_IN size_t value_size, + DR_PARAM_OUT bool *found) { if (map == NULL || map->magic != UMBRA_MAP_MAGIC) { ASSERT(false, "invalid umbra_map"); @@ -607,8 +607,8 @@ umbra_value_in_shadow_memory(IN umbra_map_t *map, DR_EXPORT drmf_status_t -umbra_get_shadow_block_size(IN umbra_map_t *map, - OUT size_t *size) +umbra_get_shadow_block_size(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_OUT size_t *size) { if (map == NULL || map->magic != UMBRA_MAP_MAGIC) { ASSERT(false, "invalid umbra_map"); @@ -621,9 +621,9 @@ umbra_get_shadow_block_size(IN umbra_map_t *map, } drmf_status_t -umbra_iterate_app_memory(IN umbra_map_t *map, - IN void *user_data, - IN bool (*iter_func)(umbra_map_t *map, +umbra_iterate_app_memory(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN void *user_data, + DR_PARAM_IN bool (*iter_func)(umbra_map_t *map, const dr_mem_info_t *info, void *user_data)) { @@ -668,9 +668,9 @@ umbra_iterate_shadow_memory(umbra_map_t *map, DR_EXPORT drmf_status_t -umbra_get_shadow_memory_type(IN umbra_map_t *map, - IN byte *shadow_addr, - OUT umbra_shadow_memory_type_t *shadow_type) +umbra_get_shadow_memory_type(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN byte *shadow_addr, + DR_PARAM_OUT umbra_shadow_memory_type_t *shadow_type) { if (map == NULL || map->magic != UMBRA_MAP_MAGIC) { ASSERT(false, "invalid umbra_map"); @@ -682,9 +682,9 @@ umbra_get_shadow_memory_type(IN umbra_map_t *map, } drmf_status_t -umbra_shadow_memory_is_shared(IN umbra_map_t *map, - IN byte *shadow_addr, - OUT umbra_shadow_memory_type_t *shadow_type) +umbra_shadow_memory_is_shared(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN byte *shadow_addr, + DR_PARAM_OUT umbra_shadow_memory_type_t *shadow_type) { if (map == NULL || map->magic != UMBRA_MAP_MAGIC) { ASSERT(false, "invalid umbra_map"); @@ -697,10 +697,10 @@ umbra_shadow_memory_is_shared(IN umbra_map_t *map, DR_EXPORT drmf_status_t -umbra_get_shadow_memory(IN umbra_map_t *map, - IN app_pc app_addr, - OUT byte **shadow_addr, - INOUT umbra_shadow_memory_info_t *shadow_info) +umbra_get_shadow_memory(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN app_pc app_addr, + DR_PARAM_OUT byte **shadow_addr, + DR_PARAM_INOUT umbra_shadow_memory_info_t *shadow_info) { if (map == NULL || map->magic != UMBRA_MAP_MAGIC) { ASSERT(false, "invalid umbra_map"); @@ -731,10 +731,10 @@ umbra_replace_shared_shadow_memory(umbra_map_t *map, DR_EXPORT drmf_status_t -umbra_create_shared_shadow_block(IN umbra_map_t *map, - IN ptr_uint_t value, - IN size_t value_size, - OUT byte **block) +umbra_create_shared_shadow_block(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN ptr_uint_t value, + DR_PARAM_IN size_t value_size, + DR_PARAM_OUT byte **block) { if (map == NULL || map->magic != UMBRA_MAP_MAGIC) { ASSERT(false, "invalid umbra_map"); @@ -747,10 +747,10 @@ umbra_create_shared_shadow_block(IN umbra_map_t *map, DR_EXPORT drmf_status_t -umbra_get_shared_shadow_block(IN umbra_map_t *map, - IN ptr_uint_t value, - IN size_t value_size, - OUT byte **block) +umbra_get_shared_shadow_block(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN ptr_uint_t value, + DR_PARAM_IN size_t value_size, + DR_PARAM_OUT byte **block) { if (map == NULL || map->magic != UMBRA_MAP_MAGIC) { ASSERT(false, "invalid umbra_map"); @@ -763,7 +763,7 @@ umbra_get_shared_shadow_block(IN umbra_map_t *map, DR_EXPORT drmf_status_t -umbra_get_granularity(const umbra_map_t *map, OUT int *scale, OUT bool *is_scale_down) +umbra_get_granularity(const umbra_map_t *map, DR_PARAM_OUT int *scale, DR_PARAM_OUT bool *is_scale_down) { if (map == NULL || scale == NULL || is_scale_down == NULL) return DRMF_ERROR_INVALID_PARAMETER; diff --git a/umbra/umbra.h b/umbra/umbra.h index b2329d121..23d0cb231 100755 --- a/umbra/umbra.h +++ b/umbra/umbra.h @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2012-2014 Google, Inc. All rights reserved. + * Copyright (c) 2012-2024 Google, Inc. All rights reserved. * **********************************************************/ /* Dr. Memory: the memory debugger @@ -309,15 +309,15 @@ DR_EXPORT * @param[out] map_out The mapping options. */ drmf_status_t -umbra_create_mapping(IN umbra_map_options_t *ops, - OUT umbra_map_t **map_out); +umbra_create_mapping(DR_PARAM_IN umbra_map_options_t *ops, + DR_PARAM_OUT umbra_map_t **map_out); DR_EXPORT /** * Destroy a shadow memory mapping \p map created by umbra_create_mapping. */ drmf_status_t -umbra_destroy_mapping(IN umbra_map_t *map); +umbra_destroy_mapping(DR_PARAM_IN umbra_map_t *map); DR_EXPORT /** @@ -343,12 +343,12 @@ DR_EXPORT * on \p map creation. */ drmf_status_t -umbra_create_shadow_memory(IN umbra_map_t *map, - IN umbra_shadow_memory_flags_t flags, - IN app_pc app_addr, - IN size_t app_size, - IN ptr_uint_t value, - IN size_t value_size); +umbra_create_shadow_memory(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN umbra_shadow_memory_flags_t flags, + DR_PARAM_IN app_pc app_addr, + DR_PARAM_IN size_t app_size, + DR_PARAM_IN ptr_uint_t value, + DR_PARAM_IN size_t value_size); DR_EXPORT /** @@ -367,9 +367,9 @@ DR_EXPORT * which will be set to the value specified on \p map creation instead. */ drmf_status_t -umbra_delete_shadow_memory(IN umbra_map_t *map, - IN app_pc app_addr, - IN size_t app_size); +umbra_delete_shadow_memory(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN app_pc app_addr, + DR_PARAM_IN size_t app_size); DR_EXPORT /** @@ -380,7 +380,7 @@ DR_EXPORT * @param[out] num_regs Number of scratch register required for translation. */ drmf_status_t -umbra_num_scratch_regs_for_translation(OUT int *num_regs); +umbra_num_scratch_regs_for_translation(DR_PARAM_OUT int *num_regs); DR_EXPORT /** @@ -410,13 +410,13 @@ DR_EXPORT * and after this method is called, e.g. with \p drreg_reserve_aflags(). */ drmf_status_t -umbra_insert_app_to_shadow(IN void *drcontext, - IN umbra_map_t *map, - IN instrlist_t *ilist, - IN instr_t *where, - IN reg_id_t addr_reg, - IN reg_id_t *scratch_regs, - IN int num_scratch_regs); +umbra_insert_app_to_shadow(DR_PARAM_IN void *drcontext, + DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN instrlist_t *ilist, + DR_PARAM_IN instr_t *where, + DR_PARAM_IN reg_id_t addr_reg, + DR_PARAM_IN reg_id_t *scratch_regs, + DR_PARAM_IN int num_scratch_regs); DR_EXPORT /** @@ -434,11 +434,11 @@ DR_EXPORT * for invalid addresses, returns DRMF_ERROR_INVALID_ADDRESS. */ drmf_status_t -umbra_read_shadow_memory(IN umbra_map_t *map, - IN app_pc app_addr, - IN size_t app_size, - INOUT size_t *shadow_size, - OUT byte *buffer); +umbra_read_shadow_memory(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN app_pc app_addr, + DR_PARAM_IN size_t app_size, + DR_PARAM_INOUT size_t *shadow_size, + DR_PARAM_OUT byte *buffer); DR_EXPORT /** @@ -456,11 +456,11 @@ DR_EXPORT * for invalid addresses, returns DRMF_ERROR_INVALID_ADDRESS. */ drmf_status_t -umbra_write_shadow_memory(IN umbra_map_t *map, - IN app_pc app_addr, - IN size_t app_size, - INOUT size_t *shadow_size, - IN byte *buffer); +umbra_write_shadow_memory(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN app_pc app_addr, + DR_PARAM_IN size_t app_size, + DR_PARAM_INOUT size_t *shadow_size, + DR_PARAM_IN byte *buffer); DR_EXPORT /** @@ -479,12 +479,12 @@ DR_EXPORT * for invalid addresses, returns DRMF_ERROR_INVALID_ADDRESS. */ drmf_status_t -umbra_shadow_set_range(IN umbra_map_t *map, - IN app_pc app_addr, - IN size_t app_size, - OUT size_t *shadow_size, - IN ptr_uint_t value, - IN size_t value_size); +umbra_shadow_set_range(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN app_pc app_addr, + DR_PARAM_IN size_t app_size, + DR_PARAM_OUT size_t *shadow_size, + DR_PARAM_IN ptr_uint_t value, + DR_PARAM_IN size_t value_size); DR_EXPORT /** @@ -504,11 +504,11 @@ DR_EXPORT * \note: Overlap is allowed. */ drmf_status_t -umbra_shadow_copy_range(IN umbra_map_t *map, - IN app_pc app_src, - IN app_pc app_dst, - IN size_t app_size, - OUT size_t *shadow_size); +umbra_shadow_copy_range(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN app_pc app_src, + DR_PARAM_IN app_pc app_dst, + DR_PARAM_IN size_t app_size, + DR_PARAM_OUT size_t *shadow_size); DR_EXPORT /** @@ -529,12 +529,12 @@ DR_EXPORT * for invalid addresses, returns DRMF_ERROR_INVALID_ADDRESS. */ drmf_status_t -umbra_value_in_shadow_memory(IN umbra_map_t *map, - INOUT app_pc *app_addr, - IN size_t app_size, - IN ptr_uint_t value, - IN size_t value_size, - OUT bool *found); +umbra_value_in_shadow_memory(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_INOUT app_pc *app_addr, + DR_PARAM_IN size_t app_size, + DR_PARAM_IN ptr_uint_t value, + DR_PARAM_IN size_t value_size, + DR_PARAM_OUT bool *found); DR_EXPORT /** @@ -545,8 +545,8 @@ DR_EXPORT * @param[out] size The shadow memory block size. */ drmf_status_t -umbra_get_shadow_block_size(IN umbra_map_t *map, - OUT size_t *size); +umbra_get_shadow_block_size(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_OUT size_t *size); DR_EXPORT /** @@ -562,9 +562,9 @@ DR_EXPORT * since they are not considered as part of DynamoRIO internal or client memory. */ drmf_status_t -umbra_iterate_app_memory(IN umbra_map_t *map, - IN void *user_data, - IN bool (*iter_func)(umbra_map_t *map, +umbra_iterate_app_memory(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN void *user_data, + DR_PARAM_IN bool (*iter_func)(umbra_map_t *map, const dr_mem_info_t *info, void *user_data)); @@ -589,9 +589,9 @@ DR_EXPORT * It can return false to stop the iteration. */ drmf_status_t -umbra_iterate_shadow_memory(IN umbra_map_t *map, - IN void *user_data, - IN shadow_iterate_func_t iter_func); +umbra_iterate_shadow_memory(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN void *user_data, + DR_PARAM_IN shadow_iterate_func_t iter_func); DR_EXPORT /** @@ -605,9 +605,9 @@ DR_EXPORT * shadow memory to determine the shadow memory type for \p shadow_addr. */ drmf_status_t -umbra_get_shadow_memory_type(IN umbra_map_t *map, - IN byte *shadow_addr, - OUT umbra_shadow_memory_type_t *shadow_type); +umbra_get_shadow_memory_type(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN byte *shadow_addr, + DR_PARAM_OUT umbra_shadow_memory_type_t *shadow_type); DR_EXPORT /** @@ -631,9 +631,9 @@ DR_EXPORT * */ drmf_status_t -umbra_shadow_memory_is_shared(IN umbra_map_t *map, - IN byte *shadow_addr, - OUT umbra_shadow_memory_type_t *shadow_type); +umbra_shadow_memory_is_shared(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN byte *shadow_addr, + DR_PARAM_OUT umbra_shadow_memory_type_t *shadow_type); DR_EXPORT /** @@ -668,10 +668,10 @@ DR_EXPORT * */ drmf_status_t -umbra_get_shadow_memory(IN umbra_map_t *map, - IN app_pc app_addr, - OUT byte **shadow_addr, - INOUT umbra_shadow_memory_info_t *shadow_info); +umbra_get_shadow_memory(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN app_pc app_addr, + DR_PARAM_OUT byte **shadow_addr, + DR_PARAM_INOUT umbra_shadow_memory_info_t *shadow_info); DR_EXPORT /** @@ -685,9 +685,9 @@ DR_EXPORT * @param[out] shadow_addr Return the replaced shadow memory address. */ drmf_status_t -umbra_replace_shared_shadow_memory(IN umbra_map_t *map, - IN app_pc app_addr, - OUT byte **shadow_addr); +umbra_replace_shared_shadow_memory(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN app_pc app_addr, + DR_PARAM_OUT byte **shadow_addr); DR_EXPORT /** @@ -707,10 +707,10 @@ DR_EXPORT * implementation and always returns DRMF_ERROR_FEATURE_NOT_AVAILABLE. */ drmf_status_t -umbra_create_shared_shadow_block(IN umbra_map_t *map, - IN ptr_uint_t value, - IN size_t value_size, - OUT byte **block); +umbra_create_shared_shadow_block(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN ptr_uint_t value, + DR_PARAM_IN size_t value_size, + DR_PARAM_OUT byte **block); DR_EXPORT /** @@ -727,10 +727,10 @@ DR_EXPORT * implementation and always returns DRMF_ERROR_FEATURE_NOT_AVAILABLE. */ drmf_status_t -umbra_get_shared_shadow_block(IN umbra_map_t *map, - IN ptr_uint_t value, - IN size_t value_size, - OUT byte **block); +umbra_get_shared_shadow_block(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN ptr_uint_t value, + DR_PARAM_IN size_t value_size, + DR_PARAM_OUT byte **block); /** Convenience routine for initializing umbra_shadow_memory_info. */ static inline void @@ -773,7 +773,7 @@ DR_EXPORT * or up. */ drmf_status_t -umbra_get_granularity(const umbra_map_t *map, OUT int *scale, +umbra_get_granularity(const umbra_map_t *map, DR_PARAM_OUT int *scale, bool *is_scale_down); /*@}*/ /* end doxygen group */ diff --git a/umbra/umbra_32.c b/umbra/umbra_32.c index f76903ff8..65f64b000 100644 --- a/umbra/umbra_32.c +++ b/umbra/umbra_32.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2010-2021 Google, Inc. All rights reserved. + * Copyright (c) 2010-2024 Google, Inc. All rights reserved. * Copyright (c) 2007-2010 VMware, Inc. All rights reserved. * **********************************************************/ @@ -405,7 +405,7 @@ shadow_table_insert_app_to_shadow_arch(void *drcontext, umbra_map_t *map, static bool shadow_table_is_in_default_block(umbra_map_t *map, byte *shadow_addr, - bool *redzone OUT) + bool *redzone DR_PARAM_OUT) { if (shadow_addr >= map->default_block.start - map->options.redzone_size && shadow_addr < (map->default_block.start + map->shadow_block_size + @@ -434,7 +434,7 @@ shadow_table_use_default_block(umbra_map_t *map, app_pc app_addr) static bool shadow_table_is_in_special_block(umbra_map_t *map, byte *shadow_addr, ptr_uint_t *value, size_t *value_size, - bool *redzone OUT) + bool *redzone DR_PARAM_OUT) { uint i; for (i = 0; i < map->num_special_blocks; i++) { @@ -694,11 +694,11 @@ umbra_delete_shadow_memory_arch(umbra_map_t *map, } drmf_status_t -umbra_read_shadow_memory_arch(IN umbra_map_t *map, - IN app_pc app_addr, - IN size_t app_size, - INOUT size_t *shadow_size, - IN byte *buffer) +umbra_read_shadow_memory_arch(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN app_pc app_addr, + DR_PARAM_IN size_t app_size, + DR_PARAM_INOUT size_t *shadow_size, + DR_PARAM_IN byte *buffer) { /* i#1260: end pointers are all closed (i.e., inclusive) to handle overflow */ app_pc app_blk_base, app_blk_end, app_src_end; @@ -729,11 +729,11 @@ umbra_read_shadow_memory_arch(IN umbra_map_t *map, } drmf_status_t -umbra_write_shadow_memory_arch(IN umbra_map_t *map, - IN app_pc app_addr, - IN size_t app_size, - INOUT size_t *shadow_size, - IN byte *buffer) +umbra_write_shadow_memory_arch(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN app_pc app_addr, + DR_PARAM_IN size_t app_size, + DR_PARAM_INOUT size_t *shadow_size, + DR_PARAM_IN byte *buffer) { /* i#1260: end pointers are all closed (i.e., inclusive) to handle overflow */ app_pc app_blk_base, app_blk_end, app_src_end; @@ -769,12 +769,12 @@ umbra_write_shadow_memory_arch(IN umbra_map_t *map, } drmf_status_t -umbra_shadow_set_range_arch(IN umbra_map_t *map, - IN app_pc app_addr, - IN size_t app_size, - OUT size_t *shadow_size, - IN ptr_uint_t value, - IN size_t value_size) +umbra_shadow_set_range_arch(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN app_pc app_addr, + DR_PARAM_IN size_t app_size, + DR_PARAM_OUT size_t *shadow_size, + DR_PARAM_IN ptr_uint_t value, + DR_PARAM_IN size_t value_size) { /* i#1260: end pointers are all closed (i.e., inclusive) to handle overflow */ app_pc app_blk_base, app_blk_end, app_src_end; @@ -811,11 +811,11 @@ umbra_shadow_set_range_arch(IN umbra_map_t *map, } drmf_status_t -umbra_shadow_copy_range_arch(IN umbra_map_t *map, - IN app_pc app_src, - IN app_pc app_dst, - IN size_t app_size_in, - OUT size_t *shadow_size_out) +umbra_shadow_copy_range_arch(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN app_pc app_src, + DR_PARAM_IN app_pc app_dst, + DR_PARAM_IN size_t app_size_in, + DR_PARAM_OUT size_t *shadow_size_out) { /* i#1260: end pointers are all closed (i.e., inclusive) to handle overflow */ app_pc app_blk_base, app_blk_end, app_src_end; @@ -881,12 +881,12 @@ umbra_shadow_copy_range_arch(IN umbra_map_t *map, } drmf_status_t -umbra_value_in_shadow_memory_arch(IN umbra_map_t *map, - INOUT app_pc *app_addr, - IN size_t app_size, - IN ptr_uint_t value, - IN size_t value_size, - OUT bool *found) +umbra_value_in_shadow_memory_arch(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_INOUT app_pc *app_addr, + DR_PARAM_IN size_t app_size, + DR_PARAM_IN ptr_uint_t value, + DR_PARAM_IN size_t value_size, + DR_PARAM_OUT bool *found) { /* i#1260: end pointers are all closed (i.e., inclusive) to handle overflow */ app_pc app_blk_base, app_blk_end, app_src_end; @@ -971,9 +971,9 @@ umbra_iterate_shadow_memory_arch(umbra_map_t *map, } drmf_status_t -umbra_shadow_memory_is_shared_arch(IN umbra_map_t *map, - IN byte *shadow_addr, - OUT umbra_shadow_memory_type_t *shadow_type) +umbra_shadow_memory_is_shared_arch(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN byte *shadow_addr, + DR_PARAM_OUT umbra_shadow_memory_type_t *shadow_type) { bool redzone; if (shadow_table_is_in_special_block(map, shadow_addr, @@ -1075,10 +1075,10 @@ umbra_replace_shared_shadow_memory_arch(umbra_map_t *map, } drmf_status_t -umbra_create_shared_shadow_block_arch(IN umbra_map_t *map, - IN ptr_uint_t value, - IN size_t value_size, - OUT byte **block) +umbra_create_shared_shadow_block_arch(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN ptr_uint_t value, + DR_PARAM_IN size_t value_size, + DR_PARAM_OUT byte **block) { *block = shadow_table_create_special_block(map, value, value_size); if (*block == NULL) @@ -1087,10 +1087,10 @@ umbra_create_shared_shadow_block_arch(IN umbra_map_t *map, } drmf_status_t -umbra_get_shared_shadow_block_arch(IN umbra_map_t *map, - IN ptr_uint_t value, - IN size_t value_size, - OUT byte **block) +umbra_get_shared_shadow_block_arch(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN ptr_uint_t value, + DR_PARAM_IN size_t value_size, + DR_PARAM_OUT byte **block) { uint i; for (i = 0; i < map->num_special_blocks; i++) { diff --git a/umbra/umbra_64.c b/umbra/umbra_64.c index 14bff7e67..7ddffeef2 100644 --- a/umbra/umbra_64.c +++ b/umbra/umbra_64.c @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2013-2021 Google, Inc. All rights reserved. + * Copyright (c) 2013-2024 Google, Inc. All rights reserved. * **********************************************************/ /* Dr. Memory: the memory debugger @@ -997,11 +997,11 @@ umbra_delete_shadow_memory_arch(umbra_map_t *map, } drmf_status_t -umbra_read_shadow_memory_arch(IN umbra_map_t *map, - IN app_pc app_addr, - IN size_t app_size, - INOUT size_t *shadow_size, - IN byte *buffer) +umbra_read_shadow_memory_arch(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN app_pc app_addr, + DR_PARAM_IN size_t app_size, + DR_PARAM_INOUT size_t *shadow_size, + DR_PARAM_IN byte *buffer) { /* i#1260: end pointers are all closed (i.e., inclusive) to handle overflow */ app_pc app_blk_base, app_blk_end, app_src_end; @@ -1040,11 +1040,11 @@ umbra_read_shadow_memory_arch(IN umbra_map_t *map, } drmf_status_t -umbra_write_shadow_memory_arch(IN umbra_map_t *map, - IN app_pc app_addr, - IN size_t app_size, - INOUT size_t *shadow_size, - IN byte *buffer) +umbra_write_shadow_memory_arch(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN app_pc app_addr, + DR_PARAM_IN size_t app_size, + DR_PARAM_INOUT size_t *shadow_size, + DR_PARAM_IN byte *buffer) { /* i#1260: end pointers are all closed (i.e., inclusive) to handle overflow */ app_pc app_blk_base, app_blk_end, app_src_end; @@ -1083,12 +1083,12 @@ umbra_write_shadow_memory_arch(IN umbra_map_t *map, } drmf_status_t -umbra_shadow_set_range_arch(IN umbra_map_t *map, - IN app_pc app_addr, - IN size_t app_size, - OUT size_t *shadow_size, - IN ptr_uint_t value, - IN size_t value_size) +umbra_shadow_set_range_arch(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN app_pc app_addr, + DR_PARAM_IN size_t app_size, + DR_PARAM_OUT size_t *shadow_size, + DR_PARAM_IN ptr_uint_t value, + DR_PARAM_IN size_t value_size) { /* i#1260: end pointers are all closed (i.e., inclusive) to handle overflow */ app_pc app_blk_base, app_blk_end, app_src_end; @@ -1125,11 +1125,11 @@ umbra_shadow_set_range_arch(IN umbra_map_t *map, } drmf_status_t -umbra_shadow_copy_range_arch(IN umbra_map_t *map, - IN app_pc app_src, - IN app_pc app_dst, - IN size_t app_size_in, - OUT size_t *shadow_size_out) +umbra_shadow_copy_range_arch(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN app_pc app_src, + DR_PARAM_IN app_pc app_dst, + DR_PARAM_IN size_t app_size_in, + DR_PARAM_OUT size_t *shadow_size_out) { /* i#1260: end pointers are all closed (i.e., inclusive) to handle overflow */ app_pc app_blk_base, app_blk_end, app_src_end; @@ -1202,12 +1202,12 @@ umbra_shadow_copy_range_arch(IN umbra_map_t *map, } drmf_status_t -umbra_value_in_shadow_memory_arch(IN umbra_map_t *map, - INOUT app_pc *app_addr, - IN size_t app_size, - IN ptr_uint_t value, - IN size_t value_size, - OUT bool *found) +umbra_value_in_shadow_memory_arch(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_INOUT app_pc *app_addr, + DR_PARAM_IN size_t app_size, + DR_PARAM_IN ptr_uint_t value, + DR_PARAM_IN size_t value_size, + DR_PARAM_OUT bool *found) { /* i#1260: end pointers are all closed (i.e., inclusive) to handle overflow */ app_pc app_blk_base, app_blk_end, app_src_end; @@ -1383,9 +1383,9 @@ umbra_iterate_shadow_memory_arch(umbra_map_t *map, } drmf_status_t -umbra_shadow_memory_is_shared_arch(IN umbra_map_t *map, - IN byte *shadow_addr, - OUT umbra_shadow_memory_type_t *shadow_type) +umbra_shadow_memory_is_shared_arch(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN byte *shadow_addr, + DR_PARAM_OUT umbra_shadow_memory_type_t *shadow_type) { *shadow_type = UMBRA_SHADOW_MEMORY_TYPE_UNKNOWN; return DRMF_SUCCESS; @@ -1471,19 +1471,19 @@ umbra_replace_shared_shadow_memory_arch(umbra_map_t *map, } drmf_status_t -umbra_create_shared_shadow_block_arch(IN umbra_map_t *map, - IN ptr_uint_t value, - IN size_t value_size, - OUT byte **block) +umbra_create_shared_shadow_block_arch(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN ptr_uint_t value, + DR_PARAM_IN size_t value_size, + DR_PARAM_OUT byte **block) { return DRMF_ERROR_FEATURE_NOT_AVAILABLE; } drmf_status_t -umbra_get_shared_shadow_block_arch(IN umbra_map_t *map, - IN ptr_uint_t value, - IN size_t value_size, - OUT byte **block) +umbra_get_shared_shadow_block_arch(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN ptr_uint_t value, + DR_PARAM_IN size_t value_size, + DR_PARAM_OUT byte **block) { *block = NULL; return DRMF_ERROR_FEATURE_NOT_AVAILABLE; diff --git a/umbra/umbra_private.h b/umbra/umbra_private.h index 2805a3082..1f0eb6321 100644 --- a/umbra/umbra_private.h +++ b/umbra/umbra_private.h @@ -1,5 +1,5 @@ /* ********************************************************** - * Copyright (c) 2012-2021 Google, Inc. All rights reserved. + * Copyright (c) 2012-2024 Google, Inc. All rights reserved. * **********************************************************/ /* Dr. Memory: the memory debugger @@ -88,10 +88,10 @@ struct _umbra_map_t { * indirect call per loop iter, and an iterator would have call costs * as well. These loops can be performance-critical parts of Dr. Memory. * - * Usage: APP_RANGE_LOOP(IN app_pc app_addr, IN size_t app_size, - * OUT app_pc app_blk_base, OUT app_pc app_blk_end, - * OUT app_pc app_src_end, - * OUT app_pc start, OUT app_pc end, OUT size_t iter_size, + * Usage: APP_RANGE_LOOP(DR_PARAM_IN app_pc app_addr, DR_PARAM_IN size_t app_size, + * DR_PARAM_OUT app_pc app_blk_base, DR_PARAM_OUT app_pc app_blk_end, + * DR_PARAM_OUT app_pc app_src_end, + * DR_PARAM_OUT app_pc start, DR_PARAM_OUT app_pc end, DR_PARAM_OUT size_t iter_size, * { loop_body... }) * * Each iteration operates on the app address range [start, end]. @@ -204,19 +204,19 @@ umbra_write_shadow_memory_arch(umbra_map_t *map, byte *buffer); drmf_status_t -umbra_shadow_set_range_arch(IN umbra_map_t *map, - IN app_pc app_addr, - IN size_t app_size, - OUT size_t *shadow_size, - IN ptr_uint_t value, - IN size_t value_size); +umbra_shadow_set_range_arch(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN app_pc app_addr, + DR_PARAM_IN size_t app_size, + DR_PARAM_OUT size_t *shadow_size, + DR_PARAM_IN ptr_uint_t value, + DR_PARAM_IN size_t value_size); drmf_status_t -umbra_shadow_copy_range_arch(IN umbra_map_t *map, - IN app_pc app_src, - IN app_pc app_dst, - IN size_t app_size, - OUT size_t *shadow_size); +umbra_shadow_copy_range_arch(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN app_pc app_src, + DR_PARAM_IN app_pc app_dst, + DR_PARAM_IN size_t app_size, + DR_PARAM_OUT size_t *shadow_size); drmf_status_t umbra_iterate_shadow_memory_arch(umbra_map_t *map, @@ -252,16 +252,16 @@ umbra_replace_shared_shadow_memory_arch(umbra_map_t *map, byte **shadow_addr); drmf_status_t -umbra_create_shared_shadow_block_arch(IN umbra_map_t *map, - IN ptr_uint_t value, - IN size_t value_size, - OUT byte **block); +umbra_create_shared_shadow_block_arch(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN ptr_uint_t value, + DR_PARAM_IN size_t value_size, + DR_PARAM_OUT byte **block); drmf_status_t -umbra_get_shared_shadow_block_arch(IN umbra_map_t *map, - IN ptr_uint_t value, - IN size_t value_size, - OUT byte **block); +umbra_get_shared_shadow_block_arch(DR_PARAM_IN umbra_map_t *map, + DR_PARAM_IN ptr_uint_t value, + DR_PARAM_IN size_t value_size, + DR_PARAM_OUT byte **block); bool umbra_handle_fault(void *drcontext, byte *target, dr_mcontext_t *raw_mc,