[openssl/openssl] 78634e: Introduce [HAVE_/NO_]MADVISE defines

James Knight noreply at github.com
Mon Jun 12 05:59:09 UTC 2023

  Branch: refs/heads/master
  Home:   https://github.com/openssl/openssl
  Commit: 78634e8ac253a8edf338d329965724dfa8e033ab
  Author: James Knight <james.d.knight at live.com>
  Date:   2023-06-12 (Mon, 12 Jun 2023)

  Changed paths:
    M crypto/mem_sec.c

  Log Message:
  Introduce [HAVE_/NO_]MADVISE defines

Toolchains that target a non-MMU architecture may not have the `madvise`
function available, even if the `sys/mman.h` header provides a define
for `MADV_DONTDUMP` (e.g. when targeting ARMv7-M with uClibc). The
following tweaks the implementation to use `HAVE_MADVISE`/`NO_MADVISE`
defines to help indicate when to attempt to use `madvise`. This change
operates in the same manner as the original implementation (i.e. relies
on `MADV_DONTDUMP` to indicate if `madvise` can be used); however, this
change now allows a builder to override the internal detection by
explicitly providing the `HAVE_MADVISE` define at compile time. This
should give flexibility for environments which do not have `madvise`
when there is no easy logic to set `NO_MADVISE`.

Signed-off-by: James Knight <james.d.knight at live.com>

Reviewed-by: Matt Caswell <matt at openssl.org>
Reviewed-by: Todd Short <todd.short at me.com>
(Merged from https://github.com/openssl/openssl/pull/20851)

More information about the openssl-commits mailing list