From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E76C8C001DB for ; Mon, 14 Aug 2023 14:31:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D0B276B0074; Mon, 14 Aug 2023 10:31:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CBA826B0075; Mon, 14 Aug 2023 10:31:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B81DC8E0001; Mon, 14 Aug 2023 10:31:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id A7C8A6B0074 for ; Mon, 14 Aug 2023 10:31:20 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 2EC24B215B for ; Mon, 14 Aug 2023 14:31:19 +0000 (UTC) X-FDA: 81122947878.17.AB01104 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by imf25.hostedemail.com (Postfix) with ESMTP id 34E08A001E for ; Mon, 14 Aug 2023 14:31:15 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=nkWuazMU; spf=pass (imf25.hostedemail.com: domain of lkp@intel.com designates 192.55.52.115 as permitted sender) smtp.mailfrom=lkp@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1692023477; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=LcrU+9oMev6Itda+UBTPDC/zu15xW6Gnh2mYecH2wLk=; b=QnLGLAgxGa+6YOl4rIBPIay61ZSaoOoWggLtsBfz91IxlA51S+6qyOxnt9dqej1HPhYdZv sDOKK7XDEL1xY1EldXn3uvd7lvajJr+0xiRNZoaPA0KKT1ENWmmBoOVruNfba6xdxRP2OQ tMEW+KUTpEkHUhutRRaNaZ62m0s2nEI= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=nkWuazMU; spf=pass (imf25.hostedemail.com: domain of lkp@intel.com designates 192.55.52.115 as permitted sender) smtp.mailfrom=lkp@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1692023477; a=rsa-sha256; cv=none; b=vQ26alo8rRtpNu0gYijJ0VJyQoheIrX0i2Gn5Z0foWkVPuDU7rVKZmnTFvr5h87Qcrni1C 18xUTsNtGPPLR60E405+C+aDnUcIt1rtaj0ZyWCqN54bC/MScgW0MLdY2I9attIuv0KWcO p0YeULkfeYNngbhAAinV6QIGWmn4L/M= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1692023476; x=1723559476; h=date:from:to:cc:subject:message-id:mime-version; bh=3hGNuogA1q0MzSOkzYz6r0rTwhhUJjNFQD60UGjNo4s=; b=nkWuazMUm1L3yoySDMEvXf2HougBi0cZUrkCpZjP9s7C6q59U4W4xHqi jxUx7tRD4kqyrBQcLRSQBwuVO4oD/kpJIzAyBZ78Qm5uwohhZsMa0RF8W MWnnl3JRWaMvPOwqotqvqO6IlW33LB82+a8x2tJMS0NMHWk3awjuy85Bw 4FQQjRVjFzWovh1YOjQmh1CChq9XniuKwfUntbqVDTcJ6jrXQR/4kubRe 5JhjC50DGhdM1bZKEIGw/KbTgjoWikPtyzYZdRQ/zNoKWMnAS5JJjXgTe ZNkFZtxtpJ5sl+n3By6L7E0KOZJAfAk0WFSKPPLbJZuYZIeEleVLSaS2A Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10802"; a="372044235" X-IronPort-AV: E=Sophos;i="6.01,172,1684825200"; d="scan'208";a="372044235" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Aug 2023 07:31:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10802"; a="727025397" X-IronPort-AV: E=Sophos;i="6.01,172,1684825200"; d="scan'208";a="727025397" Received: from lkp-server02.sh.intel.com (HELO b5fb8d9e1ffc) ([10.239.97.151]) by orsmga007.jf.intel.com with ESMTP; 14 Aug 2023 07:31:11 -0700 Received: from kbuild by b5fb8d9e1ffc with local (Exim 4.96) (envelope-from ) id 1qVYb8-0000C3-1R; Mon, 14 Aug 2023 14:31:10 +0000 Date: Mon, 14 Aug 2023 22:30:33 +0800 From: kernel test robot To: Eric DeVolder Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev, Andrew Morton , Linux Memory Management List , Sourabh Jain Subject: [akpm-mm:mm-nonmm-unstable 63/70] kernel/crash_core.c:318:40: warning: declaration of 'struct crash_mem' will not be visible outside of this function Message-ID: <202308142200.xficd195-lkp@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Rspamd-Queue-Id: 34E08A001E X-Rspam-User: X-Stat-Signature: 8r39t9qg5e8gb4ghnaoq3extgsnm8i8p X-Rspamd-Server: rspam01 X-HE-Tag: 1692023475-289988 X-HE-Meta: U2FsdGVkX1/3BNpzK1A2KbTB/niLmc6jRGCS0mhj+rjQKDQbkDKRYQNHE/ctZta0Y0zy4sSz7aug+yUy5TmUVSfDMscU4d0OHz4YTlS6UfMpmU2wkDsxQlWRrMnyshJ5ccYLNPPQRDh7KEAtXbnAfOdrl6273EZ/8N7LZ7n/PPJgofaUhIj94El3I5kEkYk7elabyiJjrzT57xeztCXzHkwhvkFgxbrihhmrvgVEtzv1Wi8OJ4jH/d9nDhGrzar+eLqUkm9qHgZXEK5+zlqACe64qYkt2yMagFq0sm3TEZqn6U43JYc3ao+UuOI/nYLzXMPAipcWLv9KKJzsqc5BxMvkCBzYEeP2seZ8PoGOHi2H8bT513tRIjB7bkLXbSNriJsKHCH96NGCZFagmkWA6JegBjt1e4iFx+xow/PdlejBY0jWmdE8Z8xV3ivsYZb/CFv4LXhjIfmzcSCad03RumaQvqCEu/SrpMEkmhuLnGJLmXBBilx5N2Z8ZNMO2gwb0pjInH6C70SGCVqHg80b/mlG68/H3H4oiL2InDMh/ZcD2lV4U1gKdWBx3LIx+vFmAuMdYpUptAefF2EatFtfsjiUrEyns+ewwVNGLLmI688ubvNXApqtFbYWmVzssJevNC7NWasGDXReqXq2xWA1PuSn+I/qJCoFF65ZS7p1OmSdzgZ/72TvB4Qz/w+vUocmIY+fFggSL3yEKvUfsNrR0AHZw7fwU9j8j5HewfZX1lHyEQWQgXGSITjDYlkL83US5a6TCQDZ7itb3pL17TeHmgDcskzWlw2xQ4z2i6C95qgeDEVg5FQktWkxoK+qT8eH5OvC7gWbecZPEknRkq52NC6zRkQRsYkz3aj509zuwsaS6lwoEc9QGKr64sm+wyFAFncYVuzfHn6lDx/hV54Kd7v7rCURHQNlBIuufQWxMf4MCY5QEcI74kl/jG+x4upHwTtxbC3BoZGrtg2zBCQ eXNPKzTX Omw/ywnG5ab+kA8Mz+jYcexPHVpjJsoQfNZe/R/RgSi98X15kwFPkb4oDZmVB5zG9zZeCGAdsLIXmK/z5ABJZRNis4jnRffuYwidIHAb0b31JIvZlZjK/RuGG8quBAcbFI2hKAanRpiyQd4TyRtenI5hUqEoaw7bcn5Zu0iSz0akVkI6M/96Ix4O+tjcoL+7sMWVj2PBg1Qo0ZEkujLaDPeWxS1WWBTxPXfSuO/SuBekuQh8X0gjcK8mb/n0FgYgBZ1PdA76vvfbbwZtjZ/2EG8H2YxwbFNt5pLxqO5dsNp1mQuandFQO/nIqtZmivXU5aB00O/crcLz4of3E9oumLF0pAzfKhO4kPtpg8P2ck8S5f053h9/c9vQz1ZjEXUBSNJVhlJKFQRDfufR7j+BIhYgA0xZHVe4p9too X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: tree: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-nonmm-unstable head: a9c5ffc5c68640a5ade3d65a43954a0971d8cfd2 commit: 3afa7700e148b3ce7af3656a8fe46c0f3625e7ea [63/70] crash: move a few code bits to setup support of crash hotplug config: um-allnoconfig (https://download.01.org/0day-ci/archive/20230814/202308142200.xficd195-lkp@intel.com/config) compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a) reproduce: (https://download.01.org/0day-ci/archive/20230814/202308142200.xficd195-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot | Closes: https://lore.kernel.org/oe-kbuild-all/202308142200.xficd195-lkp@intel.com/ All warnings (new ones prefixed by >>): In file included from kernel/crash_core.c:13: In file included from include/linux/kexec.h:19: In file included from arch/um/include/asm/io.h:24: include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 547 | val = __raw_readb(PCI_IOBASE + addr); | ~~~~~~~~~~ ^ include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 560 | val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr)); | ~~~~~~~~~~ ^ include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu' 37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x)) | ^ In file included from kernel/crash_core.c:13: In file included from include/linux/kexec.h:19: In file included from arch/um/include/asm/io.h:24: include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 573 | val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr)); | ~~~~~~~~~~ ^ include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu' 35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x)) | ^ In file included from kernel/crash_core.c:13: In file included from include/linux/kexec.h:19: In file included from arch/um/include/asm/io.h:24: include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 584 | __raw_writeb(value, PCI_IOBASE + addr); | ~~~~~~~~~~ ^ include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 594 | __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr); | ~~~~~~~~~~ ^ include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 604 | __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr); | ~~~~~~~~~~ ^ include/asm-generic/io.h:692:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 692 | readsb(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ include/asm-generic/io.h:700:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 700 | readsw(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ include/asm-generic/io.h:708:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 708 | readsl(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ include/asm-generic/io.h:717:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 717 | writesb(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ include/asm-generic/io.h:726:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 726 | writesw(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ include/asm-generic/io.h:735:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 735 | writesl(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ >> kernel/crash_core.c:318:40: warning: declaration of 'struct crash_mem' will not be visible outside of this function [-Wvisibility] 318 | int crash_prepare_elf64_headers(struct crash_mem *mem, int need_kernel_map, | ^ kernel/crash_core.c:331:16: error: incomplete definition of type 'struct crash_mem' 331 | nr_phdr += mem->nr_ranges; | ~~~^ kernel/crash_core.c:318:40: note: forward declaration of 'struct crash_mem' 318 | int crash_prepare_elf64_headers(struct crash_mem *mem, int need_kernel_map, | ^ kernel/crash_core.c:343:25: error: use of undeclared identifier 'ELF_CORE_HEADER_ALIGN' 343 | elf_sz = ALIGN(elf_sz, ELF_CORE_HEADER_ALIGN); | ^ kernel/crash_core.c:343:25: error: use of undeclared identifier 'ELF_CORE_HEADER_ALIGN' kernel/crash_core.c:393:21: error: incomplete definition of type 'struct crash_mem' 393 | for (i = 0; i < mem->nr_ranges; i++) { | ~~~^ kernel/crash_core.c:318:40: note: forward declaration of 'struct crash_mem' 318 | int crash_prepare_elf64_headers(struct crash_mem *mem, int need_kernel_map, | ^ kernel/crash_core.c:394:15: error: incomplete definition of type 'struct crash_mem' 394 | mstart = mem->ranges[i].start; | ~~~^ kernel/crash_core.c:318:40: note: forward declaration of 'struct crash_mem' 318 | int crash_prepare_elf64_headers(struct crash_mem *mem, int need_kernel_map, | ^ kernel/crash_core.c:395:13: error: incomplete definition of type 'struct crash_mem' 395 | mend = mem->ranges[i].end; | ~~~^ kernel/crash_core.c:318:40: note: forward declaration of 'struct crash_mem' 318 | int crash_prepare_elf64_headers(struct crash_mem *mem, int need_kernel_map, | ^ >> kernel/crash_core.c:318:5: warning: no previous prototype for function 'crash_prepare_elf64_headers' [-Wmissing-prototypes] 318 | int crash_prepare_elf64_headers(struct crash_mem *mem, int need_kernel_map, | ^ kernel/crash_core.c:318:1: note: declare 'static' if the function is not intended to be used outside of this translation unit 318 | int crash_prepare_elf64_headers(struct crash_mem *mem, int need_kernel_map, | ^ | static kernel/crash_core.c:417:36: warning: declaration of 'struct crash_mem' will not be visible outside of this function [-Wvisibility] 417 | int crash_exclude_mem_range(struct crash_mem *mem, | ^ kernel/crash_core.c:424:21: error: incomplete definition of type 'struct crash_mem' 424 | for (i = 0; i < mem->nr_ranges; i++) { | ~~~^ kernel/crash_core.c:417:36: note: forward declaration of 'struct crash_mem' 417 | int crash_exclude_mem_range(struct crash_mem *mem, | ^ kernel/crash_core.c:425:14: error: incomplete definition of type 'struct crash_mem' 425 | start = mem->ranges[i].start; | ~~~^ kernel/crash_core.c:417:36: note: forward declaration of 'struct crash_mem' 417 | int crash_exclude_mem_range(struct crash_mem *mem, | ^ kernel/crash_core.c:426:12: error: incomplete definition of type 'struct crash_mem' 426 | end = mem->ranges[i].end; | ~~~^ kernel/crash_core.c:417:36: note: forward declaration of 'struct crash_mem' 417 | int crash_exclude_mem_range(struct crash_mem *mem, | ^ kernel/crash_core.c:441:7: error: incomplete definition of type 'struct crash_mem' 441 | mem->ranges[i].start = 0; | ~~~^ kernel/crash_core.c:417:36: note: forward declaration of 'struct crash_mem' 417 | int crash_exclude_mem_range(struct crash_mem *mem, | ^ kernel/crash_core.c:442:7: error: incomplete definition of type 'struct crash_mem' 442 | mem->ranges[i].end = 0; | ~~~^ kernel/crash_core.c:417:36: note: forward declaration of 'struct crash_mem' 417 | int crash_exclude_mem_range(struct crash_mem *mem, | ^ kernel/crash_core.c:443:15: error: incomplete definition of type 'struct crash_mem' 443 | if (i < mem->nr_ranges - 1) { | ~~~^ kernel/crash_core.c:417:36: note: forward declaration of 'struct crash_mem' 417 | int crash_exclude_mem_range(struct crash_mem *mem, | ^ kernel/crash_core.c:445:24: error: incomplete definition of type 'struct crash_mem' 445 | for (j = i; j < mem->nr_ranges - 1; j++) { | ~~~^ kernel/crash_core.c:417:36: note: forward declaration of 'struct crash_mem' 417 | int crash_exclude_mem_range(struct crash_mem *mem, | ^ kernel/crash_core.c:446:9: error: incomplete definition of type 'struct crash_mem' 446 | mem->ranges[j].start = | ~~~^ kernel/crash_core.c:417:36: note: forward declaration of 'struct crash_mem' 417 | int crash_exclude_mem_range(struct crash_mem *mem, | ^ kernel/crash_core.c:447:10: error: incomplete definition of type 'struct crash_mem' 447 | mem->ranges[j+1].start; | ~~~^ kernel/crash_core.c:417:36: note: forward declaration of 'struct crash_mem' 417 | int crash_exclude_mem_range(struct crash_mem *mem, | ^ kernel/crash_core.c:448:9: error: incomplete definition of type 'struct crash_mem' 448 | mem->ranges[j].end = | ~~~^ kernel/crash_core.c:417:36: note: forward declaration of 'struct crash_mem' 417 | int crash_exclude_mem_range(struct crash_mem *mem, | ^ kernel/crash_core.c:449:11: error: incomplete definition of type 'struct crash_mem' 449 | mem->ranges[j+1].end; | ~~~^ kernel/crash_core.c:417:36: note: forward declaration of 'struct crash_mem' 417 | int crash_exclude_mem_range(struct crash_mem *mem, | ^ kernel/crash_core.c:458:8: error: incomplete definition of type 'struct crash_mem' 458 | mem->nr_ranges--; | ~~~^ kernel/crash_core.c:417:36: note: forward declaration of 'struct crash_mem' 417 | int crash_exclude_mem_range(struct crash_mem *mem, | ^ kernel/crash_core.c:461:7: error: incomplete definition of type 'struct crash_mem' 461 | mem->nr_ranges--; | ~~~^ kernel/crash_core.c:417:36: note: forward declaration of 'struct crash_mem' 417 | int crash_exclude_mem_range(struct crash_mem *mem, | ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 15 warnings and 20 errors generated. vim +318 kernel/crash_core.c 317 > 318 int crash_prepare_elf64_headers(struct crash_mem *mem, int need_kernel_map, 319 void **addr, unsigned long *sz) 320 { 321 Elf64_Ehdr *ehdr; 322 Elf64_Phdr *phdr; 323 unsigned long nr_cpus = num_possible_cpus(), nr_phdr, elf_sz; 324 unsigned char *buf; 325 unsigned int cpu, i; 326 unsigned long long notes_addr; 327 unsigned long mstart, mend; 328 329 /* extra phdr for vmcoreinfo ELF note */ 330 nr_phdr = nr_cpus + 1; 331 nr_phdr += mem->nr_ranges; 332 333 /* 334 * kexec-tools creates an extra PT_LOAD phdr for kernel text mapping 335 * area (for example, ffffffff80000000 - ffffffffa0000000 on x86_64). 336 * I think this is required by tools like gdb. So same physical 337 * memory will be mapped in two ELF headers. One will contain kernel 338 * text virtual addresses and other will have __va(physical) addresses. 339 */ 340 341 nr_phdr++; 342 elf_sz = sizeof(Elf64_Ehdr) + nr_phdr * sizeof(Elf64_Phdr); 343 elf_sz = ALIGN(elf_sz, ELF_CORE_HEADER_ALIGN); 344 345 buf = vzalloc(elf_sz); 346 if (!buf) 347 return -ENOMEM; 348 349 ehdr = (Elf64_Ehdr *)buf; 350 phdr = (Elf64_Phdr *)(ehdr + 1); 351 memcpy(ehdr->e_ident, ELFMAG, SELFMAG); 352 ehdr->e_ident[EI_CLASS] = ELFCLASS64; 353 ehdr->e_ident[EI_DATA] = ELFDATA2LSB; 354 ehdr->e_ident[EI_VERSION] = EV_CURRENT; 355 ehdr->e_ident[EI_OSABI] = ELF_OSABI; 356 memset(ehdr->e_ident + EI_PAD, 0, EI_NIDENT - EI_PAD); 357 ehdr->e_type = ET_CORE; 358 ehdr->e_machine = ELF_ARCH; 359 ehdr->e_version = EV_CURRENT; 360 ehdr->e_phoff = sizeof(Elf64_Ehdr); 361 ehdr->e_ehsize = sizeof(Elf64_Ehdr); 362 ehdr->e_phentsize = sizeof(Elf64_Phdr); 363 364 /* Prepare one phdr of type PT_NOTE for each present CPU */ 365 for_each_present_cpu(cpu) { 366 phdr->p_type = PT_NOTE; 367 notes_addr = per_cpu_ptr_to_phys(per_cpu_ptr(crash_notes, cpu)); 368 phdr->p_offset = phdr->p_paddr = notes_addr; 369 phdr->p_filesz = phdr->p_memsz = sizeof(note_buf_t); 370 (ehdr->e_phnum)++; 371 phdr++; 372 } 373 374 /* Prepare one PT_NOTE header for vmcoreinfo */ 375 phdr->p_type = PT_NOTE; 376 phdr->p_offset = phdr->p_paddr = paddr_vmcoreinfo_note(); 377 phdr->p_filesz = phdr->p_memsz = VMCOREINFO_NOTE_SIZE; 378 (ehdr->e_phnum)++; 379 phdr++; 380 381 /* Prepare PT_LOAD type program header for kernel text region */ 382 if (need_kernel_map) { 383 phdr->p_type = PT_LOAD; 384 phdr->p_flags = PF_R|PF_W|PF_X; 385 phdr->p_vaddr = (unsigned long) _text; 386 phdr->p_filesz = phdr->p_memsz = _end - _text; 387 phdr->p_offset = phdr->p_paddr = __pa_symbol(_text); 388 ehdr->e_phnum++; 389 phdr++; 390 } 391 392 /* Go through all the ranges in mem->ranges[] and prepare phdr */ 393 for (i = 0; i < mem->nr_ranges; i++) { 394 mstart = mem->ranges[i].start; 395 mend = mem->ranges[i].end; 396 397 phdr->p_type = PT_LOAD; 398 phdr->p_flags = PF_R|PF_W|PF_X; 399 phdr->p_offset = mstart; 400 401 phdr->p_paddr = mstart; 402 phdr->p_vaddr = (unsigned long) __va(mstart); 403 phdr->p_filesz = phdr->p_memsz = mend - mstart + 1; 404 phdr->p_align = 0; 405 ehdr->e_phnum++; 406 pr_debug("Crash PT_LOAD ELF header. phdr=%p vaddr=0x%llx, paddr=0x%llx, sz=0x%llx e_phnum=%d p_offset=0x%llx\n", 407 phdr, phdr->p_vaddr, phdr->p_paddr, phdr->p_filesz, 408 ehdr->e_phnum, phdr->p_offset); 409 phdr++; 410 } 411 412 *addr = buf; 413 *sz = elf_sz; 414 return 0; 415 } 416 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki