lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200209130927.19b43a5a4da8b93e60f88a64@kernel.org>
Date:   Sun, 9 Feb 2020 13:09:27 +0900
From:   Masami Hiramatsu <mhiramat@...nel.org>
To:     Michael Ellerman <mpe@...erman.id.au>
Cc:     Steven Rostedt <rostedt@...dmis.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Ingo Molnar <mingo@...nel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH] tools/bootconfig: Fix wrong __VA_ARGS__ usage

On Sat, 08 Feb 2020 22:10:40 +1100
Michael Ellerman <mpe@...erman.id.au> wrote:

> Masami Hiramatsu <mhiramat@...nel.org> writes:
> > Since printk() wrapper macro uses __VA_ARGS__ without
> > "##" prefix, it causes a build error if there is no
> > variable arguments (e.g. only fmt is specified.)
> > To fix this error, use ##__VA_ARGS__ instead of
> > __VAR_ARGS__.
> >
> > Fixes: 950313ebf79c ("tools: bootconfig: Add bootconfig command")
> > Reported-by: Michael Ellerman <mpe@...erman.id.au>
> > Signed-off-by: Masami Hiramatsu <mhiramat@...nel.org>
> > ---
> >  tools/bootconfig/include/linux/printk.h |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Thanks that builds for me.
> 
> The output when adding to a fresh initrd is a bit confusing though, eg:
> 
>   $ ./bootconfig -a samples/good-simple.bconf initrd.img
>   Apply samples/good-simple.bconf to initrd.img
>           Number of nodes: 13
>           Size: 120 bytes
>           Checksum: 9036
>   checksum error: 0 != 444373994
>   $ echo $?
>   0
> 
> ie. the checksum error.

Hmm...

> 
> That's because although delete_xbc() does:
> 
> 	pr_output = 0;
> 	size = load_xbc_from_initrd(fd, &buf);
> 
> in load_xbc_from_initrd() the error message is printed with printf, not
> printk, so it's not controlled by pr_output:
> 
> 	printf("checksum error: %d != %d\n", csum, rcsum);

Oh, I got it. If there is no bootconfig in initrd, it warns but
that is expected result. 

> 
> Switching that line to printk fixes it, ie. makes the checksum error go
> away, but it seems a bit odd to be using printk in userspace code.

What about pr_err() as perf does? :)
OK, I'll fix the error messages.

Thank you,


> 
> cheers


-- 
Masami Hiramatsu <mhiramat@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ