v2.6.34.12 longterm review
Subsystems (104)
PATCH 167/179 futex: Fix regression with read only mappings
In reply to Paul GortmakerFrom: Shawn Bohrer <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 9ea71503a8ed9184d2d0b8ccc4d269d05f7940ae upstream.
commit 7485d0d3758e8e6491a5c9468114e74dc050785d (futexes: Remove rw parameter from get_futex_key()) in 2.6.33 fixed two problems: First, It prevented a loop when encountering a ZERO_PAGE. Second, it fixed RW MAP_PRIVATE futex operations by forcing the COW to occur by unconditionally performing a write access get_user_pages_fast() to get the page. The commit also introduced a user-mode regression in that it broke futex operations on read-only memory maps. For example, this breaks workloads that have one or more reader processes doing a FUTEX_WAIT on a futex within a read only shared file mapping, and a writer processes that has a writable mapping issuing the FUTEX_WAKE.
This fixes the regression for valid futex operations on RO mappings by trying a RO get_user_pages_fast() when the RW get_user_pages_fast() fails. This change makes it necessary to also check for invalid use cases, such as anonymous RO mappings (which can never change) and the ZERO_PAGE which the commit referenced above was written to address.
This patch does restore the original behavior with RO MAP_PRIVATE mappings, which have inherent user-mode usage problems and don't really make sense. With this patch performing a FUTEX_WAIT within a RO MAP_PRIVATE mapping will be successfully woken provided another process updates the region of the underlying mapped file. However, the mmap() man page states that for a MAP_PRIVATE mapping:
It is unspecified whether changes made to the file after the mmap() call are visible in the mapped region.
So user-mode users attempting to use futex operations on RO MAP_PRIVATE mappings are depending on unspecified behavior. Additionally a RO MAP_PRIVATE mapping could fail to wake up in the following case.
Thread-A: call futex(FUTEX_WAIT, memory-region-A).
get_futex_key() return inode based key.
sleep on the key
Thread-B: call mprotect(PROT_READ|PROT_WRITE, memory-region-A)
Thread-B: write memory-region-A.
COW happen. This process's memory-region-A become related to new COWed private (ie PageAnon=1) page.
Thread-B: call futex(FUETX_WAKE, memory-region-A).
get_futex_key() return mm based key.
IOW, we fail to wake up Thread-A.
Once again doing something like this is just silly and users who do something like this get what they deserve.
While RO MAP_PRIVATE mappings are nonsensical, checking for a private mapping requires walking the vmas and was deemed too costly to avoid a userspace hang.
This Patch is based on Peter Zijlstra's initial patch with modifications to only allow RO mappings for futex operations that need VERIFY_READ access.
--- kernel/futex.c | 54 ++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 12 deletions(-)
kernel/futex.c +42 -12
@@ -203,6 +203,8 @@ static void drop_futex_key_refs(union futex_key *key)* @uaddr: virtual address of the futex * @fshared: 0 for a PROCESS_PRIVATE futex, 1 for PROCESS_SHARED * @key: address where result is stored. +* @rw: mapping needs to be read/write (values: VERIFY_READ, +* VERIFY_WRITE) * * Returns a negative error code or 0 * The key words are stored in *key on success.
@@ -214,12 +216,12 @@ static void drop_futex_key_refs(union futex_key *key)* lock_page() might sleep, the caller should not hold a spinlock. */ static int -get_futex_key (u32 __user *uaddr,int fshared,union futex_key *key) +get_futex_key (u32 __user *uaddr,int fshared,union futex_key *key,int rw) {unsigned long address = (unsigned long )uaddr;struct mm_struct *mm = current->mm;struct page *page; -int err; +int err, ro =0 ;/* * The futex address must be "naturally" aligned.
@@ -247,14 +249,31 @@ get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key) again: err =get_user_pages_fast (address,1 ,1 , &page); +/* +* If write access is not required (eg. FUTEX_WAIT), try +* and get read-only access. +*/ +if (err == -EFAULT && rw ==VERIFY_READ ) { + err =get_user_pages_fast (address,1 ,0 , &page); + ro =1 ; + }if (err <0 )return err; +else + err =0 ; page =compound_head (page);lock_page (page);if (!page->mapping) {unlock_page (page);put_page (page); +/* +* ZERO_PAGE pages don't have a mapping. Avoid a busy loop +* trying to find one. RW mapping would have COW'd (and thus +* have a mapping) so this page is RO and won't ever change. +*/ +if ((page ==ZERO_PAGE (address))) +return -EFAULT ; goto again; }
@@ -266,6 +285,15 @@ again:* the object not the particular process. */ if (PageAnon (page)) { +/* +* A RO anonymous page will never change and thus doesn't make +* sense for futex operations. +*/ +if (ro) { + err = -EFAULT ; + goto out; + } + key->both.offset |=FUT_OFF_MMSHARED ;/* ref taken on mm */ key->private.mm = mm; key->private.address = address;
@@ -277,9 +305,10 @@ again:get_futex_key_refs (key); +out:unlock_page (page);put_page (page); -return 0 ; +return err; } static inline
@@ -880,7 +909,7 @@ static int futex_wake(u32 __user *uaddr, int fshared, int nr_wake, u32 bitset)if (!bitset)return -EINVAL ; - ret =get_futex_key (uaddr, fshared, &key); + ret =get_futex_key (uaddr, fshared, &key,VERIFY_READ );if (unlikely (ret !=0 )) goto out;
@@ -926,10 +955,10 @@ futex_wake_op(u32 __user *uaddr1, int fshared, u32 __user *uaddr2,int ret, op_ret; retry: - ret =get_futex_key (uaddr1, fshared, &key1); + ret =get_futex_key (uaddr1, fshared, &key1,VERIFY_READ );if (unlikely (ret !=0 )) goto out; - ret =get_futex_key (uaddr2, fshared, &key2); + ret =get_futex_key (uaddr2, fshared, &key2,VERIFY_WRITE );if (unlikely (ret !=0 )) goto out_put_key1;
@@ -1188,10 +1217,11 @@ retry: pi_state =NULL ; } - ret =get_futex_key (uaddr1, fshared, &key1); + ret =get_futex_key (uaddr1, fshared, &key1,VERIFY_READ );if (unlikely (ret !=0 )) goto out; - ret =get_futex_key (uaddr2, fshared, &key2); + ret =get_futex_key (uaddr2, fshared, &key2, + requeue_pi ?VERIFY_WRITE :VERIFY_READ );if (unlikely (ret !=0 )) goto out_put_key1;
@@ -1746,7 +1776,7 @@ static int futex_wait_setup(u32 __user *uaddr, u32 val, int fshared,*/ retry: q->key =FUTEX_KEY_INIT ; - ret =get_futex_key (uaddr, fshared, &q->key); + ret =get_futex_key (uaddr, fshared, &q->key,VERIFY_READ );if (unlikely (ret !=0 ))return ret;
@@ -1912,7 +1942,7 @@ static int futex_lock_pi(u32 __user *uaddr, int fshared, q.requeue_pi_key =NULL ; retry: q.key =FUTEX_KEY_INIT ; - ret =get_futex_key (uaddr, fshared, &q.key); + ret =get_futex_key (uaddr, fshared, &q.key,VERIFY_WRITE );if (unlikely (ret !=0 )) goto out;
@@ -2031,7 +2061,7 @@ retry:if ((uval &FUTEX_TID_MASK ) !=task_pid_vnr (current))return -EPERM ; - ret =get_futex_key (uaddr, fshared, &key); + ret =get_futex_key (uaddr, fshared, &key,VERIFY_WRITE );if (unlikely (ret !=0 )) goto out;
@@ -2223,7 +2253,7 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, int fshared, rt_waiter.task =NULL ; key2 =FUTEX_KEY_INIT ; - ret =get_futex_key (uaddr2, fshared, &key2); + ret =get_futex_key (uaddr2, fshared, &key2,VERIFY_WRITE );if (unlikely (ret !=0 )) goto out;
Signature · 1 line
1.7.9.6
Re: [34-longterm 167/179] futex: Fix regression with read only mappings
Quoted 241 lines · Paul Gortmaker
From: Shawn Bohrer <[email protected]>
------------------- This is a commit scheduled for the next v2.6.34 longterm release. http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git If you see a problem with using this for longterm, please comment. -------------------commit
9ea71503a8ed9184d2d0b8ccc4d269d05f7940aeupstream.commit
7485d0d3758e8e6491a5c9468114e74dc050785d(futexes: Remove rw parameter fromget_futex_key()) in 2.6.33 fixed two problems: First, It prevented a loop when encountering aZERO_PAGE. Second, it fixed RWMAP_PRIVATEfutex operations by forcing the COW to occur by unconditionally performing a write accessget_user_pages_fast()to get the page. The commit also introduced a user-mode regression in that it broke futex operations on read-only memory maps. For example, this breaks workloads that have one or more reader processes doing aFUTEX_WAITon a futex within a read only shared file mapping, and a writer processes that has a writable mapping issuing theFUTEX_WAKE.This fixes the regression for valid futex operations on RO mappings by trying a RO
get_user_pages_fast()when the RWget_user_pages_fast()fails. This change makes it necessary to also check for invalid use cases, such as anonymous RO mappings (which can never change) and theZERO_PAGEwhich the commit referenced above was written to address.This patch does restore the original behavior with RO
MAP_PRIVATEmappings, which have inherent user-mode usage problems and don't really make sense. With this patch performing aFUTEX_WAITwithin a ROMAP_PRIVATEmapping will be successfully woken provided another process updates the region of the underlying mapped file. However, themmap()man page states that for aMAP_PRIVATEmapping:It is unspecified whether changes made to the file after the
mmap()call are visible in the mapped region.So user-mode users attempting to use futex operations on RO
MAP_PRIVATEmappings are depending on unspecified behavior. Additionally a ROMAP_PRIVATEmapping could fail to wake up in the following case.Thread-A: call
futex(FUTEX_WAIT, memory-region-A).
get_futex_key()return inode based key.
sleep on the key
Thread-B: callmprotect(PROT_READ|PROT_WRITE, memory-region-A)
Thread-B: write memory-region-A.
COW happen. This process's memory-region-A become related to new COWed private (ie PageAnon=1) page.
Thread-B: callfutex(FUETX_WAKE, memory-region-A).
get_futex_key()return mm based key.
IOW, we fail to wake up Thread-A.Once again doing something like this is just silly and users who do something like this get what they deserve.
While RO
MAP_PRIVATEmappings are nonsensical, checking for a private mapping requires walking the vmas and was deemed too costly to avoid a userspace hang.This Patch is based on Peter Zijlstra's initial patch with modifications to only allow RO mappings for futex operations that need
VERIFY_READaccess.Reported-by David Oliver <[email protected]>Signed-off-by Shawn Bohrer <[email protected]>Acked-by Peter Zijlstra <[email protected]>Signed-off-by Darren Hart <[email protected]>Cc KOSAKI Motohiro <[email protected]>Signed-off-by Thomas Gleixner <[email protected]>[PG: in 34, the variable is "page"; in original 9ea71503a it is page_head]Signed-off-by Paul Gortmaker <[email protected]>--- kernel/futex.c | 54 ++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 12 deletions(-)kernel/futex.c +42
-12@@ -203,6 +203,8 @@ static void drop_futex_key_refs(union futex_key *key)* @uaddr: virtual address of the futex * @fshared: 0 for a PROCESS_PRIVATE futex, 1 for PROCESS_SHARED * @key: address where result is stored. +* @rw: mapping needs to be read/write (values: VERIFY_READ, +* VERIFY_WRITE) * * Returns a negative error code or 0 * The key words are stored in *key on success. @@ -214,12 +216,12 @@ static void drop_futex_key_refs(union futex_key *key)* lock_page() might sleep, the caller should not hold a spinlock. */ static int -get_futex_key (u32 __user *uaddr,int fshared,union futex_key *key) +get_futex_key (u32 __user *uaddr,int fshared,union futex_key *key,int rw) {unsigned long address = (unsigned long )uaddr;struct mm_struct *mm = current->mm;struct page *page; -int err; +int err, ro =0 ;/* * The futex address must be "naturally" aligned. @@ -247,14 +249,31 @@ get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key) again: err =get_user_pages_fast (address,1 ,1 , &page); +/* +* If write access is not required (eg. FUTEX_WAIT), try +* and get read-only access. +*/ +if (err == -EFAULT && rw ==VERIFY_READ ) { + err =get_user_pages_fast (address,1 ,0 , &page); + ro =1 ; + }if (err <0 )return err; +else + err =0 ; page =compound_head (page);lock_page (page);if (!page->mapping) {unlock_page (page);put_page (page); +/* +* ZERO_PAGE pages don't have a mapping. Avoid a busy loop +* trying to find one. RW mapping would have COW'd (and thus +* have a mapping) so this page is RO and won't ever change. +*/ +if ((page ==ZERO_PAGE (address))) +return -EFAULT ; goto again; }@@ -266,6 +285,15 @@ again:* the object not the particular process. */ if (PageAnon (page)) { +/* +* A RO anonymous page will never change and thus doesn't make +* sense for futex operations. +*/ +if (ro) { + err = -EFAULT ; + goto out; + } + key->both.offset |=FUT_OFF_MMSHARED ;/* ref taken on mm */ key->private.mm = mm; key->private.address = address;@@ -277,9 +305,10 @@ again:get_futex_key_refs (key); +out:unlock_page (page);put_page (page); -return 0 ; +return err; } static inline@@ -880,7 +909,7 @@ static int futex_wake(u32 __user *uaddr, int fshared, int nr_wake, u32 bitset)if (!bitset)return -EINVAL ; - ret =get_futex_key (uaddr, fshared, &key); + ret =get_futex_key (uaddr, fshared, &key,VERIFY_READ );if (unlikely (ret !=0 )) goto out;@@ -926,10 +955,10 @@ futex_wake_op(u32 __user *uaddr1, int fshared, u32 __user *uaddr2,int ret, op_ret; retry: - ret =get_futex_key (uaddr1, fshared, &key1); + ret =get_futex_key (uaddr1, fshared, &key1,VERIFY_READ );if (unlikely (ret !=0 )) goto out; - ret =get_futex_key (uaddr2, fshared, &key2); + ret =get_futex_key (uaddr2, fshared, &key2,VERIFY_WRITE );if (unlikely (ret !=0 )) goto out_put_key1;@@ -1188,10 +1217,11 @@ retry: pi_state =NULL ; } - ret =get_futex_key (uaddr1, fshared, &key1); + ret =get_futex_key (uaddr1, fshared, &key1,VERIFY_READ );if (unlikely (ret !=0 )) goto out; - ret =get_futex_key (uaddr2, fshared, &key2); + ret =get_futex_key (uaddr2, fshared, &key2, + requeue_pi ?VERIFY_WRITE :VERIFY_READ );if (unlikely (ret !=0 )) goto out_put_key1;@@ -1746,7 +1776,7 @@ static int futex_wait_setup(u32 __user *uaddr, u32 val, int fshared,*/ retry: q->key =FUTEX_KEY_INIT ; - ret =get_futex_key (uaddr, fshared, &q->key); + ret =get_futex_key (uaddr, fshared, &q->key,VERIFY_READ );if (unlikely (ret !=0 ))return ret;@@ -1912,7 +1942,7 @@ static int futex_lock_pi(u32 __user *uaddr, int fshared, q.requeue_pi_key =NULL ; retry: q.key =FUTEX_KEY_INIT ; - ret =get_futex_key (uaddr, fshared, &q.key); + ret =get_futex_key (uaddr, fshared, &q.key,VERIFY_WRITE );if (unlikely (ret !=0 )) goto out;@@ -2031,7 +2061,7 @@ retry:if ((uval &FUTEX_TID_MASK ) !=task_pid_vnr (current))return -EPERM ; - ret =get_futex_key (uaddr, fshared, &key); + ret =get_futex_key (uaddr, fshared, &key,VERIFY_WRITE );if (unlikely (ret !=0 )) goto out;@@ -2223,7 +2253,7 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, int fshared, rt_waiter.task =NULL ; key2 =FUTEX_KEY_INIT ; - ret =get_futex_key (uaddr2, fshared, &key2); + ret =get_futex_key (uaddr2, fshared, &key2,VERIFY_WRITE );if (unlikely (ret !=0 )) goto out;Signature · 1 line
1.7.9.6
Including this commit worries me a little, because it introduces the ZERO_PAGE case which we later had to change. Though I did end up supplying the patch below, it was very much in consultation with Peter and Linus: I'm no expert on futices, and haven't followed the history of intervening patches between what you're including above and this one below (and I don't see an rw arg to get_futex_key() in latest source).
I don't know: I'm not NAKking it, I'm just waving a reddish flag, and hoping that Peter will remember more, and have something more constructive to say, than I can think of at this moment.
Hugh
commit e6780f7243eddb133cc20ec37fa69317c218b709
Author: Hugh Dickins <[email protected]> Date: Sat Dec 31 11:44:01 2011 -0800
futex: Fix uninterruptible loop due to gate_area
It was found (by Sasha) that if you use a futex located in the gate area we get stuck in an uninterruptible infinite loop, much like the ZERO_PAGE issue.
While looking at this problem, PeterZ realized you'll get into similar trouble when hitting any install_special_pages() mapping. And are there still drivers setting up their own special mmaps without page->mapping, and without special VM or pte flags to make get_user_pages fail?
In most cases, if page->mapping is NULL, we do not need to retry at all:
Linus points out that even /proc/sys/vm/drop_caches poses no problem, because it ends up using remove_mapping(), which takes care not to interfere when the page reference count is raised.
But there is still one case which does need a retry: if memory pressure called shmem_writepage in between get_user_pages_fast dropping page table lock and our acquiring page lock, then the page gets switched from filecache to swapcache (and ->mapping set to NULL) whatever the refcount. Fault it back in to get the page->mapping needed for key->shared.inode.
kernel/futex.c +20 -8
@@ -314,17 +314,29 @@ again:#endif lock_page (page_head); + +/* +* If page_head->mapping is NULL, then it cannot be a PageAnon +* page; but it might be the ZERO_PAGE or in the gate area or +* in a special mapping (all cases which we are happy to fail); +* or it may have been a good file page when get_user_pages_fast +* found it, but truncated or holepunched or subjected to +* invalidate_complete_page2 before we got the page lock (also +* cases which we are happy to fail). And we hold a reference, +* so refcount care in invalidate_complete_page's remove_mapping +* prevents drop_caches from setting mapping to NULL beneath us. +* +* The case we do have to guard against is when memory pressure made +* shmem_writepage move it from filecache to swapcache beneath us: +* an unlikely race, but we do need to retry for page_head->mapping. +*/ if (!page_head->mapping) { +int shmem_swizzled =PageSwapCache (page_head);unlock_page (page_head);put_page (page_head); -/* -* ZERO_PAGE pages don't have a mapping. Avoid a busy loop -* trying to find one. RW mapping would have COW'd (and thus -* have a mapping) so this page is RO and won't ever change. -*/ -if ((page_head ==ZERO_PAGE (address))) -return -EFAULT ; - goto again; +if (shmem_swizzled) + goto again; +return -EFAULT ; }/*
Peter Zijlstra
maintainerRe: [34-longterm 167/179] futex: Fix regression with read only mappings
Quoted 3 lines · Hugh Dickins
I don't know: I'm not NAKking it, I'm just waving a reddish flag, and hoping that Peter will remember more, and have something more constructive to say, than I can think of at this moment.
Ha! you're very optimistic :-)
going by git log kernel/futex.c on a recent kernel the proposed patch should indeed be followed by your patch, but I can't seem to find more relevant patches.
Re: [34-longterm 167/179] futex: Fix regression with read only mappings
Quoted 10 lines · [Re: [34-longterm 167/179] futex: Fix regression with read only mappings] On…
Quoted 3 lines · Hugh Dickins
I don't know: I'm not NAKking it, I'm just waving a reddish flag, and hoping that Peter will remember more, and have something more constructive to say, than I can think of at this moment.
Ha! you're very optimistic :-)
going by git log
kernel/futex.con a recent kernel the proposed patch should indeed be followed by your patch, but I can't seem to find more relevant patches.
Thanks a lot guys. That is a dependency I'd never have come up with.
Willy -- this is probably of interest to you as well. Hugh says that
commit e6780f7243 ("futex: Fix uninterruptible loop due to gate_area") should be used if 9ea71503a8 ("futex: Fix regression with read only mappings") is used. The v2.6.32.46 added 9ea71503a8 (as d64ec7bb), but I don't see a cherry pick of e6780f7243 in any v2.6.32.x yet.
Greg already applied it to 3.0.16 and 3.1.8 and it appeared in v3.2 by default, so no other active stable releases need to worry.
I had to change page_mapping --> page, since the 2.6.34 baseline does not have a5b338f2b0b1ff73 ("thp: update futex compound knowledge") [added to v2.6.38] which introduces the shadow variable page_mapping.
Paul.
---
Quoted 1 line
From
f8fe91498b2a35fc6abc02bb213ca297bfcd2b2aMon Sep 17 00:00:00 2001
From: Hugh Dickins <[email protected]>
Date: Sat, 31 Dec 2011 11:44:01 -0800
Subject: [PATCH] futex: Fix uninterruptible loop due to gate_area
commit e6780f7243eddb133cc20ec37fa69317c218b709 upstream.
It was found (by Sasha) that if you use a futex located in the gate area we get stuck in an uninterruptible infinite loop, much like the ZERO_PAGE issue.
While looking at this problem, PeterZ realized you'll get into similar trouble when hitting any install_special_pages() mapping. And are there still drivers setting up their own special mmaps without page->mapping, and without special VM or pte flags to make get_user_pages fail?
In most cases, if page->mapping is NULL, we do not need to retry at all:
Linus points out that even /proc/sys/vm/drop_caches poses no problem, because it ends up using remove_mapping(), which takes care not to interfere when the page reference count is raised.
But there is still one case which does need a retry: if memory pressure called shmem_writepage in between get_user_pages_fast dropping page table lock and our acquiring page lock, then the page gets switched from filecache to swapcache (and ->mapping set to NULL) whatever the refcount. Fault it back in to get the page->mapping needed for key->shared.inode.
kernel/futex.c +20 -8
@@ -264,17 +264,29 @@ again: page =compound_head (page);lock_page (page); + +/* +* If page->mapping is NULL, then it cannot be a PageAnon +* page; but it might be the ZERO_PAGE or in the gate area or +* in a special mapping (all cases which we are happy to fail); +* or it may have been a good file page when get_user_pages_fast +* found it, but truncated or holepunched or subjected to +* invalidate_complete_page2 before we got the page lock (also +* cases which we are happy to fail). And we hold a reference, +* so refcount care in invalidate_complete_page's remove_mapping +* prevents drop_caches from setting mapping to NULL beneath us. +* +* The case we do have to guard against is when memory pressure made +* shmem_writepage move it from filecache to swapcache beneath us: +* an unlikely race, but we do need to retry for page->mapping. +*/ if (!page->mapping) { +int shmem_swizzled =PageSwapCache (page);unlock_page (page);put_page (page); -/* -* ZERO_PAGE pages don't have a mapping. Avoid a busy loop -* trying to find one. RW mapping would have COW'd (and thus -* have a mapping) so this page is RO and won't ever change. -*/ -if ((page ==ZERO_PAGE (address))) -return -EFAULT ; - goto again; +if (shmem_swizzled) + goto again; +return -EFAULT ; }/*
Signature · 1 line
1.7.9.6
Re: [34-longterm 167/179] futex: Fix regression with read only mappings
Quoted 21 lines · Paul Gortmaker
Quoted 10 lines · [Re: [34-longterm 167/179] futex: Fix regression with read only mappings] On…
Quoted 3 lines · Hugh Dickins
I don't know: I'm not NAKking it, I'm just waving a reddish flag, and hoping that Peter will remember more, and have something more constructive to say, than I can think of at this moment.
Ha! you're very optimistic :-)
going by git log
kernel/futex.con a recent kernel the proposed patch should indeed be followed by your patch, but I can't seem to find more relevant patches.Thanks a lot guys. That is a dependency I'd never have come up with.
Willy -- this is probably of interest to you as well. Hugh says that
commite6780f7243("futex: Fix uninterruptible loop due togate_area") should be used if9ea71503a8("futex: Fix regression with read only mappings") is used. The v2.6.32.46 added9ea71503a8(asd64ec7bb), but I don't see a cherry pick ofe6780f7243in any v2.6.32.x yet.
Quoted 6 lines
Greg already applied it to 3.0.16 and 3.1.8 and it appeared in v3.2 by default, so no other active stable releases need to worry.
I had to change
page_mapping--> page, since the 2.6.34 baseline does not havea5b338f2b0b1ff73("thp: update futex compound knowledge") [added to v2.6.38] which introduces the shadow variablepage_mapping.
Thank you very much Paul, I'm queuing it then. I hope to have some time for a new -32 review soon, probably next week-end.
Cheers,
Willy
PATCH 168/179 x86-32, vdso: On system call restart after SYSENTER, use int $0x80
In reply to Paul GortmakerFrom: "H. Peter Anvin" <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 7ca0758cdb7c241cb4e0490a8d95f0eb5b861daf upstream.
When we enter a 32-bit system call via SYSENTER or SYSCALL, we shuffle the arguments to match the int $0x80 calling convention. This was probably a design mistake, but it's what it is now. This causes errors if the system call as to be restarted.
For SYSENTER, we have to invoke the instruction from the vdso as the return address is hardcoded. Accordingly, we can simply replace the jump in the vdso with an int $0x80 instruction and use the slower entry point for a post-restart.
--- arch/x86/vdso/vdso32/sysenter.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/vdso/vdso32/sysenter.S +1 -1
@@ -43,7 +43,7 @@ __kernel_vsyscall: .space 7,0x90 /* 14: System call restart point is here! (SYSENTER_RETURN-2) */ - jmp .Lenter_kernel + int $0x80 /* 16: System call normal return point is here! */ VDSO32_SYSENTER_RETURN: /* Symbol used by sysenter.c via vdso32-syms.h */ pop %ebp
Signature · 1 line
1.7.9.6
PATCH 169/179 x86, UV: Remove UV delay in starting slave cpus
In reply to Paul GortmakerFrom: Jack Steiner <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 05e33fc20ea5e493a2a1e7f1d04f43cdf89f83ed upstream.
Delete the 10 msec delay between the INIT and SIPI when starting slave cpus. I can find no requirement for this delay. BIOS also has similar code sequences without the delay.
Removing the delay reduces boot time by 40 sec. Every bit helps.
--- arch/x86/kernel/apic/x2apic_uv_x.c | 1 - 1 file changed, 1 deletion(-)
arch/x86/kernel/apic/x2apic_uv_x.c +0 -1
@@ -144,7 +144,6 @@ static int __cpuinit uv_wakeup_secondary(int phys_apicid, unsigned long start_ri ((start_rip <<UVH_IPI_INT_VECTOR_SHFT ) >>12 ) |APIC_DM_INIT ;uv_write_global_mmr64 (pnode,UVH_IPI_INT , val); -mdelay (10 ); val = (1UL <<UVH_IPI_INT_SEND_SHFT ) | (phys_apicid << UVH_IPI_INT_APIC_ID_SHFT) |
Signature · 1 line
1.7.9.6
PATCH 170/179 drm/ttm: fix ttm_bo_add_ttm(user) failure path
In reply to Paul GortmakerFrom: Marcin Slusarz <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 7c4c3960dff109bc5db4c35da481c212dadb5eb5 upstream.
ttm_tt_destroy kfrees passed object, so we need to nullify a reference to it.
--- drivers/gpu/drm/ttm/ttm_bo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/ttm/ttm_bo.c +3 -1
@@ -343,8 +343,10 @@ static int ttm_bo_add_ttm(struct ttm_buffer_object *bo, bool zero_alloc) ret =ttm_tt_set_user (bo->ttm, current, bo->buffer_start, bo->num_pages); -if (unlikely (ret !=0 )) +if (unlikely (ret !=0 )) {ttm_tt_destroy (bo->ttm); + bo->ttm =NULL ; + }break ;default : printk(KERN_ERR TTM_PFX "Illegal buffer object type\n");
Signature · 1 line
1.7.9.6
PATCH 171/179 fuse: check size of FUSE_NOTIFY_INVAL_ENTRY message
In reply to Paul GortmakerFrom: Miklos Szeredi <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit c2183d1e9b3f313dd8ba2b1b0197c8d9fb86a7ae upstream.
FUSE_NOTIFY_INVAL_ENTRY didn't check the length of the write so the message processing could overrun and result in a "kernel BUG at fs/fuse/dev.c:629!"
--- fs/fuse/dev.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/fuse/dev.c +4 -0
@@ -901,6 +901,10 @@ static int fuse_notify_inval_entry(struct fuse_conn *fc, unsigned int size,if (outarg.namelen >FUSE_NAME_MAX ) goto err; + err = -EINVAL ; +if (size !=sizeof (outarg) + outarg.namelen +1 ) + goto err; + name.name = buf; name.len = outarg.namelen; err =fuse_copy_one (cs, buf, outarg.namelen +1 );
Signature · 1 line
1.7.9.6
PATCH 172/179 igb: Fix lack of flush after register write and before delay
In reply to Paul GortmakerFrom: Carolyn Wyborny <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 064b43304ed8ede8e13ff7b4338d09fd37bcffb1 upstream.
Register writes followed by a delay are required to have a flush before the delay in order to commit the values to the register. Without the flush, the code following the delay may not function correctly.
--- drivers/net/igb/e1000_82575.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/igb/e1000_82575.c +1 -0
@@ -1554,6 +1554,7 @@ static s32 igb_reset_hw_82580(struct e1000_hw *hw) ctrl |=E1000_CTRL_RST ;wr32 (E1000_CTRL , ctrl); +wrfl ();/* Add delay to insure DEV_RST has time to complete */ if (global_device_reset)
Signature · 1 line
1.7.9.6
PATCH 173/179 tty: Make tiocgicount a handler
In reply to Paul GortmakerFrom: Alan Cox <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit d281da7ff6f70efca0553c288bb883e8605b3862 upstream.
Dan Rosenberg noted that various drivers return the struct with uncleared fields. Instead of spending forever trying to stomp all the drivers that get it wrong (and every new driver) do the job in one place.
This first patch adds the needed operations and hooks them up, including the needed USB midlayer and serial core plumbing.
--- drivers/char/tty_io.c | 21 +++++++++++++++++++++ drivers/serial/serial_core.c | 35 ++++++++++++++++------------------- drivers/usb/serial/usb-serial.c | 13 +++++++++++++ include/linux/tty_driver.h | 9 +++++++++ include/linux/usb/serial.h | 2 ++ 5 files changed, 61 insertions(+), 19 deletions(-)
drivers/char/tty_io.c +21 -0
@@ -96,6 +96,7 @@#include <linux/bitops.h> #include <linux/delay.h> #include <linux/seq_file.h> +#include <linux/serial.h> #include <linux/uaccess.h> #include <asm/system.h>
@@ -2457,6 +2458,20 @@ static int tty_tiocmset(struct tty_struct *tty, struct file *file, unsigned intreturn tty->ops->tiocmset (tty, file, set, clear); } +static int tty_tiocgicount (struct tty_struct *tty,void __user *arg) +{ +int retval = -EINVAL ; +struct serial_icounter_struct icount; +memset (&icount,0 ,sizeof (icount)); +if (tty->ops->get_icount) + retval = tty->ops->get_icount (tty, &icount); +if (retval !=0 ) +return retval; +if (copy_to_user (arg, &icount,sizeof (icount))) +return -EFAULT ; +return 0 ; +} +struct tty_struct *tty_pair_get_tty (struct tty_struct *tty) { if (tty->driver->type == TTY_DRIVER_TYPE_PTY &&
@@ -2577,6 +2592,12 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)case TIOCMBIC :case TIOCMBIS :return tty_tiocmset (tty, file, cmd, p); +case TIOCGICOUNT : + retval =tty_tiocgicount (tty, p); +/* For the moment allow fall through to the old method */ +if (retval != -EINVAL ) +return retval; +break ;case TCFLSH :switch (arg) {case TCIFLUSH :
drivers/serial/serial_core.c +16 -19
@@ -1074,10 +1074,10 @@ uart_wait_modem_status(struct uart_state *state, unsigned long arg)* NB: both 1->0 and 0->1 transitions are counted except for * RI where only 0->1 is counted. */ -static int uart_get_count (struct uart_state *state, -struct serial_icounter_struct __user *icnt) +static int uart_get_icount (struct tty_struct *tty, +struct serial_icounter_struct *icount) { -struct serial_icounter_struct icount; +struct uart_state *state = tty->driver_data;struct uart_icount cnow;struct uart_port *uport = state->uart_port;
@@ -1085,19 +1085,19 @@ static int uart_get_count(struct uart_state *state,memcpy (&cnow, &uport->icount,sizeof (struct uart_icount ));spin_unlock_irq (&uport->lock); - icount.cts = cnow.cts; - icount.dsr = cnow.dsr; - icount.rng = cnow.rng; - icount.dcd = cnow.dcd; - icount.rx = cnow.rx; - icount.tx = cnow.tx; - icount.frame = cnow.frame; - icount.overrun = cnow.overrun; - icount.parity = cnow.parity; - icount.brk = cnow.brk; - icount.buf_overrun = cnow.buf_overrun; + icount->cts = cnow.cts; + icount->dsr = cnow.dsr; + icount->rng = cnow.rng; + icount->dcd = cnow.dcd; + icount->rx = cnow.rx; + icount->tx = cnow.tx; + icount->frame = cnow.frame; + icount->overrun = cnow.overrun; + icount->parity = cnow.parity; + icount->brk = cnow.brk; + icount->buf_overrun = cnow.buf_overrun; -return copy_to_user (icnt, &icount,sizeof (icount)) ? -EFAULT :0 ; +return 0 ; }/*
@@ -1150,10 +1150,6 @@ uart_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd,case TIOCMIWAIT : ret =uart_wait_modem_status (state, arg);break ; - -case TIOCGICOUNT : - ret =uart_get_count (state, uarg); -break ; }if (ret != -ENOIOCTLCMD )
@@ -2305,6 +2301,7 @@ static const struct tty_operations uart_ops = {#endif .tiocmget = uart_tiocmget, .tiocmset = uart_tiocmset, + .get_icount = uart_get_icount, #ifdef CONFIG_CONSOLE_POLL .poll_init = uart_poll_init, .poll_get_char = uart_poll_get_char,
drivers/usb/serial/usb-serial.c +13 -0
@@ -519,6 +519,18 @@ static int serial_tiocmset(struct tty_struct *tty, struct file *file,return -EINVAL ; } +static int serial_get_icount (struct tty_struct *tty, +struct serial_icounter_struct *icount) +{ +struct usb_serial_port *port = tty->driver_data; + +dbg ("%s - port %d" , __func__, port->number); + +if (port->serial->type->get_icount) +return port->serial->type->get_icount (tty, icount); +return -EINVAL ; +} +/* * We would be calling tty_wakeup here, but unfortunately some line * disciplines have an annoying habit of calling tty->write from
@@ -1171,6 +1183,7 @@ static const struct tty_operations serial_ops = { .chars_in_buffer = serial_chars_in_buffer, .tiocmget = serial_tiocmget, .tiocmset = serial_tiocmset, + .get_icount = serial_get_icount, .cleanup = serial_cleanup, .install = serial_install, .proc_fops = &serial_proc_fops,
include/linux/tty_driver.h +9 -0
@@ -224,6 +224,12 @@* unless the tty also has a valid tty->termiox pointer. * * Optional: Called under the termios lock +* +* int (*get_icount)(struct tty_struct *tty, struct serial_icounter *icount); +* +* Called when the device receives a TIOCGICOUNT ioctl. Passed a kernel +* structure to complete. This method is optional and will only be called +* if provided (otherwise EINVAL will be returned). */ #include <linux/fs.h>
@@ -232,6 +238,7 @@struct tty_struct ;struct tty_driver ; +struct serial_icounter_struct ;struct tty_operations { struct tty_struct * (*lookup)(struct tty_driver *driver,
@@ -268,6 +275,8 @@ struct tty_operations { unsigned int set, unsigned int clear);int (*resize)(struct tty_struct *tty,struct winsize *ws);int (*set_termiox)(struct tty_struct *tty,struct termiox *tnew); +int (*get_icount)(struct tty_struct *tty, +struct serial_icounter_struct *icount);#ifdef CONFIG_CONSOLE_POLL int (*poll_init)(struct tty_driver *driver,int line,char *options);int (*poll_get_char)(struct tty_driver *driver,int line);
include/linux/usb/serial.h +2 -0
@@ -257,6 +257,8 @@ struct usb_serial_driver {int (*tiocmget)(struct tty_struct *tty,struct file *file);int (*tiocmset)(struct tty_struct *tty,struct file *file,unsigned int set,unsigned int clear); +int (*get_icount)(struct tty_struct *tty, +struct serial_icounter_struct *icount);/* Called by the tty layer for port level work. There may or may not be an attached tty at this point */ void (*dtr_rts)(struct usb_serial_port *port,int on);
Signature · 1 line
1.7.9.6
PATCH 174/179 tty: icount changeover for other main devices
In reply to Paul GortmakerFrom: Alan Cox <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 0587102cf9f427c185bfdeb2cef41e13ee0264b1 upstream.
Again basically cut and paste
Convert the main driver set to use the hooks for GICOUNT
--- arch/ia64/hp/sim/simserial.c | 12 +----- drivers/char/amiserial.c | 56 +++++++++++++++------------- drivers/char/cyclades.c | 49 +++++++++++++------------ drivers/char/ip2/ip2main.c | 72 +++++++++++++++++++++--------------- drivers/char/mxser.c | 62 +++++++++++++++++-------------- drivers/char/nozomi.c | 37 +++++++++---------- drivers/char/pcmcia/synclink_cs.c | 60 ++++++++++++++---------------- drivers/char/synclink.c | 73 +++++++++++++++++-------------------- drivers/char/synclink_gt.c | 56 ++++++++++++++-------------- drivers/char/synclinkmp.c | 61 ++++++++++++++----------------- drivers/serial/68360serial.c | 51 +++++++++++++------------- net/bluetooth/rfcomm/tty.c | 4 -- 12 files changed, 297 insertions(+), 296 deletions(-)
arch/ia64/hp/sim/simserial.c +1 -11
@@ -395,7 +395,7 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file, {if ((cmd !=TIOCGSERIAL ) && (cmd !=TIOCSSERIAL ) && (cmd !=TIOCSERCONFIG ) && (cmd !=TIOCSERGSTRUCT ) && - (cmd !=TIOCMIWAIT ) && (cmd !=TIOCGICOUNT )) { + (cmd !=TIOCMIWAIT )) {if (tty->flags & (1 <<TTY_IO_ERROR ))return -EIO ; }
@@ -433,16 +433,6 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,case TIOCMIWAIT :printk (KERN_INFO "rs_ioctl: TIOCMIWAIT: called\n" );return 0 ; -/* -* Get counter of input serial line interrupts (DCD,RI,DSR,CTS) -* Return: write counters to the user passed counter struct -* NB: both 1->0 and 0->1 transitions are counted except for -* RI where only 0->1 is counted. -*/ -case TIOCGICOUNT : -printk (KERN_INFO "rs_ioctl: TIOCGICOUNT called\n" ); -return 0 ; -case TIOCSERGWILD :case TIOCSERSWILD :/* "setserial -W" is called in Debian boot */
drivers/char/amiserial.c +31 -25
74 lines not on this page · raw message
drivers/char/cyclades.c +26 -23
67 lines not on this page · raw message
drivers/char/ip2/ip2main.c +43 -29
102 lines not on this page · raw message
drivers/char/mxser.c +35 -27
86 lines not on this page · raw message
drivers/char/nozomi.c +18 -19
@@ -1805,24 +1805,24 @@ static int ntty_cflags_changed(struct port *port, unsigned long flags,return ret; } -static int ntty_ioctl_tiocgicount (struct port *port,void __user *argp) +static int ntty_tiocgicount (struct tty_struct *tty, +struct serial_icounter_struct *icount) { +struct port *port = tty->driver_data;const struct async_icount cnow = port->tty_icount; -struct serial_icounter_struct icount; - - icount.cts = cnow.cts; - icount.dsr = cnow.dsr; - icount.rng = cnow.rng; - icount.dcd = cnow.dcd; - icount.rx = cnow.rx; - icount.tx = cnow.tx; - icount.frame = cnow.frame; - icount.overrun = cnow.overrun; - icount.parity = cnow.parity; - icount.brk = cnow.brk; - icount.buf_overrun = cnow.buf_overrun; - -return copy_to_user (argp, &icount,sizeof (icount)) ? -EFAULT :0 ; + + icount->cts = cnow.cts; + icount->dsr = cnow.dsr; + icount->rng = cnow.rng; + icount->dcd = cnow.dcd; + icount->rx = cnow.rx; + icount->tx = cnow.tx; + icount->frame = cnow.frame; + icount->overrun = cnow.overrun; + icount->parity = cnow.parity; + icount->brk = cnow.brk; + icount->buf_overrun = cnow.buf_overrun; +return 0 ; } static int ntty_ioctl(struct tty_struct *tty, struct file *file,
@@ -1841,9 +1841,7 @@ static int ntty_ioctl(struct tty_struct *tty, struct file *file, rval =wait_event_interruptible (port->tty_wait,ntty_cflags_changed (port, arg, &cprev));break ; - }case TIOCGICOUNT : - rval =ntty_ioctl_tiocgicount (port, argp); -break ; + }default :DBG1 ("ERR: 0x%08X, %d" , cmd, cmd);break ;
@@ -1923,6 +1921,7 @@ static const struct tty_operations tty_ops = { .chars_in_buffer = ntty_chars_in_buffer, .tiocmget = ntty_tiocmget, .tiocmset = ntty_tiocmset, + .get_icount = ntty_tiocgicount, .install = ntty_install, .cleanup = ntty_cleanup, };
drivers/char/pcmcia/synclink_cs.c +27 -33
85 lines not on this page · raw message
drivers/char/synclink.c +34 -39
104 lines not on this page · raw message
drivers/char/synclink_gt.c +29 -27
92 lines not on this page · raw message
drivers/char/synclinkmp.c +28 -33
91 lines not on this page · raw message
drivers/serial/68360serial.c +25 -26
69 lines not on this page · raw message
net/bluetooth/rfcomm/tty.c +0 -4
@@ -844,10 +844,6 @@ static int rfcomm_tty_ioctl(struct tty_struct *tty, struct file *filp, unsignedBT_DBG ("TIOCMIWAIT" );break ; -case TIOCGICOUNT : -BT_DBG ("TIOCGICOUNT" ); -break ; -case TIOCGSERIAL :BT_ERR ("TIOCGSERIAL is not supported" );return -ENOIOCTLCMD ;
Signature · 1 line
1.7.9.6
Quoted 10 lines · Paul Gortmaker
This is the start of the longterm review cycle for the v2.6.34.12 release. There are 179 patches in this series, all will be posted as a response to this one. �If anyone has any issues with these being applied, please let us know. �If anyone is a maintainer of the proper subsystem, and wants to add a Signed-off-by: line to the patch, please respond with it.
The full queue can be found at:
�http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.gitPlease try to get reponses made within 72 hours, or it may be too late.\
Doh, Somehow the old (pre-break-in) address again leaked back into my stable scripts. Sorry about that. This was meant to go to the [email protected] and not the stale [email protected] address.
Paul.
PATCH 175/179 nozomi: Fix warning from the previous TIOCGCOUNT changes
In reply to Paul GortmakerFrom: Alan Cox <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 68e29655cc51761d60d5f27b2738816a5b13e415 upstream.
Just remove a now unused variable
--- drivers/char/nozomi.c | 1 - 1 file changed, 1 deletion(-)
drivers/char/nozomi.c +0 -1
@@ -1829,7 +1829,6 @@ static int ntty_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg) {struct port *port = tty->driver_data; -void __user *argp = (void __user *)arg;int rval = -ENOIOCTLCMD ;DBG1 ("******** IOCTL, cmd: %d" , cmd);
Signature · 1 line
1.7.9.6
PATCH 176/179 tty: fix warning in synclink driver
In reply to Paul GortmakerFrom: Andres Salomon <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit dc98d9650891661a20842a8eef9e76536046d897 upstream.
During builds I see the following warning -
CC [M] drivers/char/pcmcia/synclink_cs.odrivers/char/pcmcia/synclink_cs.c:2194: warning: ‘mgslpc_get_icount’ defined but not used
The function is a callback meant to be assigned to get_icount (added during 0587102cf). Fix accordingly.
--- drivers/char/pcmcia/synclink_cs.c | 1 + 1 file changed, 1 insertion(+)
drivers/char/pcmcia/synclink_cs.c +1 -0
@@ -2839,6 +2839,7 @@ static const struct tty_operations mgslpc_ops = { .hangup = mgslpc_hangup, .tiocmget = tiocmget, .tiocmset = tiocmset, + .get_icount = mgslpc_get_icount, .proc_fops = &mgslpc_proc_fops, };
Signature · 1 line
1.7.9.6
PATCH 177/179 score: fix off-by-one index into syscall table
In reply to Paul GortmakerFrom: Dan Rosenberg <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit c25a785d6647984505fa165b5cd84cfc9a95970b upstream.
If the provided system call number is equal to __NR_syscalls, the current check will pass and a function pointer just after the system call table may be called, since sys_call_table is an array with total size __NR_syscalls.
Whether or not this is a security bug depends on what the compiler puts immediately after the system call table. It's likely that this won't do anything bad because there is an additional NULL check on the syscall entry, but if there happens to be a non-NULL value immediately after the system call table, this may result in local privilege escalation.
--- arch/score/kernel/entry.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/score/kernel/entry.S +1 -1
@@ -408,7 +408,7 @@ ENTRY(handle_sys) sw r9, [r0, PT_EPC] cmpi.c r27, __NR_syscalls # check syscall number - bgtu illegal_syscall + bgeu illegal_syscall slli r8, r27, 2 # get syscall routine la r11, sys_call_table
Signature · 1 line
1.7.9.6
PATCH 178/179 x86/PCI: use host bridge _CRS info on MSI MS-7253
In reply to Paul GortmakerFrom: Jonathan Nieder <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit 8411371709610c826bf65684f886bfdfb5780ca1 upstream.
In the spirit of commit 29cf7a30f8a0 ("x86/PCI: use host bridge _CRS info on ASUS M2V-MX SE"), this DMI quirk turns on "pci_use_crs" by default on a board that needs it.
This fixes boot failures and oopses introduced in 3e3da00c01d0 ("x86/pci: AMD one chain system to use pci read out res"). The quirk is quite targetted (to a specific board and BIOS version) for two reasons:
(1) to emphasize that this method of tackling the problem one quirk at a time is a little insane
(2) to give BIOS vendors an opportunity to use simpler tables and allow us to return to generic behavior (whatever that happens to be) with a later BIOS update
In other words, I am not at all happy with having quirks like this. But it is even worse for the kernel not to work out of the box on these machines, so...
Reference: https://bugzilla.kernel.org/show_bug.cgi?id=42619
--- arch/x86/pci/acpi.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/x86/pci/acpi.c +11 -0
@@ -43,6 +43,17 @@ static const struct dmi_system_id pci_use_crs_table[] __initconst = { DMI_MATCH(DMI_PRODUCT_NAME, "ALiveSATA2-GLAN"), }, }, +/* https://bugzilla.kernel.org/show_bug.cgi?id=42619 */ + { + .callback = set_use_crs, + .ident = "MSI MS-7253", + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "MICRO-STAR INTERNATIONAL CO., LTD"), + DMI_MATCH(DMI_BOARD_NAME, "MS-7253"), + DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies, LTD"), + DMI_MATCH(DMI_BIOS_VERSION, "V1.6"), + }, + }, {} };
Signature · 1 line
1.7.9.6
PATCH 179/179 x86/PCI: do not tie MSI MS-7253 use_crs quirk to BIOS version
In reply to Paul GortmakerFrom: Jonathan Nieder <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release.
http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git
If you see a problem with using this for longterm, please comment.
-------------------commit a97f4f5e524bcd09a85ef0b8821a14d35e69335f upstream.
Carlos was getting
WARNING: at drivers/pci/pci.c:118 pci_ioremap_bar+0x24/0x52()
when probing his sound card, and sound did not work. After adding pci=use_crs to the kernel command line, no more trouble.
Ok, we can add a quirk. dmidecode output reveals that this is an MSI MS-7253, for which we already have a quirk, but the short-sighted author tied the quirk to a single BIOS version, making it not kick in on Carlos's machine with BIOS V1.2. If a later BIOS update makes it no longer necessary to look at the _CRS info it will still be harmless, so let's stop trying to guess which versions have and don't have accurate _CRS tables.
Addresses https://bugtrack.alsa-project.org/alsa-bug/view.php?id=5533
Also see <https://bugzilla.kernel.org/show_bug.cgi?id=42619>.
--- arch/x86/pci/acpi.c | 1 - 1 file changed, 1 deletion(-)
arch/x86/pci/acpi.c +0 -1
@@ -51,7 +51,6 @@ static const struct dmi_system_id pci_use_crs_table[] __initconst = { DMI_MATCH(DMI_BOARD_VENDOR, "MICRO-STAR INTERNATIONAL CO., LTD"), DMI_MATCH(DMI_BOARD_NAME, "MS-7253"), DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies, LTD"), - DMI_MATCH(DMI_BIOS_VERSION, "V1.6"), }, }, {}
Signature · 1 line
1.7.9.6
Re: [34-longterm 179/179] x86/PCI: do not tie MSI MS-7253 use_crs quirk to BIOS version
O> MS-7253, for which we already have a quirk, but the short-sighted
Quoted 1 line
author tied the quirk to a single BIOS version, making it not kick in
It's our usual policy to tie to particular BIOS versions because these things are often BIOS specific and come and go with updates.
So I think short-sighted is unfair - appropriately conserative is closer.
Quoted 4 lines
on Carlos's machine with BIOS V1.2. If a later BIOS update makes it no longer necessary to look at the
_CRSinfo it will still be harmless, so let's stop trying to guess which versions have and don't have accurate_CRStables.
Have you verified there are no BIOSes > v1.6 and that none of them have release notes or testing showing fixes related to this ? Adding 1.2 is fine but you are just asking for a regression on 1.7+ or similar.
Alan
Re: [34-longterm 179/179] x86/PCI: do not tie MSI MS-7253 use_crs quirk to BIOS version
Quoted 5 lines · On Tue, 15 May 2012 15:44:55 +0100 Alan Cox <[email protected]> wrote:
O> MS-7253, for which we already have a quirk, but the short-sighted
Quoted 1 line
author tied the quirk to a single BIOS version, making it not kick in
It's our usual policy to tie to particular BIOS versions because these things are often BIOS specific and come and go with updates.
Doh ignore that, the point is valid but not in a -longterm context
Re: [34-longterm 179/179] x86/PCI: do not tie MSI MS-7253 use_crs quirk to BIOS version
Quoted 10 lines · [Re: [34-longterm 179/179] x86/PCI: do not tie MSI MS-7253 use_crs quirk to…
Quoted 5 lines · On Tue, 15 May 2012 15:44:55 +0100 Alan Cox <[email protected]> wrote:
O> MS-7253, for which we already have a quirk, but the short-sighted
Quoted 1 line
author tied the quirk to a single BIOS version, making it not kick in
It's our usual policy to tie to particular BIOS versions because these things are often BIOS specific and come and go with updates.
Doh ignore that, the point is valid but not in a -longterm context
The prefix "34-longterm" isn't as clear as it was before we went to 3.0 so I'll change it to "2.6.34-stable" for next time. We've stopped separating longterm from stable on the server anyways.
Thanks,
Paul.