Wind River Support Network


LIN5-19522 : "BUG: Bad page state in process" occurs

Created: Oct 8, 2014    Updated: Dec 19, 2017
Resolved Date: Nov 9, 2014
Found In Version:
Fix Version:
Severity: Standard
Applicable for: Wind River Linux 5
Component/s: Kernel


"BUG: Bad page state in process" occurs, when a process which simply repeats malloc / fill allocated memory / free allocated memory is executed on multi cores.

Steps to Reproduce

1. Create and build a platform project which is configured by the following settings.

$WIND_LINUX_CONFIGURE --enable-board=fsl-imx6 --enable-rootfs=glibc-small --enable-kernel=standard --enable-jobs=4 --enable-parallel-pkgbuilds=4 --with-rcpl-version=0019

2. Boot the target, and execute the test case malloc_loop by invoking These test case and script are attached at the bottom of this field.

3. "BUG: Bad page state in process" with the following log.

[[[[ Begin log ]]]]
BUG: Bad page state in process malloc_loop  pfn:29282
page:81236a48 count:0 mapcount:1 mapping:  (null) index:0x74402
page flags: 0x80008(uptodate|swapbacked)
Modules linked in: minix
[<80018acc>] (unwind_backtrace+0x0/0x104) from [<806e8c24>] (dump_stack+0x20/0x24)
[<806e8c24>] (dump_stack+0x20/0x24) from [<800fed24>] (bad_page+0xcc/0x11c)
[<800fed24>] (bad_page+0xcc/0x11c) from [<800ff03c>] (free_pages_prepare+0x2c8/0x344)
[<800ff03c>] (free_pages_prepare+0x2c8/0x344) from [<801014c4>] (free_hot_cold_page+0x30/0x1dc)
[<801014c4>] (free_hot_cold_page+0x30/0x1dc) from [<801019d8>] (free_hot_cold_page_list+0x74/0x108)
[<801019d8>] (free_hot_cold_page_list+0x74/0x108) from [<80105a4c>] (release_pages+0x340/0x510)
[<80105a4c>] (release_pages+0x340/0x510) from [<8012ef98>] (free_pages_and_swap_cache+0x120/0x1a4)
[<8012ef98>] (free_pages_and_swap_cache+0x120/0x1a4) from [<8011d7a8>] (unmap_single_vma+0x4a8/0x648)
[<8011d7a8>] (unmap_single_vma+0x4a8/0x648) from [<8011e388>] (unmap_vmas+0x6c/0x80)
[<8011e388>] (unmap_vmas+0x6c/0x80) from [<80121b4c>] (unmap_region+0xbc/0x1a8)
[<80121b4c>] (unmap_region+0xbc/0x1a8) from [<80122c94>] (do_munmap+0x21c/0x2c0)
[<80122c94>] (do_munmap+0x21c/0x2c0) from [<80122d84>] (vm_munmap+0x4c/0x60)
[<80122d84>] (vm_munmap+0x4c/0x60) from [<80124120>] (sys_munmap+0x18/0x1c)
[<80124120>] (sys_munmap+0x18/0x1c) from [<8000e780>] (ret_fast_syscall+0x0/0x30)
Disabling lock debugging due to kernel taint
[[[[ End log ]]]]

[[[[ Begin test case and script ]]]]

/**** Begin test code malloc_loop.c ****/
#include <stdio.h>
#include <stdlib.h>

#define MEM_SIZE (100 * 1024 * 1024)

void malloc_loop(void)
  char *str;
  int i;

  str = (char *)malloc(MEM_SIZE);
  if (str == NULL)
      printf("Cannot allocate memory\n");

  for (i = 0; i < MEM_SIZE; i++)
      str[i] = (char)(i & 0xFF);


int main(void)
  unsigned int i;

  for (i = 1; ;i++)
      printf("loop: %d\n", i);

  return 0;
/**** End test code malloc_loop.c ****/

# Begin script to start test case
taskset 0x1 /root/malloc_loop &
taskset 0x2 /root/malloc_loop &
taskset 0x4 /root/malloc_loop &
taskset 0x8 /root/malloc_loop &
# End script to start test case

[[[[ End test case and script ]]]]

Other Downloads

Live chat