From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============0475424214808005174==" MIME-Version: 1.0 From: Tom Zanussi To: kbuild-all@lists.01.org Subject: 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 Date: Mon, 13 Jan 2020 14:11:07 -0600 Message-ID: <1578946267.31031.8.camel@kernel.org> In-Reply-To: List-Id: --===============0475424214808005174== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 > wrote: > > = > > CC: kbuild-all(a)lists.01.org > > TO: Tom Zanussi > > = > > 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=3Dx86_64 > > = > > If you fix the issue, kindly add following tag > > Reported-by: kbuild test robot > > = > > 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 !=3D 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 =3D buf; > > 964 ret =3D add_dynevent_arg(cmd, &arg); > > 965 if (ret) > > 966 return ret; > > 967 > > 968 dynevent_arg_init(&arg, NULL, 0); > > 969 arg.str =3D loc; > > 970 ret =3D 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 =3D va_arg(args, const char *); > > 979 if (!field) > > 980 break; > > 981 > > 982 if (++cmd->n_fields > MAX_TRACE_ARGS) { > > 983 ret =3D -EINVAL; > > 984 break; > > 985 } > > 986 > > 987 dynevent_arg_init(&arg, NULL, 0); > > 988 arg.str =3D field; > > 989 ret =3D 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 > = > = >=20 --===============0475424214808005174==--