From: Aruna Balakrishnaiah <aruna@linux.vnet.ibm.com>
To: kexec@lists.infradead.org
Cc: kumagai-atsushi@mxc.nes.nec.co.jp
Subject: [PATCH 06/10] Scrub data of udp socket buffers
Date: Thu, 27 Feb 2014 12:01:40 +0530 [thread overview]
Message-ID: <20140227063140.5924.25060.stgit@aruna-ThinkPad-T420> (raw)
In-Reply-To: <20140227063007.5924.5819.stgit@aruna-ThinkPad-T420>
Find all udp sockets (struct sock *sk)
udp sockets:
Iterate from 0 to udp_table->mask and get udp_hslot from hash table:
for (i = 0; i < udp->table->mask; i++) {
struct udp_hslot *hslot = udp_table->hash[i];
...
}
For each hslot iterate over hslot->head null list to get sockets:
struct sock *sk;
sk_nulls_for_each(sk, node, &hslot->head) {
...
}
For each socket iterate over the socket buffers in
sk_receive_queue and sk_write_queue:
struct sock {
...
struct sk_buff_head sk_receive_queue;
...
struct sk_buff_head sk_write_queue;
...
};
struct sk_buff_head {
struct sk_buff *next;
struct sk_buff *prev;
};
For each struct sk_buff in the two lists clear the memory referenced
by skb->data / skb->data_len:
struct sk_buff {
...
unsigned int data_len;
...
unsigned char *data;
...
};
Signed-off-by: Aruna Balakrishnaiah <aruna@linux.vnet.ibm.com>
---
eppic_scripts/udp_sk_buf.c | 79 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 79 insertions(+)
create mode 100644 eppic_scripts/udp_sk_buf.c
diff --git a/eppic_scripts/udp_sk_buf.c b/eppic_scripts/udp_sk_buf.c
new file mode 100644
index 0000000..7e64300
--- /dev/null
+++ b/eppic_scripts/udp_sk_buf.c
@@ -0,0 +1,79 @@
+string
+udp_opt()
+{
+ return "l";
+}
+
+string
+udp_usage()
+{
+ return "\n";
+}
+
+static void
+udp_showusage()
+{
+ printf("usage : udp %s", udp_usage());
+}
+
+string
+udp_help()
+{
+ return "Help";
+}
+
+int
+udp()
+{
+ int i;
+ int size;
+ struct udp_table *table;
+ struct sock_common *off = 0;
+
+ table = &udp_table;
+
+ for (i = 0; i < table->mask; i++) {
+ struct hlist_nulls_node *pos;
+
+ pos = table->hash[i].head.first;
+
+ while (!((unsigned long)pos & 1)) {
+ struct sock *sk;
+ struct sk_buff *next;
+ struct sk_buff_head *head;
+ struct hlist_nulls_node *node;
+
+ sk = (struct sock *)((unsigned long)pos - ((unsigned long)&(off->skc_dontcopy_begin)));
+
+ head = (struct sk_buff_head *)&(sk->sk_receive_queue);
+ next = (struct sk_buff *)sk->sk_receive_queue.next;
+
+ while (next != head)
+ {
+ struct sk_buff *buff = (struct sk_buff *)next;
+
+ memset((char *)buff->data, 'L', buff->data_len);
+ memset((char *)&(buff->data_len), 'L', 0x4);
+
+ next = buff->next;
+ }
+
+ head = (struct sk_buff_head *)&(sk->sk_write_queue);
+ next = (struct sk_buff *)sk->sk_write_queue.next;
+
+ while (next != head)
+ {
+ struct sk_buff *buff = (struct sk_buff *)next;
+
+ memset((char *)buff->data, 'L', buff->data_len);
+ memset((char *)&(buff->data_len), 'L', 0x4);
+
+ next = buff->next;
+ }
+
+ node = (struct hlist_nulls_node *)((unsigned long)sk + (unsigned long)&(off->skc_dontcopy_begin));
+ pos = node->next;
+ }
+ }
+ return 1;
+}
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2014-02-27 6:32 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-27 6:31 [PATCH 00/10] makedumpfile/eppic: Sample eppic scripts Aruna Balakrishnaiah
2014-02-27 6:31 ` [PATCH 01/10] Scrub executable name for each user process Aruna Balakrishnaiah
2014-02-27 6:31 ` [PATCH 02/10] Scrub filenames of cached dentries Aruna Balakrishnaiah
2014-02-27 6:31 ` [PATCH 03/10] Scrub all entries in the keyring Aruna Balakrishnaiah
2014-02-27 6:31 ` [PATCH 04/10] Clear the message data of all ap_bus requests Aruna Balakrishnaiah
2014-02-27 6:31 ` [PATCH 05/10] Scrub data in tcp socket buffers Aruna Balakrishnaiah
2014-02-27 6:31 ` Aruna Balakrishnaiah [this message]
2014-02-27 6:31 ` [PATCH 07/10] Scrub data of unix " Aruna Balakrishnaiah
2014-02-27 6:31 ` [PATCH 08/10] Scrub socket buffers of guest network I/O Aruna Balakrishnaiah
2014-02-27 6:31 ` [PATCH 09/10] Scrub buffers involved in guest block I/O Aruna Balakrishnaiah
2014-02-27 6:32 ` [PATCH 10/10] Install sample eppic scripts Aruna Balakrishnaiah
2014-03-05 4:54 ` Atsushi Kumagai
2014-03-05 4:54 ` [PATCH 00/10] makedumpfile/eppic: Sample " 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=20140227063140.5924.25060.stgit@aruna-ThinkPad-T420 \
--to=aruna@linux.vnet.ibm.com \
--cc=kexec@lists.infradead.org \
--cc=kumagai-atsushi@mxc.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