This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] malloc: Implement heap protector


My only comments on this one are:

> +/* Decrypt a heap header chunk.  */
> +#define HEAP_CRYPT_SIZE(val) (__malloc_header_guard ^ ((INTERNAL_SIZE_T) val))
> +#define HEAP_CRYPT_PREVSIZE(val) \
> +  (__malloc_footer_guard ^ ((INTERNAL_SIZE_T) val))

For readability and maintainability, we should probably have both CRYPT
and DECRYPT macros, used correcly throughout.  Yes, I know they'd be the
same now, but they might not be later.

> +/* The heap cookie.  The lowest three bits (corresponding to
> +   SIZE_BITS) in __malloc_guard_header must be clear.  Initialized
> +   during libc startup, and computed by elf/dl-keysetup.c.  */

If the lowest three bits must be clear, we should either clear them or
assert that they're clear.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]