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:	Thu, 28 Jul 2016 00:08:29 +0900
From:	Namhyung Kim <namhyung@...nel.org>
To:	kvm@...r.kernel.org, qemu-devel@...gnu.org,
	virtualization@...ts.linux-foundation.org
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Paolo Bonzini <pbonzini@...hat.com>,
	Radim Krčmář <rkrcmar@...hat.com>,
	"Michael S. Tsirkin" <mst@...hat.com>,
	Anthony Liguori <aliguori@...zon.com>,
	Anton Vorontsov <anton@...msg.org>,
	Colin Cross <ccross@...roid.com>,
	Kees Cook <keescook@...omium.org>,
	Tony Luck <tony.luck@...el.com>,
	Steven Rostedt <rostedt@...dmis.org>,
	Ingo Molnar <mingo@...nel.org>,
	Minchan Kim <minchan@...nel.org>
Subject: [PATCH 5/7] virtio-pstore: Support PSTORE_TYPE_CONSOLE

With help of buffer management functions, it now supports CONSOLE type
pstore write.  The config space has flags field which defines the
VIRTIO_PSTORE_CONFIG_FL_CONSOLE.  When it's set, the virtio-pstore
driver also sets PSTORE_FLAGS_ASYNC so that the buffer management is
enabled.

Cc: Paolo Bonzini <pbonzini@...hat.com>
Cc: Radim Krčmář <rkrcmar@...hat.com>
Cc: "Michael S. Tsirkin" <mst@...hat.com>
Cc: Anthony Liguori <aliguori@...zon.com>
Cc: Anton Vorontsov <anton@...msg.org>
Cc: Colin Cross <ccross@...roid.com>
Cc: Kees Cook <keescook@...omium.org>
Cc: Tony Luck <tony.luck@...el.com>
Cc: Steven Rostedt <rostedt@...dmis.org>
Cc: Ingo Molnar <mingo@...nel.org>
Cc: Minchan Kim <minchan@...nel.org>
Cc: kvm@...r.kernel.org
Cc: qemu-devel@...gnu.org
Cc: virtualization@...ts.linux-foundation.org
Signed-off-by: Namhyung Kim <namhyung@...nel.org>
---
 drivers/virtio/virtio_pstore.c     | 9 ++++++++-
 include/uapi/linux/virtio_pstore.h | 4 ++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/virtio/virtio_pstore.c b/drivers/virtio/virtio_pstore.c
index 4ee1c186f582..458c4d3ccbb1 100644
--- a/drivers/virtio/virtio_pstore.c
+++ b/drivers/virtio/virtio_pstore.c
@@ -33,6 +33,7 @@ struct type_table {
 	u16 virtio;
 } type_table[] = {
 	TYPE_TABLE_ENTRY(DMESG),
+	TYPE_TABLE_ENTRY(CONSOLE),
 };
 
 #undef TYPE_TABLE_ENTRY
@@ -276,7 +277,8 @@ static int virt_pstore_init(struct virtio_pstore *vps)
 	psinfo->read  = virt_pstore_read;
 	psinfo->erase = virt_pstore_erase;
 	psinfo->write = virt_pstore_write;
-	psinfo->flags = PSTORE_FLAGS_DMESG;
+	/* preserve flags from config */
+	psinfo->flags |= PSTORE_FLAGS_DMESG;
 
 	psinfo->data  = vps;
 	spin_lock_init(&psinfo->buf_lock);
@@ -313,10 +315,15 @@ static int virtpstore_init_vqs(struct virtio_pstore *vps)
 static void virtpstore_init_config(struct virtio_pstore *vps)
 {
 	u32 bufsize;
+	u32 flags;
 
 	virtio_cread(vps->vdev, struct virtio_pstore_config, bufsize, &bufsize);
+	virtio_cread(vps->vdev, struct virtio_pstore_config, flags, &flags);
 
 	vps->pstore.bufsize = PAGE_ALIGN(bufsize);
+
+	if (flags & VIRTIO_PSTORE_CONFIG_FL_CONSOLE)
+		vps->pstore.flags |= PSTORE_FLAGS_CONSOLE | PSTORE_FLAGS_ASYNC;
 }
 
 static void virtpstore_confirm_config(struct virtio_pstore *vps)
diff --git a/include/uapi/linux/virtio_pstore.h b/include/uapi/linux/virtio_pstore.h
index f4b0d204d8ae..56d0b1554231 100644
--- a/include/uapi/linux/virtio_pstore.h
+++ b/include/uapi/linux/virtio_pstore.h
@@ -37,9 +37,12 @@
 
 #define VIRTIO_PSTORE_TYPE_UNKNOWN  0
 #define VIRTIO_PSTORE_TYPE_DMESG    1
+#define VIRTIO_PSTORE_TYPE_CONSOLE  2
 
 #define VIRTIO_PSTORE_FL_COMPRESSED  1
 
+#define VIRTIO_PSTORE_CONFIG_FL_CONSOLE  (1 << 0)
+
 struct virtio_pstore_req {
 	__virtio16		cmd;
 	__virtio16		type;
@@ -69,6 +72,7 @@ struct virtio_pstore_fileinfo {
 
 struct virtio_pstore_config {
 	__virtio32		bufsize;
+	__virtio32		flags;
 };
 
 #endif /* _LINUX_VIRTIO_PSTORE_H */
-- 
2.8.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ