• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * Copyright (c) 2020 SUSE LLC <mdoucha@suse.cz>
4  */
5 
6 #ifndef TST_MEMUTILS_H__
7 #define TST_MEMUTILS_H__
8 
9 /*
10  * Fill up to maxsize physical memory with fillchar, then free it for reuse.
11  * If maxsize is zero, fill as much memory as possible. This function is
12  * intended for data disclosure vulnerability tests to reduce the probability
13  * that a vulnerable kernel will leak a block of memory that was full of
14  * zeroes by chance.
15  *
16  * The function keeps a safety margin to avoid invoking OOM killer and
17  * respects the limitations of available address space. (Less than 3GB can be
18  * polluted on a 32bit system regardless of available physical RAM.)
19  */
20 void tst_pollute_memory(size_t maxsize, int fillchar);
21 
22 #endif /* TST_MEMUTILS_H__ */
23