From: Damjan Marion Date: Wed, 27 May 2020 14:43:35 +0000 (+0200) Subject: vppinfra: fix SIGBUS in bihash init when running unpriviledged, take two X-Git-Tag: v21.01-rc0~342 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F89%2F27289%2F1;p=vpp.git vppinfra: fix SIGBUS in bihash init when running unpriviledged, take two Looks like MAP_LOCK is not enough, so call mlock(...) instead.... Type: fix Change-Id: I1bc668a2bf3c861ca1c2d376c0fb6bfea87d4f48 Signed-off-by: Damjan Marion --- diff --git a/src/vppinfra/bihash_template.c b/src/vppinfra/bihash_template.c index 2305436dca2..dac42a8dc14 100644 --- a/src/vppinfra/bihash_template.c +++ b/src/vppinfra/bihash_template.c @@ -53,7 +53,7 @@ static inline void *BV (alloc_aligned) (BVT (clib_bihash) * h, uword nbytes) rv = mmap (base, alloc, PROT_READ | PROT_WRITE, mmap_flags_huge, -1, 0); /* fallback - maybe we are still able to allocate normal pages */ - if (rv == MAP_FAILED) + if (rv == MAP_FAILED || mlock (base, alloc) != 0) rv = mmap (base, alloc, PROT_READ | PROT_WRITE, mmap_flags, -1, 0); if (rv == MAP_FAILED)