From 773adb6f33c3b9cb28a3e78ffa73a2ccdc41116c Mon Sep 17 00:00:00 2001 From: Saswat Padhi Date: Wed, 5 May 2021 16:49:33 -0400 Subject: [PATCH 1/2] fix --- utils/s2n_mem.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/utils/s2n_mem.c b/utils/s2n_mem.c index 4d04a4ba1d6..97dab02e8c1 100644 --- a/utils/s2n_mem.c +++ b/utils/s2n_mem.c @@ -73,10 +73,11 @@ static int s2n_mem_cleanup_impl(void) static int s2n_mem_free_mlock_impl(void *ptr, uint32_t size) { - int munlock_rc = munlock(ptr, size); + /* We do a best-effort `munlock` and ignore any errors during unlocking. + * More details at https://github.com/aws/s2n-tls/issues/2803. + */ + munlock(ptr, size); free(ptr); - POSIX_ENSURE(munlock_rc == 0, S2N_ERR_MUNLOCK); - return S2N_SUCCESS; } From f2cb200d8d68bdf3cdc0691ebc0c8d2e786c033a Mon Sep 17 00:00:00 2001 From: Saswat Padhi Date: Wed, 5 May 2021 18:38:53 -0400 Subject: [PATCH 2/2] Update s2n_mem.c --- utils/s2n_mem.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/utils/s2n_mem.c b/utils/s2n_mem.c index 97dab02e8c1..b7685153790 100644 --- a/utils/s2n_mem.c +++ b/utils/s2n_mem.c @@ -73,9 +73,7 @@ static int s2n_mem_cleanup_impl(void) static int s2n_mem_free_mlock_impl(void *ptr, uint32_t size) { - /* We do a best-effort `munlock` and ignore any errors during unlocking. - * More details at https://github.com/aws/s2n-tls/issues/2803. - */ + /* Perform a best-effort `munlock`: ignore any errors during unlocking. */ munlock(ptr, size); free(ptr); return S2N_SUCCESS;