* kernel/trace/trace.c:3634:2: warning: function might be possible candidate for 'gnu_printf' format attribute
@ 2021-06-04 11:12 kernel test robot
2021-06-04 20:48 ` Steven Rostedt
0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2021-06-04 11:12 UTC (permalink / raw)
To: Steven Rostedt (VMware); +Cc: kbuild-all, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2658 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: f88cd3fb9df228e5ce4e13ec3dbad671ddb2146e
commit: 9a6944fee68e25084130386c608c5ac8db487581 tracing: Add a verifier to check string pointers for trace events
date: 3 months ago
config: x86_64-rhel (attached as .config)
compiler: gcc-6 (Ubuntu 6.4.0-17ubuntu1) 6.4.0 20180424
reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9a6944fee68e25084130386c608c5ac8db487581
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 9a6944fee68e25084130386c608c5ac8db487581
# save the attached .config to linux build tree
make W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
kernel/trace/trace.c: In function 'test_can_verify_check':
>> kernel/trace/trace.c:3634:2: warning: function might be possible candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
vsnprintf(buf, 16, "%d", ap);
^~~~~~~~~
kernel/trace/trace.c: In function 'trace_check_vprintf':
kernel/trace/trace.c:3717:3: warning: function might be possible candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
trace_seq_vprintf(&iter->seq, iter->fmt, ap);
^~~~~~~~~~~~~~~~~
kernel/trace/trace.c:3756:3: warning: function might be possible candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
trace_seq_vprintf(&iter->seq, p, ap);
^~~~~~~~~~~~~~~~~
vim +/gnu_printf +3634 kernel/trace/trace.c
3617
3618 static int test_can_verify_check(const char *fmt, ...)
3619 {
3620 char buf[16];
3621 va_list ap;
3622 int ret;
3623
3624 /*
3625 * The verifier is dependent on vsnprintf() modifies the va_list
3626 * passed to it, where it is sent as a reference. Some architectures
3627 * (like x86_32) passes it by value, which means that vsnprintf()
3628 * does not modify the va_list passed to it, and the verifier
3629 * would then need to be able to understand all the values that
3630 * vsnprintf can use. If it is passed by value, then the verifier
3631 * is disabled.
3632 */
3633 va_start(ap, fmt);
> 3634 vsnprintf(buf, 16, "%d", ap);
3635 ret = va_arg(ap, int);
3636 va_end(ap);
3637
3638 return ret;
3639 }
3640
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 46001 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: kernel/trace/trace.c:3634:2: warning: function might be possible candidate for 'gnu_printf' format attribute
2021-06-04 11:12 kernel/trace/trace.c:3634:2: warning: function might be possible candidate for 'gnu_printf' format attribute kernel test robot
@ 2021-06-04 20:48 ` Steven Rostedt
2021-06-07 5:49 ` [kbuild-all] " Rong Chen
0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2021-06-04 20:48 UTC (permalink / raw)
To: kernel test robot; +Cc: kbuild-all, linux-kernel
On Fri, 4 Jun 2021 19:12:03 +0800
kernel test robot <lkp@intel.com> wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: f88cd3fb9df228e5ce4e13ec3dbad671ddb2146e
> commit: 9a6944fee68e25084130386c608c5ac8db487581 tracing: Add a verifier to check string pointers for trace events
> date: 3 months ago
> config: x86_64-rhel (attached as .config)
> compiler: gcc-6 (Ubuntu 6.4.0-17ubuntu1) 6.4.0 20180424
> reproduce (this is a W=1 build):
> # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9a6944fee68e25084130386c608c5ac8db487581
> git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> git fetch --no-tags linus master
> git checkout 9a6944fee68e25084130386c608c5ac8db487581
> # save the attached .config to linux build tree
> make W=1 ARCH=x86_64
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
>
> All warnings (new ones prefixed by >>):
>
> kernel/trace/trace.c: In function 'test_can_verify_check':
> >> kernel/trace/trace.c:3634:2: warning: function might be possible candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
> vsnprintf(buf, 16, "%d", ap);
> ^~~~~~~~~
"test_can_verify_check" is not a generic function that needs a printf
format check. This is a bogus warning. Please remove it as being an issue.
-- Steve
> kernel/trace/trace.c: In function 'trace_check_vprintf':
> kernel/trace/trace.c:3717:3: warning: function might be possible candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
> trace_seq_vprintf(&iter->seq, iter->fmt, ap);
> ^~~~~~~~~~~~~~~~~
> kernel/trace/trace.c:3756:3: warning: function might be possible candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
> trace_seq_vprintf(&iter->seq, p, ap);
> ^~~~~~~~~~~~~~~~~
>
>
> vim +/gnu_printf +3634 kernel/trace/trace.c
>
> 3617
> 3618 static int test_can_verify_check(const char *fmt, ...)
> 3619 {
> 3620 char buf[16];
> 3621 va_list ap;
> 3622 int ret;
> 3623
> 3624 /*
> 3625 * The verifier is dependent on vsnprintf() modifies the va_list
> 3626 * passed to it, where it is sent as a reference. Some architectures
> 3627 * (like x86_32) passes it by value, which means that vsnprintf()
> 3628 * does not modify the va_list passed to it, and the verifier
> 3629 * would then need to be able to understand all the values that
> 3630 * vsnprintf can use. If it is passed by value, then the verifier
> 3631 * is disabled.
> 3632 */
> 3633 va_start(ap, fmt);
> > 3634 vsnprintf(buf, 16, "%d", ap);
> 3635 ret = va_arg(ap, int);
> 3636 va_end(ap);
> 3637
> 3638 return ret;
> 3639 }
> 3640
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [kbuild-all] Re: kernel/trace/trace.c:3634:2: warning: function might be possible candidate for 'gnu_printf' format attribute
2021-06-04 20:48 ` Steven Rostedt
@ 2021-06-07 5:49 ` Rong Chen
0 siblings, 0 replies; 3+ messages in thread
From: Rong Chen @ 2021-06-07 5:49 UTC (permalink / raw)
To: Steven Rostedt, kernel test robot; +Cc: kbuild-all, linux-kernel
On 6/5/21 4:48 AM, Steven Rostedt wrote:
> On Fri, 4 Jun 2021 19:12:03 +0800
> kernel test robot <lkp@intel.com> wrote:
>
>> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>> head: f88cd3fb9df228e5ce4e13ec3dbad671ddb2146e
>> commit: 9a6944fee68e25084130386c608c5ac8db487581 tracing: Add a verifier to check string pointers for trace events
>> date: 3 months ago
>> config: x86_64-rhel (attached as .config)
>> compiler: gcc-6 (Ubuntu 6.4.0-17ubuntu1) 6.4.0 20180424
>> reproduce (this is a W=1 build):
>> # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9a6944fee68e25084130386c608c5ac8db487581
>> git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>> git fetch --no-tags linus master
>> git checkout 9a6944fee68e25084130386c608c5ac8db487581
>> # save the attached .config to linux build tree
>> make W=1 ARCH=x86_64
>>
>> If you fix the issue, kindly add following tag as appropriate
>> Reported-by: kernel test robot <lkp@intel.com>
>>
>> All warnings (new ones prefixed by >>):
>>
>> kernel/trace/trace.c: In function 'test_can_verify_check':
>>>> kernel/trace/trace.c:3634:2: warning: function might be possible candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
>> vsnprintf(buf, 16, "%d", ap);
>> ^~~~~~~~~
> "test_can_verify_check" is not a generic function that needs a printf
> format check. This is a bogus warning. Please remove it as being an issue.
>
> -- Steve
>
Hi Steve,
Thanks for the feedback, we'll ignore the commit to avoid new reports
for this warning.
Best Regards,
Rong Chen
>
>> kernel/trace/trace.c: In function 'trace_check_vprintf':
>> kernel/trace/trace.c:3717:3: warning: function might be possible candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
>> trace_seq_vprintf(&iter->seq, iter->fmt, ap);
>> ^~~~~~~~~~~~~~~~~
>> kernel/trace/trace.c:3756:3: warning: function might be possible candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
>> trace_seq_vprintf(&iter->seq, p, ap);
>> ^~~~~~~~~~~~~~~~~
>>
>>
>> vim +/gnu_printf +3634 kernel/trace/trace.c
>>
>> 3617
>> 3618 static int test_can_verify_check(const char *fmt, ...)
>> 3619 {
>> 3620 char buf[16];
>> 3621 va_list ap;
>> 3622 int ret;
>> 3623
>> 3624 /*
>> 3625 * The verifier is dependent on vsnprintf() modifies the va_list
>> 3626 * passed to it, where it is sent as a reference. Some architectures
>> 3627 * (like x86_32) passes it by value, which means that vsnprintf()
>> 3628 * does not modify the va_list passed to it, and the verifier
>> 3629 * would then need to be able to understand all the values that
>> 3630 * vsnprintf can use. If it is passed by value, then the verifier
>> 3631 * is disabled.
>> 3632 */
>> 3633 va_start(ap, fmt);
>>> 3634 vsnprintf(buf, 16, "%d", ap);
>> 3635 ret = va_arg(ap, int);
>> 3636 va_end(ap);
>> 3637
>> 3638 return ret;
>> 3639 }
>> 3640
>>
>> ---
>> 0-DAY CI Kernel Test Service, Intel Corporation
>> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
> _______________________________________________
> kbuild-all mailing list -- kbuild-all@lists.01.org
> To unsubscribe send an email to kbuild-all-leave@lists.01.org
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-06-07 5:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-04 11:12 kernel/trace/trace.c:3634:2: warning: function might be possible candidate for 'gnu_printf' format attribute kernel test robot
2021-06-04 20:48 ` Steven Rostedt
2021-06-07 5:49 ` [kbuild-all] " Rong Chen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).