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]
Date:	Mon, 16 Jul 2012 22:07:33 -0700
From:	Joe Perches <joe@...ches.com>
To:	Steven Rostedt <rostedt@...dmis.org>
Cc:	Jovi Zhang <bookjovi@...il.com>,
	Frédéric Weisbecker <fweisbec@...il.com>,
	Ingo Molnar <mingo@...hat.com>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] ftrace: using pr_fmt for better printk output

On Tue, 2012-07-17 at 00:25 -0400, Steven Rostedt wrote:
> On Mon, 2012-07-16 at 20:42 -0700, Joe Perches wrote:
> 
> > > diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> > []
> > > @@ -13,6 +13,8 @@
> > >   *  Copyright (C) 2004 William Lee Irwin III
> > >   */
> > > 
> > > +#define pr_fmt(fmt) "ftrace: " fmt
> > 
> > #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> 
> Wouldn't a nicer patch be to move this into a header file and then
> remove all the defines throughout the kernel tree?

Maybe.  There are modules that use common header files
like you suggest.  It does mean that header must be the
#included before any other #include that might
#include <linux/kernel.h> or printk.h.

Right now, if pr_fmt isn't #defined, printk.h
has a default definition of:

#ifndef pr_fmt
#define pr_fmt(fmt) fmt
#endif

My goal is to change that to:

#ifndef pr_fmt
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#endif

in 3.8 (maybe 3.7) and remove all of these then
useless, duplicate #defines shortly afterward.

https://lkml.org/lkml/2012/3/27/247

> Also, what is KBUILD_MODNAME defined as for non-modules? As ftrace is
> not a module.

It depends on the Makefile.

scripts/Makefile.lib:# $(modname_flags) #defines KBUILD_MODNAME as the name of the module it will 
scripts/Makefile.lib-# end up in (or would, if it gets compiled in)
scripts/Makefile.lib-# Note: Files that end up in two or more modules are compiled without the
scripts/Makefile.lib:#       KBUILD_MODNAME definition. The reason is that any made-up name would
scripts/Makefile.lib-#       differ in different configs.
scripts/Makefile.lib-name-fix = $(subst $(comma),_,$(subst -,_,$1))
scripts/Makefile.lib-basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))"
scripts/Makefile.lib-modname_flags  = $(if $(filter 1,$(words $(modname))),\
scripts/Makefile.lib:                 -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))")


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ