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>] [day] [month] [year] [list]
Date:	Mon, 6 Aug 2012 22:05:02 -0700
From:	Anton Vorontsov <cbouatmailru@...il.com>
To:	Linus Torvalds <torvalds@...ux-foundation.org>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Stephen Rothwell <sfr@...b.auug.org.au>,
	linux-kernel@...r.kernel.org,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Randy Dunlap <rdunlap@...otime.net>,
	Tony Luck <tony.luck@...el.com>,
	Colin Cross <ccross@...roid.com>,
	Kees Cook <keescook@...omium.org>
Subject: [GIT PULL] linux-pstore.git

Hello Linus,

This pull request includes a few fixes for pstore that I posted some time
ago, plus Randy's printk format fix. Also, now pstore has a dedicated git
tree, and a few people (including me) ready to review any further changes
to the code, the fact is now reflected in the maintainers file.

Since the fixes are pretty small, for convenience I include all of them
in the end of this email.

Thanks!


The following changes since commit 0d7614f09c1ebdbaa1599a5aba7593f147bf96ee:

  Linux 3.6-rc1 (2012-08-02 16:38:10 -0700)

are available in the git repository at:

  git://git.infradead.org/users/cbou/linux-pstore.git tags/v3.6-rc1-fixes

for you to fetch changes up to 8defe59969cb8d863fe46867809316350ec0fc8f:

  MAINTAINERS: Add pstore maintainers (2012-08-06 21:16:19 -0700)

----------------------------------------------------------------
Just a few fixes for v3.6-rc1, plus added maintainers for pstore.

----------------------------------------------------------------
Anton Vorontsov (3):
      pstore/ram: Fix possible NULL dereference
      pstore/ram: Mark ramoops_pstore_write_buf() as notrace
      MAINTAINERS: Add pstore maintainers

Randy Dunlap (1):
      pstore/ram: Fix printk format warning

 MAINTAINERS     |   12 ++++++++++++
 fs/pstore/ram.c |   27 ++++++++++++++-------------
 2 files changed, 26 insertions(+), 13 deletions(-)


commit 8defe59969cb8d863fe46867809316350ec0fc8f
Author: Anton Vorontsov <anton.vorontsov@...aro.org>
Date:   Fri Aug 3 18:07:20 2012 -0700

    MAINTAINERS: Add pstore maintainers
    
    Signed-off-by: Anton Vorontsov <anton.vorontsov@...aro.org>
    Acked-by: Tony Luck <tony.luck@...el.com>
    Acked-by: Kees Cook <keescook@...omium.org>

diff --git a/MAINTAINERS b/MAINTAINERS
index 94b823f..9aa40c1 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5496,6 +5496,18 @@ L:	cbe-oss-dev@...ts.ozlabs.org
 S:	Maintained
 F:	drivers/block/ps3vram.c
 
+PSTORE FILESYSTEM
+M:	Anton Vorontsov <cbouatmailru@...il.com>
+M:	Colin Cross <ccross@...roid.com>
+M:	Kees Cook <keescook@...omium.org>
+M:	Tony Luck <tony.luck@...el.com>
+S:	Maintained
+T:	git git://git.infradead.org/users/cbou/linux-pstore.git
+F:	fs/pstore/
+F:	include/linux/pstore*
+F:	drivers/firmware/efivars.c
+F:	drivers/acpi/apei/erst.c
+
 PTP HARDWARE CLOCK SUPPORT
 M:	Richard Cochran <richardcochran@...il.com>
 S:	Maintained

commit 242030365eacb649161023a3a024373198c34d59
Author: Anton Vorontsov <anton.vorontsov@...aro.org>
Date:   Tue Jul 17 19:49:37 2012 -0700

    pstore/ram: Mark ramoops_pstore_write_buf() as notrace
    
    write_buf() should be marked as notrace, otherwise it is prone to
    recursion.
    
    Though, yet the issue is never triggered in real life, because we run
    inside the function tracer, where ftrace does its own recurse protection.
    
    But it's still no good, plus soon we might switch to our own tracer ops,
    and then the issue will be fatal. So, let's fix it.
    
    Signed-off-by: Anton Vorontsov <anton.vorontsov@...aro.org>

diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index fba8c72..9101604 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -32,6 +32,7 @@
 #include <linux/ioport.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
+#include <linux/compiler.h>
 #include <linux/pstore_ram.h>
 
 #define RAMOOPS_KERNMSG_HDR "===="
@@ -181,12 +182,11 @@ static size_t ramoops_write_kmsg_hdr(struct persistent_ram_zone *prz)
 	return len;
 }
 
-
-static int ramoops_pstore_write_buf(enum pstore_type_id type,
-				    enum kmsg_dump_reason reason,
-				    u64 *id, unsigned int part,
-				    const char *buf, size_t size,
-				    struct pstore_info *psi)
+static int notrace ramoops_pstore_write_buf(enum pstore_type_id type,
+					    enum kmsg_dump_reason reason,
+					    u64 *id, unsigned int part,
+					    const char *buf, size_t size,
+					    struct pstore_info *psi)
 {
 	struct ramoops_context *cxt = psi->data;
 	struct persistent_ram_zone *prz = cxt->przs[cxt->dump_write_cnt];

commit 0427193b691edc81c846c7d0ebd2561cae8709d8
Author: Randy Dunlap <rdunlap@...otime.net>
Date:   Fri Aug 3 17:02:48 2012 -0700

    pstore/ram: Fix printk format warning
    
    Fix printk format warning (on i386) in pstore:
    
    fs/pstore/ram.c:409:3: warning: format '%lu' expects type 'long unsigned int', but argument 2 has type 'size_t'
    
    Signed-off-by: Randy Dunlap <rdunlap@...otime.net>
    Acked-by: Kees Cook <keescook@...omium.org>
    Signed-off-by: Anton Vorontsov <anton.vorontsov@...aro.org>

diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index bcd1bbd..fba8c72 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -406,7 +406,7 @@ static int __devinit ramoops_probe(struct platform_device *pdev)
 		goto fail_init_fprz;
 
 	if (!cxt->przs && !cxt->cprz && !cxt->fprz) {
-		pr_err("memory size too small, minimum is %lu\n",
+		pr_err("memory size too small, minimum is %zu\n",
 			cxt->console_size + cxt->record_size +
 			cxt->ftrace_size);
 		goto fail_cnt;

commit a384f6411734e763daa4bae30e8ff170d7d4c3e2
Author: Anton Vorontsov <anton.vorontsov@...aro.org>
Date:   Thu Jul 19 15:47:11 2012 -0700

    pstore/ram: Fix possible NULL dereference
    
    We can dereference 'cxt->cprz' if console and dump logging are disabled
    (which is unlikely, but still possible to do). This patch fixes the issue
    by changing the code so that we don't dereference przs at all, we can
    just calculate bufsize from console_size and record_size values.
    
    Plus, while at it, the patch improves the buffer size calculation.
    
    After Kay's printk rework, we know the optimal buffer size for console
    logging -- it is LOG_LINE_MAX (defined privately in printk.c). Previously,
    if only console logging was enabled, we would allocate unnecessary large
    buffer in pstore, while we only need LOG_LINE_MAX. (Pstore console logging
    is still capable of handling buffers > LOG_LINE_MAX, it will just do
    multiple calls to psinfo->write).
    
    Note that I don't export the constant, since we will do even a better
    thing soon: we will switch console logging to a new write_buf API, which
    will eliminate the need for the additional buffer; and so we won't need
    the constant.
    
    Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
    Signed-off-by: Anton Vorontsov <anton.vorontsov@...aro.org>
    Acked-by: Kees Cook <keescook@...omium.org>

diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 0b311bc..bcd1bbd 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -414,13 +414,14 @@ static int __devinit ramoops_probe(struct platform_device *pdev)
 
 	cxt->pstore.data = cxt;
 	/*
-	 * Console can handle any buffer size, so prefer dumps buffer
-	 * size since usually it is smaller.
+	 * Console can handle any buffer size, so prefer LOG_LINE_MAX. If we
+	 * have to handle dumps, we must have at least record_size buffer. And
+	 * for ftrace, bufsize is irrelevant (if bufsize is 0, buf will be
+	 * ZERO_SIZE_PTR).
 	 */
-	if (cxt->przs)
-		cxt->pstore.bufsize = cxt->przs[0]->buffer_size;
-	else
-		cxt->pstore.bufsize = cxt->cprz->buffer_size;
+	if (cxt->console_size)
+		cxt->pstore.bufsize = 1024; /* LOG_LINE_MAX */
+	cxt->pstore.bufsize = max(cxt->record_size, cxt->pstore.bufsize);
 	cxt->pstore.buf = kmalloc(cxt->pstore.bufsize, GFP_KERNEL);
 	spin_lock_init(&cxt->pstore.buf_lock);
 	if (!cxt->pstore.buf) {


-- 
Anton Vorontsov
Email: cbouatmailru@...il.com
--
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