* Re: [zanussi-trace:ftrace/synth-event-gen-v2 10/12] kernel/trace/trace_kprobe.c:974:17: warning: passing an object that undergoes default argument promotion to 'va_start' has undefined behavior [not found] <202001112058.4xALCb72%lkp@intel.com> @ 2020-01-13 17:20 ` Nick Desaulniers 2020-01-13 20:11 ` Tom Zanussi 0 siblings, 1 reply; 3+ messages in thread From: Nick Desaulniers @ 2020-01-13 17:20 UTC (permalink / raw) To: kbuild-all [-- Attachment #1: Type: text/plain, Size: 5091 bytes --] Hi Tom, Below is a report from a 0day bot build w/ Clang, can you please take a look? (Apologies if this has been previously reported). In the past, -Wvarargs warnings are usually related to the last parameter of a va_arg function undergoing implicit promotion (which is explicitly UB, IIRC). On Sat, Jan 11, 2020 at 4:35 AM kbuild test robot <lkp@intel.com> wrote: > > CC: kbuild-all(a)lists.01.org > TO: Tom Zanussi <zanussi@kernel.org> > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/zanussi/linux-trace.git ftrace/synth-event-gen-v2 > head: 91ee64186d5894724e276c4e7fad70446d7a02a7 > commit: 5f052546541d6cc5ad00e28aca6376c221db5c7e [10/12] tracing: Add kprobe event command generation functions > config: x86_64-defconfig (attached as .config) > compiler: clang version 10.0.0 (git://gitmirror/llvm_project 016bf03ef6fcd9dce43b0c17971f76323f07a684) > reproduce: > git checkout 5f052546541d6cc5ad00e28aca6376c221db5c7e > # save the attached .config to linux build tree > make ARCH=x86_64 > > If you fix the issue, kindly add following tag > Reported-by: kbuild test robot <lkp@intel.com> > > All warnings (new ones prefixed by >>): > > >> kernel/trace/trace_kprobe.c:974:17: warning: passing an object that undergoes default argument promotion to 'va_start' has undefined behavior [-Wvarargs] > va_start(args, kretprobe); > ^ > kernel/trace/trace_kprobe.c:947:30: note: parameter of type 'bool' (aka '_Bool') is declared here > const char *loc, bool kretprobe, ...) > ^ > 1 warning generated. > > vim +/va_start +974 kernel/trace/trace_kprobe.c > > 925 > 926 /** > 927 * __gen_kprobe_cmd - Generate a synthetic event command from arg list > 928 * @cmd: A pointer to the dynevent_cmd struct representing the new event > 929 * @name: The name of the kprobe event > 930 * @loc: The location of the kprobe event > 931 * @kretprobe: Is this a return probe? > 932 * @args: Variable number of arg (pairs), one pair for each field > 933 * > 934 * NOTE: Users normally won't want to call this function directly, but > 935 * rather use the gen_kprobe_cmd() wrapper, which automatically adds a > 936 * NULL to the end of the arg list. If this function is used > 937 * directly, make suer he last arg in the variable arg list is NULL. > 938 * > 939 * Generate a kprobe event command to be executed by > 940 * create_dynevent(). This function can be used to generate the > 941 * complete command or only the first part of it; in the latter case, > 942 * add_probe_fields() can be used to add more fields following this. > 943 * > 944 * Return: 0 if successful, error otherwise. > 945 */ > 946 int __gen_kprobe_cmd(struct dynevent_cmd *cmd, const char *name, > 947 const char *loc, bool kretprobe, ...) > 948 { > 949 char buf[MAX_EVENT_NAME_LEN]; > 950 struct dynevent_arg arg; > 951 va_list args; > 952 int ret; > 953 > 954 if (cmd->type != DYNEVENT_TYPE_KPROBE) > 955 return -EINVAL; > 956 > 957 if (kretprobe) > 958 snprintf(buf, MAX_EVENT_NAME_LEN, "r:%s", name); > 959 else > 960 snprintf(buf, MAX_EVENT_NAME_LEN, "p:%s", name); > 961 > 962 dynevent_arg_init(&arg, NULL, 0); > 963 arg.str = buf; > 964 ret = add_dynevent_arg(cmd, &arg); > 965 if (ret) > 966 return ret; > 967 > 968 dynevent_arg_init(&arg, NULL, 0); > 969 arg.str = loc; > 970 ret = add_dynevent_arg(cmd, &arg); > 971 if (ret) > 972 return ret; > 973 > > 974 va_start(args, kretprobe); > 975 for (;;) { > 976 const char *field; > 977 > 978 field = va_arg(args, const char *); > 979 if (!field) > 980 break; > 981 > 982 if (++cmd->n_fields > MAX_TRACE_ARGS) { > 983 ret = -EINVAL; > 984 break; > 985 } > 986 > 987 dynevent_arg_init(&arg, NULL, 0); > 988 arg.str = field; > 989 ret = add_dynevent_arg(cmd, &arg); > 990 if (ret) > 991 break; > 992 } > 993 va_end(args); > 994 > 995 return ret; > 996 } > 997 EXPORT_SYMBOL_GPL(__gen_kprobe_cmd); > 998 > > --- > 0-DAY kernel test infrastructure Open Source Technology Center > https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation -- Thanks, ~Nick Desaulniers ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [zanussi-trace:ftrace/synth-event-gen-v2 10/12] kernel/trace/trace_kprobe.c:974:17: warning: passing an object that undergoes default argument promotion to 'va_start' has undefined behavior 2020-01-13 17:20 ` [zanussi-trace:ftrace/synth-event-gen-v2 10/12] kernel/trace/trace_kprobe.c:974:17: warning: passing an object that undergoes default argument promotion to 'va_start' has undefined behavior Nick Desaulniers @ 2020-01-13 20:11 ` Tom Zanussi 2020-01-13 20:42 ` Nick Desaulniers 0 siblings, 1 reply; 3+ messages in thread From: Tom Zanussi @ 2020-01-13 20:11 UTC (permalink / raw) To: kbuild-all [-- Attachment #1: Type: text/plain, Size: 5594 bytes --] Hi Nick, On Mon, 2020-01-13 at 09:20 -0800, Nick Desaulniers wrote: > Hi Tom, > Below is a report from a 0day bot build w/ Clang, can you please take > a look? (Apologies if this has been previously reported). In the > past, -Wvarargs warnings are usually related to the last parameter of > a va_arg function undergoing implicit promotion (which is explicitly > UB, IIRC). > OK, looks like just changing the param order should fix it, thanks for the report. Tom > On Sat, Jan 11, 2020 at 4:35 AM kbuild test robot <lkp@intel.com> > wrote: > > > > CC: kbuild-all(a)lists.01.org > > TO: Tom Zanussi <zanussi@kernel.org> > > > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/zanussi/lin > > ux-trace.git ftrace/synth-event-gen-v2 > > head: 91ee64186d5894724e276c4e7fad70446d7a02a7 > > commit: 5f052546541d6cc5ad00e28aca6376c221db5c7e [10/12] tracing: > > Add kprobe event command generation functions > > config: x86_64-defconfig (attached as .config) > > compiler: clang version 10.0.0 (git://gitmirror/llvm_project > > 016bf03ef6fcd9dce43b0c17971f76323f07a684) > > reproduce: > > git checkout 5f052546541d6cc5ad00e28aca6376c221db5c7e > > # save the attached .config to linux build tree > > make ARCH=x86_64 > > > > If you fix the issue, kindly add following tag > > Reported-by: kbuild test robot <lkp@intel.com> > > > > All warnings (new ones prefixed by >>): > > > > > > kernel/trace/trace_kprobe.c:974:17: warning: passing an object > > > > that undergoes default argument promotion to 'va_start' has > > > > undefined behavior [-Wvarargs] > > > > va_start(args, kretprobe); > > ^ > > kernel/trace/trace_kprobe.c:947:30: note: parameter of type > > 'bool' (aka '_Bool') is declared here > > const char *loc, bool kretprobe, ...) > > ^ > > 1 warning generated. > > > > vim +/va_start +974 kernel/trace/trace_kprobe.c > > > > 925 > > 926 /** > > 927 * __gen_kprobe_cmd - Generate a synthetic event command > > from arg list > > 928 * @cmd: A pointer to the dynevent_cmd struct representing > > the new event > > 929 * @name: The name of the kprobe event > > 930 * @loc: The location of the kprobe event > > 931 * @kretprobe: Is this a return probe? > > 932 * @args: Variable number of arg (pairs), one pair for each > > field > > 933 * > > 934 * NOTE: Users normally won't want to call this function > > directly, but > > 935 * rather use the gen_kprobe_cmd() wrapper, which > > automatically adds a > > 936 * NULL to the end of the arg list. If this function is > > used > > 937 * directly, make suer he last arg in the variable arg list > > is NULL. > > 938 * > > 939 * Generate a kprobe event command to be executed by > > 940 * create_dynevent(). This function can be used to > > generate the > > 941 * complete command or only the first part of it; in the > > latter case, > > 942 * add_probe_fields() can be used to add more fields > > following this. > > 943 * > > 944 * Return: 0 if successful, error otherwise. > > 945 */ > > 946 int __gen_kprobe_cmd(struct dynevent_cmd *cmd, const char > > *name, > > 947 const char *loc, bool kretprobe, ...) > > 948 { > > 949 char buf[MAX_EVENT_NAME_LEN]; > > 950 struct dynevent_arg arg; > > 951 va_list args; > > 952 int ret; > > 953 > > 954 if (cmd->type != DYNEVENT_TYPE_KPROBE) > > 955 return -EINVAL; > > 956 > > 957 if (kretprobe) > > 958 snprintf(buf, MAX_EVENT_NAME_LEN, "r:%s", > > name); > > 959 else > > 960 snprintf(buf, MAX_EVENT_NAME_LEN, "p:%s", > > name); > > 961 > > 962 dynevent_arg_init(&arg, NULL, 0); > > 963 arg.str = buf; > > 964 ret = add_dynevent_arg(cmd, &arg); > > 965 if (ret) > > 966 return ret; > > 967 > > 968 dynevent_arg_init(&arg, NULL, 0); > > 969 arg.str = loc; > > 970 ret = add_dynevent_arg(cmd, &arg); > > 971 if (ret) > > 972 return ret; > > 973 > > > 974 va_start(args, kretprobe); > > 975 for (;;) { > > 976 const char *field; > > 977 > > 978 field = va_arg(args, const char *); > > 979 if (!field) > > 980 break; > > 981 > > 982 if (++cmd->n_fields > MAX_TRACE_ARGS) { > > 983 ret = -EINVAL; > > 984 break; > > 985 } > > 986 > > 987 dynevent_arg_init(&arg, NULL, 0); > > 988 arg.str = field; > > 989 ret = add_dynevent_arg(cmd, &arg); > > 990 if (ret) > > 991 break; > > 992 } > > 993 va_end(args); > > 994 > > 995 return ret; > > 996 } > > 997 EXPORT_SYMBOL_GPL(__gen_kprobe_cmd); > > 998 > > > > --- > > 0-DAY kernel test infrastructure Open Source > > Technology Center > > https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel > > Corporation > > > ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [zanussi-trace:ftrace/synth-event-gen-v2 10/12] kernel/trace/trace_kprobe.c:974:17: warning: passing an object that undergoes default argument promotion to 'va_start' has undefined behavior 2020-01-13 20:11 ` Tom Zanussi @ 2020-01-13 20:42 ` Nick Desaulniers 0 siblings, 0 replies; 3+ messages in thread From: Nick Desaulniers @ 2020-01-13 20:42 UTC (permalink / raw) To: kbuild-all [-- Attachment #1: Type: text/plain, Size: 677 bytes --] On Mon, Jan 13, 2020 at 12:11 PM Tom Zanussi <zanussi@kernel.org> wrote: > > Hi Nick, > > On Mon, 2020-01-13 at 09:20 -0800, Nick Desaulniers wrote: > > Hi Tom, > > Below is a report from a 0day bot build w/ Clang, can you please take > > a look? (Apologies if this has been previously reported). In the > > past, -Wvarargs warnings are usually related to the last parameter of > > a va_arg function undergoing implicit promotion (which is explicitly > > UB, IIRC). > > > > OK, looks like just changing the param order should fix it, thanks for > the report. Yep, IIRC, that was the fix in the past for previous occurrences. -- Thanks, ~Nick Desaulniers ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-01-13 20:42 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <202001112058.4xALCb72%lkp@intel.com> 2020-01-13 17:20 ` [zanussi-trace:ftrace/synth-event-gen-v2 10/12] kernel/trace/trace_kprobe.c:974:17: warning: passing an object that undergoes default argument promotion to 'va_start' has undefined behavior Nick Desaulniers 2020-01-13 20:11 ` Tom Zanussi 2020-01-13 20:42 ` Nick Desaulniers
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.