Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3306)

Issue 5636049: [AddressSanitizer] The first version of Windows malloc interceptors (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 3 months ago by timurrrr_at_google_com
Modified:
12 years, 3 months ago
Reviewers:
kcc1
CC:
llvm-commits_cs.uiuc.edu
Visibility:
Public.

Description

[AddressSanitizer] The first version of Windows malloc interceptors

Patch Set 1 #

Patch Set 2 : . #

Unified diffs Side-by-side diffs Delta from patch set Stats (+57 lines, -0 lines) Patch
A lib/asan/asan_malloc_win.cc View 1 1 chunk +57 lines, -0 lines 0 comments Download

Messages

Total messages: 2
timurrrr_at_google_com
Hi Kostya, Can you please review these Windows malloc interceptors? Thanks, Timur
12 years, 3 months ago (2012-02-06 14:06:38 UTC) #1
kcc1
12 years, 3 months ago (2012-02-06 18:01:03 UTC) #2
r149875, thanks!

On Mon, Feb 6, 2012 at 6:06 AM, <timurrrr@google.com> wrote:

> Reviewers: kcc1,
>
> Message:
> Hi Kostya,
>
> Can you please review these Windows malloc interceptors?
>
> Thanks,
> Timur
>
> Description:
> [AddressSanitizer] The first version of Windows malloc interceptors
>
> Please review this at
http://codereview.appspot.com/**5636049/<http://codereview.appspot.com/5636049/>
>
> Affected files:
>  A lib/asan/asan_malloc_win.cc
>
>
> Index: lib/asan/asan_malloc_win.cc
> diff --git a/lib/asan/asan_malloc_win.cc b/lib/asan/asan_malloc_win.cc
> new file mode 100644
> index 000000000000000000000000000000**0000000000..**
> 7c521a687bbc2b7f0c2db9abc6eb1b**2367cc5543
> --- /dev/null
> +++ b/lib/asan/asan_malloc_win.cc
> @@ -0,0 +1,57 @@
> +//===-- asan_malloc_win.cc ------------------------------**------*- C++
> -*-===//
> +//
> +//                     The LLVM Compiler Infrastructure
> +//
> +// This file is distributed under the University of Illinois Open Source
> +// License. See LICENSE.TXT for details.
> +//
> +//===------------------------**------------------------------**
> ----------------===//
> +//
> +// This file is a part of AddressSanitizer, an address sanity checker.
> +//
> +// Windows-specific malloc interception.
> +//===------------------------**------------------------------**
> ----------------===//
> +#ifdef _WIN32
> +
> +#include "asan_allocator.h"
> +#include "asan_interceptors.h"
> +#include "asan_internal.h"
> +#include "asan_stack.h"
> +
> +namespace __asan {
> +void ReplaceSystemMalloc() {
> +  // TODO(timurrrr): investigate whether any action is needed.
> +}
> +}  // namespace __asan
> +
> +// ---------------------- Replacement functions ---------------- {{{1
> +using namespace __asan;  // NOLINT
> +
> +// TODO(timurrrr): Simply defining functins with the same signature in
> *.obj
> +// files overrides the standard functions in *.lib
> +// This works well for simple helloworld-like tests but might need to be
> +// revisited in the future.
> +
> +extern "C" {
> +void free(void *ptr) {
> +  GET_STACK_TRACE_HERE_FOR_FREE(**ptr);
> +  return asan_free(ptr, &stack);
> +}
> +
> +void *malloc(size_t size) {
> +  GET_STACK_TRACE_HERE_FOR_**MALLOC;
> +  return asan_malloc(size, &stack);
> +}
> +
> +void *calloc(size_t nmemb, size_t size) {
> +  GET_STACK_TRACE_HERE_FOR_**MALLOC;
> +  return asan_calloc(nmemb, size, &stack);
> +}
> +
> +void *realloc(void *ptr, size_t size) {
> +  GET_STACK_TRACE_HERE_FOR_**MALLOC;
> +  return asan_realloc(ptr, size, &stack);
> +}
> +}  // extern "C"
> +
> +#endif  // _WIN32
>
>
>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b