Davidlohr Bueso (1): ipc, sem: do not call sem_lock when bogus sma Linus Torvalds (1): crazy rcu double free debug hack Sedat Dilek (7): kbuild: deb-pkg: Try to determine distribution kbuild: deb-pkg: Bump year in debian/copyright file kbuild: deb-pkg: Update git repository URL in debian/copyright file Merge tag 'next-20130419' of git://git.kernel.org/.../next/linux-next into Linux-Next-v20130419 Merge branch 'deb-pkg-fixes' into 3.9.0-rc7-next20130419-11-iniza-small Merge branch 'ipc-sem-next-fixes-2' into 3.9.0-rc7-next20130419-11-iniza-small Merge branch 'crazy-rcu-double-free-debug-hack' into 3.9.0-rc7-next20130419-12-iniza-small include/linux/types.h | 1 + include/net/dst.h | 2 +- ipc/sem.c | 10 +++++----- kernel/rcu.h | 1 + kernel/rcutree.c | 6 ++++++ scripts/package/builddeb | 19 ++++++++++++++++--- 6 files changed, 30 insertions(+), 9 deletions(-) diff --git a/include/linux/types.h b/include/linux/types.h index 4d118ba..3f0d9da 100644 --- a/include/linux/types.h +++ b/include/linux/types.h @@ -209,6 +209,7 @@ struct ustat { struct callback_head { struct callback_head *next; void (*func)(struct callback_head *head); + unsigned long magic; }; #define rcu_head callback_head diff --git a/include/net/dst.h b/include/net/dst.h index 1f8fd10..6f8acd0 100644 --- a/include/net/dst.h +++ b/include/net/dst.h @@ -89,7 +89,7 @@ struct dst_entry { * (L1_CACHE_SIZE would be too much) */ #ifdef CONFIG_64BIT - long __pad_to_align_refcnt[2]; + long __pad_to_align_refcnt[1]; #endif /* * __refcnt wants to be on a different cache line from diff --git a/ipc/sem.c b/ipc/sem.c index 5711616..ec6a035 100644 --- a/ipc/sem.c +++ b/ipc/sem.c @@ -1869,8 +1869,7 @@ void exit_sem(struct task_struct *tsk) struct sem_array *sma; struct sem_undo *un; struct list_head tasks; - int semid; - int i; + int semid, i; rcu_read_lock(); un = list_entry_rcu(ulp->list_proc.next, @@ -1886,12 +1885,13 @@ void exit_sem(struct task_struct *tsk) } sma = sem_obtain_object_check(tsk->nsproxy->ipc_ns, un->semid); - sem_lock(sma, NULL, -1); - /* exit_sem raced with IPC_RMID, nothing to do */ - if (IS_ERR(sma)) + if (IS_ERR(sma)) { + rcu_read_unlock(); continue; + } + sem_lock(sma, NULL, -1); un = __lookup_undo(ulp, semid); if (un == NULL) { /* exit_sem raced with IPC_RMID+semget() that created diff --git a/kernel/rcu.h b/kernel/rcu.h index 7f8e759..0381ed3 100644 --- a/kernel/rcu.h +++ b/kernel/rcu.h @@ -98,6 +98,7 @@ static inline bool __rcu_reclaim(char *rn, struct rcu_head *head) { unsigned long offset = (unsigned long)head->func; + head->magic = 0; if (__is_kfree_rcu_offset(offset)) { RCU_TRACE(trace_rcu_invoke_kfree_callback(rn, head, offset)); kfree((void *)head - offset); diff --git a/kernel/rcutree.c b/kernel/rcutree.c index d853430..bdbd38c 100644 --- a/kernel/rcutree.c +++ b/kernel/rcutree.c @@ -2358,6 +2358,9 @@ static void __call_rcu_core(struct rcu_state *rsp, struct rcu_data *rdp, } } +/* Unlikely bit-pattern to check double RCU calls! */ +#define RCU_HEAD_MAGIC ((unsigned long)(0xfeeddead1acef8edll)) + /* * Helper function for call_rcu() and friends. The cpu argument will * normally be -1, indicating "currently running CPU". It may specify @@ -2372,9 +2375,12 @@ __call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *rcu), struct rcu_data *rdp; WARN_ON_ONCE((unsigned long)head & 0x3); /* Misaligned rcu_head! */ + if (WARN_ON_ONCE(head->magic == RCU_HEAD_MAGIC)) + return; debug_rcu_head_queue(head); head->func = func; head->next = NULL; + head->magic = RCU_HEAD_MAGIC; /* * Opportunistically note grace-period endings and beginnings. diff --git a/scripts/package/builddeb b/scripts/package/builddeb index acb8650..7d7c9d8 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -172,9 +172,22 @@ else fi maintainer="$name <$email>" +# Try to determine distribution +if [ -e $(which lsb_release) ]; then + codename=$(lsb_release --codename --short) + if [ "$codename" != "" ]; then + distribution=$codename + else + distribution="UNRELEASED" + echo "WARNING: The distribution could NOT be determined!" + fi +else + echo "HINT: Install lsb_release binary, this helps to identify your distribution!" +fi + # Generate a simple changelog template cat < debian/changelog -linux-upstream ($packageversion) unstable; urgency=low +linux-upstream ($packageversion) $distribution; urgency=low * Custom built Linux kernel. @@ -188,10 +201,10 @@ This is a packacked upstream version of the Linux kernel. The sources may be found at most Linux ftp sites, including: ftp://ftp.kernel.org/pub/linux/kernel -Copyright: 1991 - 2009 Linus Torvalds and others. +Copyright: 1991 - 2013 Linus Torvalds and others. The git repository for mainline kernel development is at: -git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git +git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by