Home Home > GIT Browse > SLE15-SP1-AZURE
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2010-02-12 11:10:51 -0500
committerJeff Mahoney <jeffm@suse.com>2010-02-12 11:10:51 -0500
commit639cb8edb27127dc196a65d9d3b77cf5784165c3 (patch)
treee5a241afa0378f8eaa5c717d2fe29ef5f9e1fc20
parent084c0f77990f74ac269f8960e325ae3b724a94c7 (diff)
- patches.fixes/taskstats-alignment: delayacct: align to 8 byte
boundary on 64-bit systems (bnc#578065).
-rw-r--r--kernel-source.changes6
-rw-r--r--patches.fixes/taskstats-alignment96
2 files changed, 59 insertions, 43 deletions
diff --git a/kernel-source.changes b/kernel-source.changes
index a75ffd28ab..16b1b17378 100644
--- a/kernel-source.changes
+++ b/kernel-source.changes
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Fri Feb 12 17:10:47 CET 2010 - jeffm@suse.com
+
+- patches.fixes/taskstats-alignment: delayacct: align to 8 byte
+ boundary on 64-bit systems (bnc#578065).
+
+-------------------------------------------------------------------
Fri Feb 12 16:57:20 CET 2010 - trenn@suse.de
- patches.fixes/acpi_fix_no_critical_tp.patch: ACPI thermal:
diff --git a/patches.fixes/taskstats-alignment b/patches.fixes/taskstats-alignment
index b8a4f6821e..47dac2165b 100644
--- a/patches.fixes/taskstats-alignment
+++ b/patches.fixes/taskstats-alignment
@@ -1,52 +1,62 @@
-From: Raymund Will <rw@suse.de>
-Subject: ia64: fill 'struct taskstats' on stack and 'memcpy' result to skb.
-References: bnc#448410
+From: Jeff Mahoney <jeffm@suse.com>
+Subject: [PATCH] delayacct: align to 8 byte boundary on 64-bit systems
+References: bnc#578065
+Patch-mainline: Hopefully 2.6.34, submitting when the window opens
+ prepare_reply sets up an skb for the response. If I understand it correctly,
+ the payload contains:
-Signed-off-by: Raymund Will <rw@suse.de>
+ +--------------------------------+
+ | genlmsghdr - 4 bytes |
+ +--------------------------------+
+ | NLA header - 4 bytes | /* Aggregate header */
+ +-+------------------------------+
+ | | NLA header - 4 bytes | /* PID header */
+ | +------------------------------+
+ | | pid/tgid - 4 bytes |
+ | +------------------------------+
+ | | NLA header - 4 bytes | /* stats header */
+ | + -----------------------------+ <- oops. aligned on 4 byte boundary
+ | | struct taskstats - 328 bytes |
+ +-+------------------------------+
+ The start of the taskstats struct must be 8 byte aligned on IA64 (and other
+ systems with 8 byte alignment rules for 64-bit types) or runtime alignment
+ warnings will be issued.
+
+ This patch pads the pid/tgid field out to sizeof(long), which forces
+ the alignment of taskstats. The getdelays userspace code is ok with this
+ since it assumes 32-bit pid/tgid and then honors that header's length field.
+
+ An array is used to avoid exposing kernel memory contents to userspace in the
+ response.
+
+Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
- kernel/taskstats.c | 13 +++++++++++--
- 1 file changed, 11 insertions(+), 2 deletions(-)
+ kernel/taskstats.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
--- a/kernel/taskstats.c
+++ b/kernel/taskstats.c
-@@ -432,6 +432,12 @@ static int taskstats_user_cmd(struct sk_
- struct taskstats *stats;
- size_t size;
- cpumask_var_t mask;
-+#ifdef CONFIG_IA64
-+ struct taskstats statn;
-+#define statf &statn
-+#else
-+#define statf stats
-+#endif
-
- if (!alloc_cpumask_var(&mask, GFP_KERNEL))
- return -ENOMEM;
-@@ -472,7 +478,7 @@ free_return_rc:
- if (!stats)
- goto err;
+@@ -362,6 +362,12 @@ static struct taskstats *mk_reply(struct
+ struct nlattr *na, *ret;
+ int aggr;
-- rc = fill_pid(pid, NULL, stats);
-+ rc = fill_pid(pid, NULL, statf);
- if (rc < 0)
- goto err;
- } else if (info->attrs[TASKSTATS_CMD_ATTR_TGID]) {
-@@ -481,12 +487,15 @@ free_return_rc:
- if (!stats)
- goto err;
-
-- rc = fill_tgid(tgid, NULL, stats);
-+ rc = fill_tgid(tgid, NULL, statf);
- if (rc < 0)
- goto err;
- } else
++ /* If we don't pad, we end up with alignment on a 4 byte boundary.
++ * This causes lots of runtime warnings on systems requiring 8 byte
++ * alignment */
++ u32 pids[2] = { pid, 0 };
++ int pid_size = ALIGN(sizeof(pid), sizeof(long));
++
+ aggr = (type == TASKSTATS_TYPE_PID)
+ ? TASKSTATS_TYPE_AGGR_PID
+ : TASKSTATS_TYPE_AGGR_TGID;
+@@ -369,7 +375,7 @@ static struct taskstats *mk_reply(struct
+ na = nla_nest_start(skb, aggr);
+ if (!na)
goto err;
-
-+#ifdef CONFIG_IA64
-+ memcpy(stats, &statn, sizeof(statn));
-+#endif
- return send_reply(rep_skb, info);
- err:
- nlmsg_free(rep_skb);
+- if (nla_put(skb, type, sizeof(pid), &pid) < 0)
++ if (nla_put(skb, type, pid_size, pids) < 0)
+ goto err;
+ ret = nla_reserve(skb, TASKSTATS_TYPE_STATS, sizeof(struct taskstats));
+ if (!ret)