2022-02-01 20:48:51

by Eric W. Biederman

[permalink] [raw]
Subject: [PATCH 1/5] coredump: Move definition of struct coredump_params into coredump.h


Move the definition of struct coredump_params into coredump.h where
it belongs.

Remove the slightly errorneous comment explaining why struct
coredump_params was declared in binfmts.h.

Signed-off-by: "Eric W. Biederman" <[email protected]>
---
include/linux/binfmts.h | 13 +------------
include/linux/coredump.h | 12 +++++++++++-
2 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 049cf9421d83..05a91f5499ba 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -8,6 +8,7 @@
#include <uapi/linux/binfmts.h>

struct filename;
+struct coredump_params;

#define CORENAME_MAX_SIZE 128

@@ -77,18 +78,6 @@ struct linux_binprm {
#define BINPRM_FLAGS_PRESERVE_ARGV0_BIT 3
#define BINPRM_FLAGS_PRESERVE_ARGV0 (1 << BINPRM_FLAGS_PRESERVE_ARGV0_BIT)

-/* Function parameter for binfmt->coredump */
-struct coredump_params {
- const kernel_siginfo_t *siginfo;
- struct pt_regs *regs;
- struct file *file;
- unsigned long limit;
- unsigned long mm_flags;
- loff_t written;
- loff_t pos;
- loff_t to_skip;
-};
-
/*
* This structure defines the functions that are used to load the binary formats that
* linux accepts.
diff --git a/include/linux/coredump.h b/include/linux/coredump.h
index 248a68c668b4..2ee1460a1d66 100644
--- a/include/linux/coredump.h
+++ b/include/linux/coredump.h
@@ -14,11 +14,21 @@ struct core_vma_metadata {
unsigned long dump_size;
};

+struct coredump_params {
+ const kernel_siginfo_t *siginfo;
+ struct pt_regs *regs;
+ struct file *file;
+ unsigned long limit;
+ unsigned long mm_flags;
+ loff_t written;
+ loff_t pos;
+ loff_t to_skip;
+};
+
/*
* These are the only things you should do on a core-file: use only these
* functions to write out all the necessary info.
*/
-struct coredump_params;
extern void dump_skip_to(struct coredump_params *cprm, unsigned long to);
extern void dump_skip(struct coredump_params *cprm, size_t nr);
extern int dump_emit(struct coredump_params *cprm, const void *addr, int nr);
--
2.29.2


2022-02-02 02:42:57

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 1/5] coredump: Move definition of struct coredump_params into coredump.h

Hi "Eric,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.17-rc2 next-20220131]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Eric-W-Biederman/coredump-Move-definition-of-struct-coredump_params-into-coredump-h/20220201-034653
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 26291c54e111ff6ba87a164d85d4a4e134b7315c
config: m68k-m5208evb_defconfig (https://download.01.org/0day-ci/archive/20220201/[email protected]/config)
compiler: m68k-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/51661b08028418cf7e46f97d7e7dbee927cd61e0
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Eric-W-Biederman/coredump-Move-definition-of-struct-coredump_params-into-coredump-h/20220201-034653
git checkout 51661b08028418cf7e46f97d7e7dbee927cd61e0
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=m68k SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

In file included from include/linux/kernel.h:29,
from fs/binfmt_flat.c:21:
fs/binfmt_flat.c: In function 'flat_core_dump':
>> fs/binfmt_flat.c:118:50: error: invalid use of undefined type 'struct coredump_params'
118 | current->comm, current->pid, cprm->siginfo->si_signo);
| ^~
include/linux/printk.h:418:33: note: in definition of macro 'printk_index_wrap'
418 | _p_func(_fmt, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/printk.h:499:9: note: in expansion of macro 'printk'
499 | printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~
fs/binfmt_flat.c:117:9: note: in expansion of macro 'pr_warn'
117 | pr_warn("Process %s:%d received signr %d and should have core dumped\n",
| ^~~~~~~


vim +118 fs/binfmt_flat.c

^1da177e4c3f41 Linus Torvalds 2005-04-16 108
^1da177e4c3f41 Linus Torvalds 2005-04-16 109 /****************************************************************************/
^1da177e4c3f41 Linus Torvalds 2005-04-16 110 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 111 * Routine writes a core dump image in the current directory.
^1da177e4c3f41 Linus Torvalds 2005-04-16 112 * Currently only a stub-function.
^1da177e4c3f41 Linus Torvalds 2005-04-16 113 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 114
f6151dfea21496 Masami Hiramatsu 2009-12-17 115 static int flat_core_dump(struct coredump_params *cprm)
^1da177e4c3f41 Linus Torvalds 2005-04-16 116 {
4adbb6ac4b807e Nicolas Pitre 2016-07-24 117 pr_warn("Process %s:%d received signr %d and should have core dumped\n",
13c3f50c914e6a Nicolas Pitre 2016-07-24 @118 current->comm, current->pid, cprm->siginfo->si_signo);
13c3f50c914e6a Nicolas Pitre 2016-07-24 119 return 1;
^1da177e4c3f41 Linus Torvalds 2005-04-16 120 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 121

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

2022-02-03 20:39:02

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 1/5] coredump: Move definition of struct coredump_params into coredump.h

Hi "Eric,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.17-rc2 next-20220131]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Eric-W-Biederman/coredump-Move-definition-of-struct-coredump_params-into-coredump-h/20220201-034653
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 26291c54e111ff6ba87a164d85d4a4e134b7315c
config: riscv-buildonly-randconfig-r005-20220131 (https://download.01.org/0day-ci/archive/20220201/[email protected]/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 2cdbaca3943a4d6259119f185656328bd3805b68)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/51661b08028418cf7e46f97d7e7dbee927cd61e0
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Eric-W-Biederman/coredump-Move-definition-of-struct-coredump_params-into-coredump-h/20220201-034653
git checkout 51661b08028418cf7e46f97d7e7dbee927cd61e0
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

>> fs/binfmt_flat.c:118:36: error: incomplete definition of type 'struct coredump_params'
current->comm, current->pid, cprm->siginfo->si_signo);
~~~~^
include/linux/printk.h:499:37: note: expanded from macro 'pr_warn'
printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~~~~
include/linux/printk.h:446:60: note: expanded from macro 'printk'
#define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
^~~~~~~~~~~
include/linux/printk.h:418:19: note: expanded from macro 'printk_index_wrap'
_p_func(_fmt, ##__VA_ARGS__); \
^~~~~~~~~~~
include/linux/binfmts.h:11:8: note: forward declaration of 'struct coredump_params'
struct coredump_params;
^
1 error generated.


vim +118 fs/binfmt_flat.c

^1da177e4c3f41 Linus Torvalds 2005-04-16 108
^1da177e4c3f41 Linus Torvalds 2005-04-16 109 /****************************************************************************/
^1da177e4c3f41 Linus Torvalds 2005-04-16 110 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 111 * Routine writes a core dump image in the current directory.
^1da177e4c3f41 Linus Torvalds 2005-04-16 112 * Currently only a stub-function.
^1da177e4c3f41 Linus Torvalds 2005-04-16 113 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 114
f6151dfea21496 Masami Hiramatsu 2009-12-17 115 static int flat_core_dump(struct coredump_params *cprm)
^1da177e4c3f41 Linus Torvalds 2005-04-16 116 {
4adbb6ac4b807e Nicolas Pitre 2016-07-24 117 pr_warn("Process %s:%d received signr %d and should have core dumped\n",
13c3f50c914e6a Nicolas Pitre 2016-07-24 @118 current->comm, current->pid, cprm->siginfo->si_signo);
13c3f50c914e6a Nicolas Pitre 2016-07-24 119 return 1;
^1da177e4c3f41 Linus Torvalds 2005-04-16 120 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 121

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]