From: Aravinda Prasad <aravinda@linux.vnet.ibm.com>
To: kexec@lists.infradead.org
Cc: ananth@in.ibm.com, mahesh@linux.vnet.ibm.com,
LChouinard@s2sys.com, tachibana@mxm.nes.nec.co.jp,
kumagai-atsushi@mxc.nes.nec.co.jp, buendgen@de.ibm.com
Subject: [PATCH 6/7] Extend eppic built-in functions to include memset function
Date: Wed, 06 Jun 2012 15:36:52 +0530 [thread overview]
Message-ID: <20120606100652.12534.58807.stgit@aravinda> (raw)
In-Reply-To: <20120606095709.12534.63967.stgit@aravinda>
The memset function will be used to specify the virtual address
and the length of the data to be scrubbed in the dump file from
the eppic macro. makedumpfile will convert these requests into
filter_info nodes which will be enqueued for filtering. Existing
makedumpfile functionality reads the filter_info nodes and scrubs the
data accordingly.
Signed-off-by: Aravinda Prasad <aravinda@linux.vnet.ibm.com>
---
erase_info.c | 32 +++++++++++++++++++++++++++++++-
erase_info.h | 1 +
extension_eppic.c | 19 +++++++++++++++++++
extension_eppic.h | 2 ++
4 files changed, 53 insertions(+), 1 deletions(-)
diff --git a/erase_info.c b/erase_info.c
index d301f20..79baecc 100644
--- a/erase_info.c
+++ b/erase_info.c
@@ -66,6 +66,8 @@ struct filter_info {
int erase_info_idx; /* 0= invalid index */
int size_idx;
+ int erase_ch;
+
struct filter_info *next;
unsigned short nullify;
};
@@ -1574,6 +1576,7 @@ update_filter_info(struct config_entry *filter_symbol,
fl_info->paddr = vaddr_to_paddr(sym_addr);
fl_info->size = size;
fl_info->nullify = filter_symbol->nullify;
+ fl_info->erase_ch = 'X';
if (insert_filter_info(fl_info)) {
fl_info->erase_info_idx = add_erase_info_node(filter_symbol);
@@ -1582,6 +1585,33 @@ update_filter_info(struct config_entry *filter_symbol,
return TRUE;
}
+int
+update_filter_info_raw(unsigned long long sym_addr, int ch, int len)
+{
+ struct filter_info *fl_info;
+
+ if ((fl_info = calloc(1, sizeof(struct filter_info))) == NULL) {
+ ERRMSG("Can't allocate filter info\n");
+ return FALSE;
+ }
+
+ fl_info->vaddr = sym_addr;
+ fl_info->paddr = vaddr_to_paddr(sym_addr);
+ fl_info->size = len;
+ fl_info->nullify = 0;
+ fl_info->erase_ch = ch;
+
+ if (insert_filter_info(fl_info)) {
+ /* TODO
+ * Add support to update erase information to the
+ * resulting dump file
+ */
+ fl_info->erase_info_idx = 0;
+ fl_info->size_idx = 0;
+ }
+ return TRUE;
+}
+
static int
initialize_iteration_entry(struct config_entry *ie,
char *type_name, unsigned char type_flag)
@@ -2004,7 +2034,7 @@ filter_data_buffer(unsigned char *buf, unsigned long long paddr,
if (fl_info.nullify)
memset(buf_ptr, 0, fl_info.size);
else
- memset(buf_ptr, 'X', fl_info.size);
+ memset(buf_ptr, fl_info.erase_ch, fl_info.size);
}
}
diff --git a/erase_info.h b/erase_info.h
index 2dc8b88..499d12c 100644
--- a/erase_info.h
+++ b/erase_info.h
@@ -40,6 +40,7 @@ int gather_filter_info(void);
void clear_filter_info(void);
void filter_data_buffer(unsigned char *buf, unsigned long long paddr, size_t size);
unsigned long get_size_eraseinfo(void);
+int update_filter_info_raw(unsigned long long, int, int);
#endif /* _ERASE_INFO_H */
diff --git a/extension_eppic.c b/extension_eppic.c
index 0f9e3c2..826f860 100644
--- a/extension_eppic.c
+++ b/extension_eppic.c
@@ -382,6 +382,22 @@ apiops icops = {
apifindsym
};
+/* Extensions to built-in functions */
+VALUE_S *
+eppic_memset(VALUE_S* vaddr, VALUE_S* vch, VALUE_S* vlen)
+{
+ ull addr = eppic_getval(vaddr);
+ int len = eppic_getval(vlen);
+ int ch = eppic_getval(vch);
+
+ /*
+ * Set the value at address from iaddr till iaddr + nbytes
+ * to the value specified in variable ch
+ */
+ update_filter_info_raw(addr, ch, len);
+ return eppic_makebtype(1);
+}
+
/* Initialize eppic */
int
@@ -395,6 +411,9 @@ eppic_init()
/* set the new function callback */
eppic_setcallback(reg_callback);
+ /* Extend built-in functions to include memset */
+ eppic_builtin("int memset(char*, int, int)", (bf_t*)eppic_memset);
+
return 0;
}
return 1;
diff --git a/extension_eppic.h b/extension_eppic.h
index 805015a..5827a8a 100644
--- a/extension_eppic.h
+++ b/extension_eppic.h
@@ -73,4 +73,6 @@ typedef TYPE_S {
ull rtype; /* type_t a reference refers too */
} type_t;
+extern int update_filter_info_raw(unsigned long long, int, int);
+
#endif /* _EXTENSION_EPPIC_H */
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2012-06-06 10:07 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-06 10:04 [PATCH 0/7] makedumpfile security key filtering with eppic Aravinda Prasad
2012-06-06 10:04 ` [PATCH 1/7] Initialize and setup eppic Aravinda Prasad
2012-06-06 10:05 ` [PATCH 2/7] makedumpfile and eppic interface layer Aravinda Prasad
2012-06-06 10:05 ` [PATCH 3/7] Eppic call back functions to query a dump image Aravinda Prasad
2012-06-06 10:06 ` [PATCH 4/7] Implement apigetctype call back function Aravinda Prasad
2012-10-29 8:06 ` Atsushi Kumagai
2012-06-06 10:06 ` [PATCH 5/7] Implement apimember and apigetrtype call back functions Aravinda Prasad
2012-06-06 10:06 ` Aravinda Prasad [this message]
2012-06-06 10:07 ` [PATCH 7/7] Support fully typed symbol access mode Aravinda Prasad
2012-06-11 8:44 ` [PATCH 0/7] makedumpfile security key filtering with eppic Atsushi Kumagai
2012-08-16 6:25 ` Aravinda Prasad
2012-08-17 4:16 ` Atsushi Kumagai
2012-10-12 5:29 ` Mahesh Jagannath Salgaonkar
2012-10-15 4:46 ` Atsushi Kumagai
2012-10-15 7:04 ` Aravinda Prasad
2012-10-29 8:06 ` Atsushi Kumagai
2012-10-29 10:15 ` Aravinda Prasad
2012-10-31 4:21 ` Atsushi Kumagai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120606100652.12534.58807.stgit@aravinda \
--to=aravinda@linux.vnet.ibm.com \
--cc=LChouinard@s2sys.com \
--cc=ananth@in.ibm.com \
--cc=buendgen@de.ibm.com \
--cc=kexec@lists.infradead.org \
--cc=kumagai-atsushi@mxc.nes.nec.co.jp \
--cc=mahesh@linux.vnet.ibm.com \
--cc=tachibana@mxm.nes.nec.co.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).