MCPcopy Create free account
hub / github.com/F-Stack/f-stack / redzone_setup

Function redzone_setup

freebsd/vm/redzone.c:99–123  ·  view source on GitHub ↗

* Set redzones and remember allocation backtrace. */

Source from the content-addressed store, hash-verified

97 * Set redzones and remember allocation backtrace.
98 */
99void *
100redzone_setup(caddr_t raddr, u_long nsize)
101{
102 struct stack st;
103 caddr_t haddr, faddr;
104
105 atomic_add_long(&redzone_extra_mem, redzone_size_ntor(nsize) - nsize);
106
107 haddr = raddr + redzone_roundup(nsize) - REDZONE_HSIZE;
108 faddr = haddr + REDZONE_HSIZE + nsize;
109
110 /* Redzone header. */
111 stack_save(&st);
112 bcopy(&st, haddr, sizeof(st));
113 haddr += sizeof(st);
114 bcopy(&nsize, haddr, sizeof(nsize));
115 haddr += sizeof(nsize);
116 memset(haddr, 0x42, REDZONE_CHSIZE);
117 haddr += REDZONE_CHSIZE;
118
119 /* Redzone footer. */
120 memset(faddr, 0x42, REDZONE_CFSIZE);
121
122 return (haddr);
123}
124
125/*
126 * Verify redzones.

Callers 3

malloc_largeFunction · 0.85
(malloc)Function · 0.85
malloc_domainsetFunction · 0.85

Calls 5

atomic_add_longFunction · 0.85
redzone_size_ntorFunction · 0.85
redzone_roundupFunction · 0.85
memsetFunction · 0.85
stack_saveFunction · 0.50

Tested by

no test coverage detected