[PATCH 03/10] Scrub all entries in the keyring

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Clear all entries in the keyring

   Scan the keyring_name_hash hash table

   static struct list_head keyring_name_hash[KEYRING_NAME_HASH_SIZE];

   for (i = 0; i < KEYRING_NAME_HASH_SIZE; i++)
       if (!list_empty(&keyring_name_hash[i])) {
           ...
       }

   For each non-empty list walk all keyring entries

   struct key {
        ...
        struct key_type         *type;          /* type of key */
        ...
        unsigned short          datalen;        /* payload data length */
        ...
        union {
                struct list_head        link;
                ...
        } type_data;
        ...
        union {
                unsigned long           value;
                void __rcu              *rcudata;
                void                    *data;
                struct keyring_list __rcu *subscriptions;
        } payload;
   };

   struct key *key;
   list_for_each_entry(key, &keyring_name_hash[i], type_data.link) {
       ...
   }

   Clear value/rcudata/data dependent on the type of the key.

Signed-off-by: Aruna Balakrishnaiah <aruna at linux.vnet.ibm.com>
---
 eppic_scripts/keyring.c |   57 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 eppic_scripts/keyring.c

diff --git a/eppic_scripts/keyring.c b/eppic_scripts/keyring.c
new file mode 100644
index 0000000..22e7db8
--- /dev/null
+++ b/eppic_scripts/keyring.c
@@ -0,0 +1,57 @@
+string
+skey_opt()
+{
+	    return "l";
+}
+
+string
+skey_usage()
+{
+	    return "\n";
+}
+
+static void
+skey_showusage()
+{
+	    printf("usage : skey %s", skey_usage());
+}
+
+string
+skey_help()
+{
+	    return "Help";
+}
+
+int
+skey()
+{
+	int i;
+	struct list_head **tab;
+
+	tab = &keyring_name_hash;
+
+	for (i = 0; i < 32; i++)
+	{
+		struct list_head *next, *head;
+
+		head = (struct list_head *) (tab + i);
+		next = (struct list_head *) head->next;
+
+		if (!next)
+			continue;
+
+		while (next != head)
+		{
+			struct key *mykey, *off = 0;
+
+			mykey = (struct key *)((unsigned long)(next) - ((unsigned long)&(off->type_data)));
+
+			memset((char *)&(mykey->payload.value), 'A', 0x8);
+			memset((char *)mykey->payload.rcudata, 'A', 0x20);
+			memset((char *)mykey->payload.data, 'A', 0x20);
+
+			next = (struct list_head *) mykey->type_data.link.next;
+		}
+	}
+	return 1;
+}




[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux