diff options
author | cem <cem@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f> | 2020-10-30 19:02:59 +0000 |
---|---|---|
committer | cem <cem@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f> | 2020-10-30 19:02:59 +0000 |
commit | 62b33d318e95a642703731f867bcd0324ab23772 (patch) | |
tree | c6fa2c3e6c4b6cdb29d0d59aaf467a2330e735e6 | |
parent | a41f0c0cafb06753f55fe527ba2d757ba7734271 (diff) | |
download | freebsd-62b33d318e95a642703731f867bcd0324ab23772.tar.gz freebsd-62b33d318e95a642703731f867bcd0324ab23772.tar.bz2 |
linux(4): Quiesce warning about madvise(..., -1)
This API misuse is intended to produce an error value to detect certain
bogus stub implementations of MADV_WIPEONFORK. We don't need to log a
warning about it.
Example:
https://boringssl.googlesource.com/boringssl/+/ad5582985cc6b89d0e7caf0d9cc7e301de61cf66%5E%21/
Reviewed by: emaste, trasz
Differential Revision: https://reviews.freebsd.org/D27017
git-svn-id: http://svn.freebsd.org/base/head@367182 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
-rw-r--r-- | sys/compat/linux/linux_mmap.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/compat/linux/linux_mmap.c b/sys/compat/linux/linux_mmap.c index cc63c45579a..1b4b0b78280 100644 --- a/sys/compat/linux/linux_mmap.c +++ b/sys/compat/linux/linux_mmap.c @@ -394,6 +394,16 @@ linux_madvise_common(struct thread *td, uintptr_t addr, size_t len, int behav) case LINUX_MADV_SOFT_OFFLINE: linux_msg(curthread, "unsupported madvise MADV_SOFT_OFFLINE"); return (EINVAL); + case -1: + /* + * -1 is sometimes used as a dummy value to detect simplistic + * madvise(2) stub implementations. This safeguard is used by + * BoringSSL, for example, before assuming MADV_WIPEONFORK is + * safe to use. Don't produce an "unsupported" error message + * for this special dummy value, which is unlikely to be used + * by any new advisory behavior feature. + */ + return (EINVAL); default: linux_msg(curthread, "unsupported madvise behav %d", behav); return (EINVAL); |