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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20110124170110.d204c0e9.akpm@linux-foundation.org>
Date:	Mon, 24 Jan 2011 17:01:10 -0800
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Mike Waychison <mikew@...gle.com>
Cc:	Greg KH <greg@...ah.com>, torvalds@...ux-foundation.org,
	San Mehat <san@...gle.com>, Aaron Durbin <adurbin@...gle.com>,
	Duncan Laurie <dlaurie@...gle.com>,
	linux-kernel@...r.kernel.org, Tim Hockin <thockin@...gle.com>
Subject: Re: [PATCH v1 5/6] Allow prepending to the dmesg

On Mon, 24 Jan 2011 16:25:00 -0800
Mike Waychison <mikew@...gle.com> wrote:

> The next patch in this series (Memory Console driver) would like to
> prepend firmware messages to the kernel logs.

I went to the changelog for "Memory Console driver" to work out why it
wants to do prepending, but it didn't tell me.

> Instead of exposing all the nitty gritty lock details of the kernel's
> printk system to the entire kernel, expose a "prepend_to_dmesg()" that
> attempts to rewrite the in-memory dmesg to inject pre-kernel messages.
> 
> This function only prepends if the start of the kernel's messages are
> still in the ring and there is still room for messages (without losing
> the current tail of the message log).  We determine this by checking out
> whether the bufer has yet been cleared (indicated by a new flag:
> buffer_has_cleared), and by checking whether the buffer is less than
> full (which would indicate that it had wrapped).
> 
> If there is enough room to prepend data, we simply shift the existing
> log contents down and copy into the buffer the tail of the prepended
> data that fits.
> 
> Signed-off-by: Mike Waychison <mikew@...gle.com>
> ---
>  include/linux/printk.h |    5 ++++
>  kernel/printk.c        |   55 +++++++++++++++++++++++++++++++++++++++++++++++-
>  2 files changed, 59 insertions(+), 1 deletions(-)
> 
> diff --git a/include/linux/printk.h b/include/linux/printk.h
> index ee048e7..df89965 100644
> --- a/include/linux/printk.h
> +++ b/include/linux/printk.h
> @@ -113,6 +113,7 @@ extern int dmesg_restrict;
>  extern int kptr_restrict;
>  
>  void log_buf_kexec_setup(void);
> +void prepend_to_dmesg(const char *buffer, size_t length);

Should have the __init tag in the declaration (can fix link problems on
weird architectures).

>  #else
>  static inline __attribute__ ((format (printf, 1, 0)))
>  int vprintk(const char *s, va_list args)
> @@ -137,6 +138,10 @@ static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies,
>  static inline void log_buf_kexec_setup(void)
>  {
>  }
> +
> +void prepend_to_dmesg(const char *buffer, size_t length)
> +{
> +}

Didn't this cause the linker to detect multiple definitions of
prepend_to_dmesg()?

Should be static inline void, or __init and not-inlined in a .c file.

>  #endif
>  
> ...
--
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