kcore.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  1. /*
  2. * fs/proc/kcore.c kernel ELF core dumper
  3. *
  4. * Modelled on fs/exec.c:aout_core_dump()
  5. * Jeremy Fitzhardinge <jeremy@sw.oz.au>
  6. * ELF version written by David Howells <David.Howells@nexor.co.uk>
  7. * Modified and incorporated into 2.3.x by Tigran Aivazian <tigran@veritas.com>
  8. * Support to dump vmalloc'd areas (ELF only), Tigran Aivazian <tigran@veritas.com>
  9. * Safe accesses to vmalloc/direct-mapped discontiguous areas, Kanoj Sarcar <kanoj@sgi.com>
  10. */
  11. #include <linux/mm.h>
  12. #include <linux/proc_fs.h>
  13. #include <linux/kcore.h>
  14. #include <linux/user.h>
  15. #include <linux/capability.h>
  16. #include <linux/elf.h>
  17. #include <linux/elfcore.h>
  18. #include <linux/notifier.h>
  19. #include <linux/vmalloc.h>
  20. #include <linux/highmem.h>
  21. #include <linux/printk.h>
  22. #include <linux/bootmem.h>
  23. #include <linux/init.h>
  24. #include <linux/slab.h>
  25. #include <asm/uaccess.h>
  26. #include <asm/io.h>
  27. #include <linux/list.h>
  28. #include <linux/ioport.h>
  29. #include <linux/memory.h>
  30. #include <asm/sections.h>
  31. #include "internal.h"
  32. #define CORE_STR "CORE"
  33. #ifndef ELF_CORE_EFLAGS
  34. #define ELF_CORE_EFLAGS 0
  35. #endif
  36. static struct proc_dir_entry *proc_root_kcore;
  37. #ifndef kc_vaddr_to_offset
  38. #define kc_vaddr_to_offset(v) ((v) - PAGE_OFFSET)
  39. #endif
  40. #ifndef kc_offset_to_vaddr
  41. #define kc_offset_to_vaddr(o) ((o) + PAGE_OFFSET)
  42. #endif
  43. /* An ELF note in memory */
  44. struct memelfnote
  45. {
  46. const char *name;
  47. int type;
  48. unsigned int datasz;
  49. void *data;
  50. };
  51. static LIST_HEAD(kclist_head);
  52. static DEFINE_RWLOCK(kclist_lock);
  53. static int kcore_need_update = 1;
  54. void
  55. kclist_add(struct kcore_list *new, void *addr, size_t size, int type)
  56. {
  57. new->addr = (unsigned long)addr;
  58. new->size = size;
  59. new->type = type;
  60. write_lock(&kclist_lock);
  61. list_add_tail(&new->list, &kclist_head);
  62. write_unlock(&kclist_lock);
  63. }
  64. static size_t get_kcore_size(int *nphdr, size_t *elf_buflen)
  65. {
  66. size_t try, size;
  67. struct kcore_list *m;
  68. *nphdr = 1; /* PT_NOTE */
  69. size = 0;
  70. list_for_each_entry(m, &kclist_head, list) {
  71. try = kc_vaddr_to_offset((size_t)m->addr + m->size);
  72. if (try > size)
  73. size = try;
  74. *nphdr = *nphdr + 1;
  75. }
  76. *elf_buflen = sizeof(struct elfhdr) +
  77. (*nphdr + 2)*sizeof(struct elf_phdr) +
  78. 3 * ((sizeof(struct elf_note)) +
  79. roundup(sizeof(CORE_STR), 4)) +
  80. roundup(sizeof(struct elf_prstatus), 4) +
  81. roundup(sizeof(struct elf_prpsinfo), 4) +
  82. roundup(arch_task_struct_size, 4);
  83. *elf_buflen = PAGE_ALIGN(*elf_buflen);
  84. return size + *elf_buflen;
  85. }
  86. static void free_kclist_ents(struct list_head *head)
  87. {
  88. struct kcore_list *tmp, *pos;
  89. list_for_each_entry_safe(pos, tmp, head, list) {
  90. list_del(&pos->list);
  91. kfree(pos);
  92. }
  93. }
  94. /*
  95. * Replace all KCORE_RAM/KCORE_VMEMMAP information with passed list.
  96. */
  97. static void __kcore_update_ram(struct list_head *list)
  98. {
  99. int nphdr;
  100. size_t size;
  101. struct kcore_list *tmp, *pos;
  102. LIST_HEAD(garbage);
  103. write_lock(&kclist_lock);
  104. if (kcore_need_update) {
  105. list_for_each_entry_safe(pos, tmp, &kclist_head, list) {
  106. if (pos->type == KCORE_RAM
  107. || pos->type == KCORE_VMEMMAP)
  108. list_move(&pos->list, &garbage);
  109. }
  110. list_splice_tail(list, &kclist_head);
  111. } else
  112. list_splice(list, &garbage);
  113. kcore_need_update = 0;
  114. proc_root_kcore->size = get_kcore_size(&nphdr, &size);
  115. write_unlock(&kclist_lock);
  116. free_kclist_ents(&garbage);
  117. }
  118. #ifdef CONFIG_HIGHMEM
  119. /*
  120. * If no highmem, we can assume [0...max_low_pfn) continuous range of memory
  121. * because memory hole is not as big as !HIGHMEM case.
  122. * (HIGHMEM is special because part of memory is _invisible_ from the kernel.)
  123. */
  124. static int kcore_update_ram(void)
  125. {
  126. LIST_HEAD(head);
  127. struct kcore_list *ent;
  128. int ret = 0;
  129. ent = kmalloc(sizeof(*ent), GFP_KERNEL);
  130. if (!ent)
  131. return -ENOMEM;
  132. ent->addr = (unsigned long)__va(0);
  133. ent->size = max_low_pfn << PAGE_SHIFT;
  134. ent->type = KCORE_RAM;
  135. list_add(&ent->list, &head);
  136. __kcore_update_ram(&head);
  137. return ret;
  138. }
  139. #else /* !CONFIG_HIGHMEM */
  140. #ifdef CONFIG_SPARSEMEM_VMEMMAP
  141. /* calculate vmemmap's address from given system ram pfn and register it */
  142. static int
  143. get_sparsemem_vmemmap_info(struct kcore_list *ent, struct list_head *head)
  144. {
  145. unsigned long pfn = __pa(ent->addr) >> PAGE_SHIFT;
  146. unsigned long nr_pages = ent->size >> PAGE_SHIFT;
  147. unsigned long start, end;
  148. struct kcore_list *vmm, *tmp;
  149. start = ((unsigned long)pfn_to_page(pfn)) & PAGE_MASK;
  150. end = ((unsigned long)pfn_to_page(pfn + nr_pages)) - 1;
  151. end = PAGE_ALIGN(end);
  152. /* overlap check (because we have to align page */
  153. list_for_each_entry(tmp, head, list) {
  154. if (tmp->type != KCORE_VMEMMAP)
  155. continue;
  156. if (start < tmp->addr + tmp->size)
  157. if (end > tmp->addr)
  158. end = tmp->addr;
  159. }
  160. if (start < end) {
  161. vmm = kmalloc(sizeof(*vmm), GFP_KERNEL);
  162. if (!vmm)
  163. return 0;
  164. vmm->addr = start;
  165. vmm->size = end - start;
  166. vmm->type = KCORE_VMEMMAP;
  167. list_add_tail(&vmm->list, head);
  168. }
  169. return 1;
  170. }
  171. #else
  172. static int
  173. get_sparsemem_vmemmap_info(struct kcore_list *ent, struct list_head *head)
  174. {
  175. return 1;
  176. }
  177. #endif
  178. static int
  179. kclist_add_private(unsigned long pfn, unsigned long nr_pages, void *arg)
  180. {
  181. struct list_head *head = (struct list_head *)arg;
  182. struct kcore_list *ent;
  183. ent = kmalloc(sizeof(*ent), GFP_KERNEL);
  184. if (!ent)
  185. return -ENOMEM;
  186. ent->addr = (unsigned long)__va((pfn << PAGE_SHIFT));
  187. ent->size = nr_pages << PAGE_SHIFT;
  188. /* Sanity check: Can happen in 32bit arch...maybe */
  189. if (ent->addr < (unsigned long) __va(0))
  190. goto free_out;
  191. /* cut not-mapped area. ....from ppc-32 code. */
  192. if (ULONG_MAX - ent->addr < ent->size)
  193. ent->size = ULONG_MAX - ent->addr;
  194. /* cut when vmalloc() area is higher than direct-map area */
  195. if (VMALLOC_START > (unsigned long)__va(0)) {
  196. if (ent->addr > VMALLOC_START)
  197. goto free_out;
  198. if (VMALLOC_START - ent->addr < ent->size)
  199. ent->size = VMALLOC_START - ent->addr;
  200. }
  201. ent->type = KCORE_RAM;
  202. list_add_tail(&ent->list, head);
  203. if (!get_sparsemem_vmemmap_info(ent, head)) {
  204. list_del(&ent->list);
  205. goto free_out;
  206. }
  207. return 0;
  208. free_out:
  209. kfree(ent);
  210. return 1;
  211. }
  212. static int kcore_update_ram(void)
  213. {
  214. int nid, ret;
  215. unsigned long end_pfn;
  216. LIST_HEAD(head);
  217. /* Not inialized....update now */
  218. /* find out "max pfn" */
  219. end_pfn = 0;
  220. for_each_node_state(nid, N_MEMORY) {
  221. unsigned long node_end;
  222. node_end = node_end_pfn(nid);
  223. if (end_pfn < node_end)
  224. end_pfn = node_end;
  225. }
  226. /* scan 0 to max_pfn */
  227. ret = walk_system_ram_range(0, end_pfn, &head, kclist_add_private);
  228. if (ret) {
  229. free_kclist_ents(&head);
  230. return -ENOMEM;
  231. }
  232. __kcore_update_ram(&head);
  233. return ret;
  234. }
  235. #endif /* CONFIG_HIGHMEM */
  236. /*****************************************************************************/
  237. /*
  238. * determine size of ELF note
  239. */
  240. static int notesize(struct memelfnote *en)
  241. {
  242. int sz;
  243. sz = sizeof(struct elf_note);
  244. sz += roundup((strlen(en->name) + 1), 4);
  245. sz += roundup(en->datasz, 4);
  246. return sz;
  247. } /* end notesize() */
  248. /*****************************************************************************/
  249. /*
  250. * store a note in the header buffer
  251. */
  252. static char *storenote(struct memelfnote *men, char *bufp)
  253. {
  254. struct elf_note en;
  255. #define DUMP_WRITE(addr,nr) do { memcpy(bufp,addr,nr); bufp += nr; } while(0)
  256. en.n_namesz = strlen(men->name) + 1;
  257. en.n_descsz = men->datasz;
  258. en.n_type = men->type;
  259. DUMP_WRITE(&en, sizeof(en));
  260. DUMP_WRITE(men->name, en.n_namesz);
  261. /* XXX - cast from long long to long to avoid need for libgcc.a */
  262. bufp = (char*) roundup((unsigned long)bufp,4);
  263. DUMP_WRITE(men->data, men->datasz);
  264. bufp = (char*) roundup((unsigned long)bufp,4);
  265. #undef DUMP_WRITE
  266. return bufp;
  267. } /* end storenote() */
  268. /*
  269. * store an ELF coredump header in the supplied buffer
  270. * nphdr is the number of elf_phdr to insert
  271. */
  272. static void elf_kcore_store_hdr(char *bufp, int nphdr, int dataoff)
  273. {
  274. struct elf_prstatus prstatus; /* NT_PRSTATUS */
  275. struct elf_prpsinfo prpsinfo; /* NT_PRPSINFO */
  276. struct elf_phdr *nhdr, *phdr;
  277. struct elfhdr *elf;
  278. struct memelfnote notes[3];
  279. off_t offset = 0;
  280. struct kcore_list *m;
  281. /* setup ELF header */
  282. elf = (struct elfhdr *) bufp;
  283. bufp += sizeof(struct elfhdr);
  284. offset += sizeof(struct elfhdr);
  285. memcpy(elf->e_ident, ELFMAG, SELFMAG);
  286. elf->e_ident[EI_CLASS] = ELF_CLASS;
  287. elf->e_ident[EI_DATA] = ELF_DATA;
  288. elf->e_ident[EI_VERSION]= EV_CURRENT;
  289. elf->e_ident[EI_OSABI] = ELF_OSABI;
  290. memset(elf->e_ident+EI_PAD, 0, EI_NIDENT-EI_PAD);
  291. elf->e_type = ET_CORE;
  292. elf->e_machine = ELF_ARCH;
  293. elf->e_version = EV_CURRENT;
  294. elf->e_entry = 0;
  295. elf->e_phoff = sizeof(struct elfhdr);
  296. elf->e_shoff = 0;
  297. elf->e_flags = ELF_CORE_EFLAGS;
  298. elf->e_ehsize = sizeof(struct elfhdr);
  299. elf->e_phentsize= sizeof(struct elf_phdr);
  300. elf->e_phnum = nphdr;
  301. elf->e_shentsize= 0;
  302. elf->e_shnum = 0;
  303. elf->e_shstrndx = 0;
  304. /* setup ELF PT_NOTE program header */
  305. nhdr = (struct elf_phdr *) bufp;
  306. bufp += sizeof(struct elf_phdr);
  307. offset += sizeof(struct elf_phdr);
  308. nhdr->p_type = PT_NOTE;
  309. nhdr->p_offset = 0;
  310. nhdr->p_vaddr = 0;
  311. nhdr->p_paddr = 0;
  312. nhdr->p_filesz = 0;
  313. nhdr->p_memsz = 0;
  314. nhdr->p_flags = 0;
  315. nhdr->p_align = 0;
  316. /* setup ELF PT_LOAD program header for every area */
  317. list_for_each_entry(m, &kclist_head, list) {
  318. phdr = (struct elf_phdr *) bufp;
  319. bufp += sizeof(struct elf_phdr);
  320. offset += sizeof(struct elf_phdr);
  321. phdr->p_type = PT_LOAD;
  322. phdr->p_flags = PF_R|PF_W|PF_X;
  323. phdr->p_offset = kc_vaddr_to_offset(m->addr) + dataoff;
  324. phdr->p_vaddr = (size_t)m->addr;
  325. phdr->p_paddr = 0;
  326. phdr->p_filesz = phdr->p_memsz = m->size;
  327. phdr->p_align = PAGE_SIZE;
  328. }
  329. /*
  330. * Set up the notes in similar form to SVR4 core dumps made
  331. * with info from their /proc.
  332. */
  333. nhdr->p_offset = offset;
  334. /* set up the process status */
  335. notes[0].name = CORE_STR;
  336. notes[0].type = NT_PRSTATUS;
  337. notes[0].datasz = sizeof(struct elf_prstatus);
  338. notes[0].data = &prstatus;
  339. memset(&prstatus, 0, sizeof(struct elf_prstatus));
  340. nhdr->p_filesz = notesize(&notes[0]);
  341. bufp = storenote(&notes[0], bufp);
  342. /* set up the process info */
  343. notes[1].name = CORE_STR;
  344. notes[1].type = NT_PRPSINFO;
  345. notes[1].datasz = sizeof(struct elf_prpsinfo);
  346. notes[1].data = &prpsinfo;
  347. memset(&prpsinfo, 0, sizeof(struct elf_prpsinfo));
  348. prpsinfo.pr_state = 0;
  349. prpsinfo.pr_sname = 'R';
  350. prpsinfo.pr_zomb = 0;
  351. strcpy(prpsinfo.pr_fname, "vmlinux");
  352. strlcpy(prpsinfo.pr_psargs, saved_command_line, sizeof(prpsinfo.pr_psargs));
  353. nhdr->p_filesz += notesize(&notes[1]);
  354. bufp = storenote(&notes[1], bufp);
  355. /* set up the task structure */
  356. notes[2].name = CORE_STR;
  357. notes[2].type = NT_TASKSTRUCT;
  358. notes[2].datasz = arch_task_struct_size;
  359. notes[2].data = current;
  360. nhdr->p_filesz += notesize(&notes[2]);
  361. bufp = storenote(&notes[2], bufp);
  362. } /* end elf_kcore_store_hdr() */
  363. /*****************************************************************************/
  364. /*
  365. * read from the ELF header and then kernel memory
  366. */
  367. static ssize_t
  368. read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos)
  369. {
  370. char *buf = file->private_data;
  371. ssize_t acc = 0;
  372. size_t size, tsz;
  373. size_t elf_buflen;
  374. int nphdr;
  375. unsigned long start;
  376. read_lock(&kclist_lock);
  377. size = get_kcore_size(&nphdr, &elf_buflen);
  378. if (buflen == 0 || *fpos >= size) {
  379. read_unlock(&kclist_lock);
  380. return 0;
  381. }
  382. /* trim buflen to not go beyond EOF */
  383. if (buflen > size - *fpos)
  384. buflen = size - *fpos;
  385. /* construct an ELF core header if we'll need some of it */
  386. if (*fpos < elf_buflen) {
  387. char * elf_buf;
  388. tsz = elf_buflen - *fpos;
  389. if (buflen < tsz)
  390. tsz = buflen;
  391. elf_buf = kzalloc(elf_buflen, GFP_ATOMIC);
  392. if (!elf_buf) {
  393. read_unlock(&kclist_lock);
  394. return -ENOMEM;
  395. }
  396. elf_kcore_store_hdr(elf_buf, nphdr, elf_buflen);
  397. read_unlock(&kclist_lock);
  398. if (copy_to_user(buffer, elf_buf + *fpos, tsz)) {
  399. kfree(elf_buf);
  400. return -EFAULT;
  401. }
  402. kfree(elf_buf);
  403. buflen -= tsz;
  404. *fpos += tsz;
  405. buffer += tsz;
  406. acc += tsz;
  407. /* leave now if filled buffer already */
  408. if (buflen == 0)
  409. return acc;
  410. } else
  411. read_unlock(&kclist_lock);
  412. /*
  413. * Check to see if our file offset matches with any of
  414. * the addresses in the elf_phdr on our list.
  415. */
  416. start = kc_offset_to_vaddr(*fpos - elf_buflen);
  417. if ((tsz = (PAGE_SIZE - (start & ~PAGE_MASK))) > buflen)
  418. tsz = buflen;
  419. while (buflen) {
  420. struct kcore_list *m;
  421. read_lock(&kclist_lock);
  422. list_for_each_entry(m, &kclist_head, list) {
  423. if (start >= m->addr && start < (m->addr+m->size))
  424. break;
  425. }
  426. read_unlock(&kclist_lock);
  427. if (&m->list == &kclist_head) {
  428. if (clear_user(buffer, tsz))
  429. return -EFAULT;
  430. } else if (is_vmalloc_or_module_addr((void *)start)) {
  431. vread(buf, (char *)start, tsz);
  432. /* we have to zero-fill user buffer even if no read */
  433. if (copy_to_user(buffer, buf, tsz))
  434. return -EFAULT;
  435. } else if (m->type == KCORE_USER) {
  436. /* User page is handled prior to normal kernel page: */
  437. if (copy_to_user(buffer, (char *)start, tsz))
  438. return -EFAULT;
  439. } else {
  440. if (kern_addr_valid(start)) {
  441. /*
  442. * Using bounce buffer to bypass the
  443. * hardened user copy kernel text checks.
  444. */
  445. if (probe_kernel_read(buf, (void *) start, tsz)) {
  446. if (clear_user(buffer, tsz))
  447. return -EFAULT;
  448. } else {
  449. if (copy_to_user(buffer, buf, tsz))
  450. return -EFAULT;
  451. }
  452. } else {
  453. if (clear_user(buffer, tsz))
  454. return -EFAULT;
  455. }
  456. }
  457. buflen -= tsz;
  458. *fpos += tsz;
  459. buffer += tsz;
  460. acc += tsz;
  461. start += tsz;
  462. tsz = (buflen > PAGE_SIZE ? PAGE_SIZE : buflen);
  463. }
  464. return acc;
  465. }
  466. static int open_kcore(struct inode *inode, struct file *filp)
  467. {
  468. if (!capable(CAP_SYS_RAWIO))
  469. return -EPERM;
  470. filp->private_data = kmalloc(PAGE_SIZE, GFP_KERNEL);
  471. if (!filp->private_data)
  472. return -ENOMEM;
  473. if (kcore_need_update)
  474. kcore_update_ram();
  475. if (i_size_read(inode) != proc_root_kcore->size) {
  476. inode_lock(inode);
  477. i_size_write(inode, proc_root_kcore->size);
  478. inode_unlock(inode);
  479. }
  480. return 0;
  481. }
  482. static int release_kcore(struct inode *inode, struct file *file)
  483. {
  484. kfree(file->private_data);
  485. return 0;
  486. }
  487. static const struct file_operations proc_kcore_operations = {
  488. .read = read_kcore,
  489. .open = open_kcore,
  490. .release = release_kcore,
  491. .llseek = default_llseek,
  492. };
  493. /* just remember that we have to update kcore */
  494. static int __meminit kcore_callback(struct notifier_block *self,
  495. unsigned long action, void *arg)
  496. {
  497. switch (action) {
  498. case MEM_ONLINE:
  499. case MEM_OFFLINE:
  500. write_lock(&kclist_lock);
  501. kcore_need_update = 1;
  502. write_unlock(&kclist_lock);
  503. }
  504. return NOTIFY_OK;
  505. }
  506. static struct notifier_block kcore_callback_nb __meminitdata = {
  507. .notifier_call = kcore_callback,
  508. .priority = 0,
  509. };
  510. static struct kcore_list kcore_vmalloc;
  511. #ifdef CONFIG_ARCH_PROC_KCORE_TEXT
  512. static struct kcore_list kcore_text;
  513. /*
  514. * If defined, special segment is used for mapping kernel text instead of
  515. * direct-map area. We need to create special TEXT section.
  516. */
  517. static void __init proc_kcore_text_init(void)
  518. {
  519. kclist_add(&kcore_text, _text, _end - _text, KCORE_TEXT);
  520. }
  521. #else
  522. static void __init proc_kcore_text_init(void)
  523. {
  524. }
  525. #endif
  526. #if defined(CONFIG_MODULES) && defined(MODULES_VADDR)
  527. /*
  528. * MODULES_VADDR has no intersection with VMALLOC_ADDR.
  529. */
  530. struct kcore_list kcore_modules;
  531. static void __init add_modules_range(void)
  532. {
  533. if (MODULES_VADDR != VMALLOC_START && MODULES_END != VMALLOC_END) {
  534. kclist_add(&kcore_modules, (void *)MODULES_VADDR,
  535. MODULES_END - MODULES_VADDR, KCORE_VMALLOC);
  536. }
  537. }
  538. #else
  539. static void __init add_modules_range(void)
  540. {
  541. }
  542. #endif
  543. static int __init proc_kcore_init(void)
  544. {
  545. proc_root_kcore = proc_create("kcore", S_IRUSR, NULL,
  546. &proc_kcore_operations);
  547. if (!proc_root_kcore) {
  548. pr_err("couldn't create /proc/kcore\n");
  549. return 0; /* Always returns 0. */
  550. }
  551. /* Store text area if it's special */
  552. proc_kcore_text_init();
  553. /* Store vmalloc area */
  554. kclist_add(&kcore_vmalloc, (void *)VMALLOC_START,
  555. VMALLOC_END - VMALLOC_START, KCORE_VMALLOC);
  556. add_modules_range();
  557. /* Store direct-map area from physical memory map */
  558. kcore_update_ram();
  559. register_hotmemory_notifier(&kcore_callback_nb);
  560. return 0;
  561. }
  562. fs_initcall(proc_kcore_init);