[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <201901071513.DvXGPqpe%fengguang.wu@intel.com>
Date: Mon, 7 Jan 2019 15:25:40 +0800
From: kbuild test robot <lkp@...el.com>
To: "Dmitry V. Levin" <ldv@...linux.org>
Cc: kbuild-all@...org, Richard Henderson <rth@...ddle.net>,
Ivan Kokshaysky <ink@...assic.park.msu.ru>,
Matt Turner <mattst88@...il.com>,
Elvira Khabirova <lineprinter@...linux.org>,
Eugene Syromyatnikov <esyr@...hat.com>,
Oleg Nesterov <oleg@...hat.com>,
Andy Lutomirski <luto@...nel.org>, linux-alpha@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v7 03/22] alpha: define remaining syscall_get_* functions
Hi Dmitry,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.0-rc1 next-20190103]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Dmitry-V-Levin/asm-generic-syscall-h-prepare-for-inclusion-by-other-files/20190107-115241
config: alpha-allmodconfig (attached as .config)
compiler: alpha-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=alpha
All warnings (new ones prefixed by >>):
In file included from arch/alpha/include/asm/syscall.h:6:0,
from include/linux/audit.h:214,
from net/bridge/netfilter/ebtables.c:29:
include/asm-generic/syscall.h:61:1: warning: 'syscall_rollback' declared 'static' but never defined [-Wunused-function]
syscall_rollback(struct task_struct *task, struct pt_regs *regs);
^~~~~~~~~~~~~~~~
include/asm-generic/syscall.h:106:1: warning: 'syscall_set_return_value' declared 'static' but never defined [-Wunused-function]
syscall_set_return_value(struct task_struct *task, struct pt_regs *regs,
^~~~~~~~~~~~~~~~~~~~~~~~
>> include/asm-generic/syscall.h:174:1: warning: '__syscall_set_arguments' used but never defined
__syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
^~~~~~~~~~~~~~~~~~~~~~~
vim +/__syscall_set_arguments +174 include/asm-generic/syscall.h
828c365c Roland McGrath 2008-07-25 43
828c365c Roland McGrath 2008-07-25 44 /**
828c365c Roland McGrath 2008-07-25 45 * syscall_rollback - roll back registers after an aborted system call
828c365c Roland McGrath 2008-07-25 46 * @task: task of interest, must be in system call exit tracing
828c365c Roland McGrath 2008-07-25 47 * @regs: task_pt_regs() of @task
828c365c Roland McGrath 2008-07-25 48 *
828c365c Roland McGrath 2008-07-25 49 * It's only valid to call this when @task is stopped for system
828c365c Roland McGrath 2008-07-25 50 * call exit tracing (due to TIF_SYSCALL_TRACE or TIF_SYSCALL_AUDIT),
828c365c Roland McGrath 2008-07-25 51 * after tracehook_report_syscall_entry() returned nonzero to prevent
828c365c Roland McGrath 2008-07-25 52 * the system call from taking place.
828c365c Roland McGrath 2008-07-25 53 *
828c365c Roland McGrath 2008-07-25 54 * This rolls back the register state in @regs so it's as if the
828c365c Roland McGrath 2008-07-25 55 * system call instruction was a no-op. The registers containing
828c365c Roland McGrath 2008-07-25 56 * the system call number and arguments are as they were before the
828c365c Roland McGrath 2008-07-25 57 * system call instruction. This may not be the same as what the
828c365c Roland McGrath 2008-07-25 58 * register state looked like at system call entry tracing.
828c365c Roland McGrath 2008-07-25 59 */
ac0321df Dmitry V. Levin 2019-01-07 60 static void
ac0321df Dmitry V. Levin 2019-01-07 @61 syscall_rollback(struct task_struct *task, struct pt_regs *regs);
828c365c Roland McGrath 2008-07-25 62
828c365c Roland McGrath 2008-07-25 63 /**
828c365c Roland McGrath 2008-07-25 64 * syscall_get_error - check result of traced system call
828c365c Roland McGrath 2008-07-25 65 * @task: task of interest, must be blocked
828c365c Roland McGrath 2008-07-25 66 * @regs: task_pt_regs() of @task
828c365c Roland McGrath 2008-07-25 67 *
828c365c Roland McGrath 2008-07-25 68 * Returns 0 if the system call succeeded, or -ERRORCODE if it failed.
828c365c Roland McGrath 2008-07-25 69 *
828c365c Roland McGrath 2008-07-25 70 * It's only valid to call this when @task is stopped for tracing on exit
828c365c Roland McGrath 2008-07-25 71 * from a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
828c365c Roland McGrath 2008-07-25 72 */
ac0321df Dmitry V. Levin 2019-01-07 73 static long
ac0321df Dmitry V. Levin 2019-01-07 74 syscall_get_error(struct task_struct *task, struct pt_regs *regs);
828c365c Roland McGrath 2008-07-25 75
828c365c Roland McGrath 2008-07-25 76 /**
828c365c Roland McGrath 2008-07-25 77 * syscall_get_return_value - get the return value of a traced system call
828c365c Roland McGrath 2008-07-25 78 * @task: task of interest, must be blocked
828c365c Roland McGrath 2008-07-25 79 * @regs: task_pt_regs() of @task
828c365c Roland McGrath 2008-07-25 80 *
828c365c Roland McGrath 2008-07-25 81 * Returns the return value of the successful system call.
828c365c Roland McGrath 2008-07-25 82 * This value is meaningless if syscall_get_error() returned nonzero.
828c365c Roland McGrath 2008-07-25 83 *
828c365c Roland McGrath 2008-07-25 84 * It's only valid to call this when @task is stopped for tracing on exit
828c365c Roland McGrath 2008-07-25 85 * from a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
828c365c Roland McGrath 2008-07-25 86 */
ac0321df Dmitry V. Levin 2019-01-07 87 static long
ac0321df Dmitry V. Levin 2019-01-07 88 syscall_get_return_value(struct task_struct *task, struct pt_regs *regs);
828c365c Roland McGrath 2008-07-25 89
828c365c Roland McGrath 2008-07-25 90 /**
828c365c Roland McGrath 2008-07-25 91 * syscall_set_return_value - change the return value of a traced system call
828c365c Roland McGrath 2008-07-25 92 * @task: task of interest, must be blocked
828c365c Roland McGrath 2008-07-25 93 * @regs: task_pt_regs() of @task
828c365c Roland McGrath 2008-07-25 94 * @error: negative error code, or zero to indicate success
828c365c Roland McGrath 2008-07-25 95 * @val: user return value if @error is zero
828c365c Roland McGrath 2008-07-25 96 *
828c365c Roland McGrath 2008-07-25 97 * This changes the results of the system call that user mode will see.
828c365c Roland McGrath 2008-07-25 98 * If @error is zero, the user sees a successful system call with a
828c365c Roland McGrath 2008-07-25 99 * return value of @val. If @error is nonzero, it's a negated errno
828c365c Roland McGrath 2008-07-25 100 * code; the user sees a failed system call with this errno code.
828c365c Roland McGrath 2008-07-25 101 *
828c365c Roland McGrath 2008-07-25 102 * It's only valid to call this when @task is stopped for tracing on exit
828c365c Roland McGrath 2008-07-25 103 * from a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
828c365c Roland McGrath 2008-07-25 104 */
ac0321df Dmitry V. Levin 2019-01-07 105 static void
ac0321df Dmitry V. Levin 2019-01-07 106 syscall_set_return_value(struct task_struct *task, struct pt_regs *regs,
828c365c Roland McGrath 2008-07-25 107 int error, long val);
828c365c Roland McGrath 2008-07-25 108
828c365c Roland McGrath 2008-07-25 109 /**
828c365c Roland McGrath 2008-07-25 110 * syscall_get_arguments - extract system call parameter values
828c365c Roland McGrath 2008-07-25 111 * @task: task of interest, must be blocked
828c365c Roland McGrath 2008-07-25 112 * @regs: task_pt_regs() of @task
828c365c Roland McGrath 2008-07-25 113 * @i: argument index [0,5]
828c365c Roland McGrath 2008-07-25 114 * @n: number of arguments; n+i must be [1,6].
828c365c Roland McGrath 2008-07-25 115 * @args: array filled with argument values
828c365c Roland McGrath 2008-07-25 116 *
828c365c Roland McGrath 2008-07-25 117 * Fetches @n arguments to the system call starting with the @i'th argument
828c365c Roland McGrath 2008-07-25 118 * (from 0 through 5). Argument @i is stored in @args[0], and so on.
828c365c Roland McGrath 2008-07-25 119 * An arch inline version is probably optimal when @i and @n are constants.
828c365c Roland McGrath 2008-07-25 120 *
828c365c Roland McGrath 2008-07-25 121 * It's only valid to call this when @task is stopped for tracing on
828c365c Roland McGrath 2008-07-25 122 * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
828c365c Roland McGrath 2008-07-25 123 * It's invalid to call this with @i + @n > 6; we only support system calls
828c365c Roland McGrath 2008-07-25 124 * taking up to 6 arguments.
5dcf7654 Dmitry V. Levin 2019-01-07 125 *
5dcf7654 Dmitry V. Levin 2019-01-07 126 * This function is a wrapper around arch-specific __syscall_get_arguments.
828c365c Roland McGrath 2008-07-25 127 */
ac0321df Dmitry V. Levin 2019-01-07 128 static void
5dcf7654 Dmitry V. Levin 2019-01-07 129 __syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
828c365c Roland McGrath 2008-07-25 130 unsigned int i, unsigned int n, unsigned long *args);
828c365c Roland McGrath 2008-07-25 131
5dcf7654 Dmitry V. Levin 2019-01-07 132 static inline void
5dcf7654 Dmitry V. Levin 2019-01-07 133 syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
5dcf7654 Dmitry V. Levin 2019-01-07 134 unsigned int i, unsigned int n, unsigned long *args)
5dcf7654 Dmitry V. Levin 2019-01-07 135 {
5dcf7654 Dmitry V. Levin 2019-01-07 136 /*
5dcf7654 Dmitry V. Levin 2019-01-07 137 * Ideally there should have been a BUILD_BUG_ON(i + n > 6)
5dcf7654 Dmitry V. Levin 2019-01-07 138 * instead of these checks because it is a "cannot happen"
5dcf7654 Dmitry V. Levin 2019-01-07 139 * kind of assertion.
5dcf7654 Dmitry V. Levin 2019-01-07 140 */
5dcf7654 Dmitry V. Levin 2019-01-07 141 if (WARN_ON_ONCE(i > 6)) {
5dcf7654 Dmitry V. Levin 2019-01-07 142 memset(args, 0, n * sizeof(args[0]));
5dcf7654 Dmitry V. Levin 2019-01-07 143 return;
5dcf7654 Dmitry V. Levin 2019-01-07 144 }
5dcf7654 Dmitry V. Levin 2019-01-07 145 if (WARN_ON_ONCE(n > 6 - i)) {
5dcf7654 Dmitry V. Levin 2019-01-07 146 unsigned int extra = n - (6 - i);
5dcf7654 Dmitry V. Levin 2019-01-07 147
5dcf7654 Dmitry V. Levin 2019-01-07 148 n = 6 - i;
5dcf7654 Dmitry V. Levin 2019-01-07 149 memset(&args[n], 0, extra * sizeof(args[0]));
5dcf7654 Dmitry V. Levin 2019-01-07 150 }
5dcf7654 Dmitry V. Levin 2019-01-07 151 __syscall_get_arguments(task, regs, i, n, args);
5dcf7654 Dmitry V. Levin 2019-01-07 152 }
5dcf7654 Dmitry V. Levin 2019-01-07 153
828c365c Roland McGrath 2008-07-25 154 /**
828c365c Roland McGrath 2008-07-25 155 * syscall_set_arguments - change system call parameter value
828c365c Roland McGrath 2008-07-25 156 * @task: task of interest, must be in system call entry tracing
828c365c Roland McGrath 2008-07-25 157 * @regs: task_pt_regs() of @task
828c365c Roland McGrath 2008-07-25 158 * @i: argument index [0,5]
828c365c Roland McGrath 2008-07-25 159 * @n: number of arguments; n+i must be [1,6].
828c365c Roland McGrath 2008-07-25 160 * @args: array of argument values to store
828c365c Roland McGrath 2008-07-25 161 *
828c365c Roland McGrath 2008-07-25 162 * Changes @n arguments to the system call starting with the @i'th argument.
22f30168 Roland McGrath 2008-09-05 163 * Argument @i gets value @args[0], and so on.
828c365c Roland McGrath 2008-07-25 164 * An arch inline version is probably optimal when @i and @n are constants.
828c365c Roland McGrath 2008-07-25 165 *
828c365c Roland McGrath 2008-07-25 166 * It's only valid to call this when @task is stopped for tracing on
828c365c Roland McGrath 2008-07-25 167 * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
828c365c Roland McGrath 2008-07-25 168 * It's invalid to call this with @i + @n > 6; we only support system calls
828c365c Roland McGrath 2008-07-25 169 * taking up to 6 arguments.
5dcf7654 Dmitry V. Levin 2019-01-07 170 *
5dcf7654 Dmitry V. Levin 2019-01-07 171 * This function is a wrapper around arch-specific __syscall_set_arguments.
828c365c Roland McGrath 2008-07-25 172 */
ac0321df Dmitry V. Levin 2019-01-07 173 static void
5dcf7654 Dmitry V. Levin 2019-01-07 @174 __syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
828c365c Roland McGrath 2008-07-25 175 unsigned int i, unsigned int n,
828c365c Roland McGrath 2008-07-25 176 const unsigned long *args);
828c365c Roland McGrath 2008-07-25 177
:::::: The code at line 174 was first introduced by commit
:::::: 5dcf7654462a65216387a92e06b3ae1c268bd581 asm-generic/syscall.h: turn syscall_[gs]et_arguments into wrappers
:::::: TO: Dmitry V. Levin <ldv@...linux.org>
:::::: CC: 0day robot <lkp@...el.com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Download attachment ".config.gz" of type "application/gzip" (55458 bytes)
Powered by blists - more mailing lists