+ shm-fix-shmctlshm_info-lockup-with-config_shmem.patch added to -mm tree

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

 



The patch titled
     shm: fix shmctl(SHM_INFO) lockup with !CONFIG_SHMEM
has been added to the -mm tree.  Its filename is
     shm-fix-shmctlshm_info-lockup-with-config_shmem.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find
out what to do about this

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: shm: fix shmctl(SHM_INFO) lockup with !CONFIG_SHMEM
From: Tony Battersby <tonyb@xxxxxxxxxxxxxxx>

shm_get_stat() assumes that the inode is a "struct shmem_inode_info",
which is incorrect for !CONFIG_SHMEM (see
fs/ramfs/inode.c::ramfs_get_inode() vs.  mm/shmem.c::shmem_get_inode()). 
This bad assumption can cause shmctl(SHM_INFO) to lockup when
shm_get_stat() tries to spin_lock(&info->lock).  Users of !CONFIG_SHMEM
may encounter this lockup simply by invoking the 'ipcs' command.

Reported by Jiri Olsa back in February 2008:
http://lkml.org/lkml/2008/2/29/74

Signed-off-by: Tony Battersby <tonyb@xxxxxxxxxxxxxxx>
Cc: Jiri Kosina <jkosina@xxxxxxx>
Reported-by: Jiri Olsa <olsajiri@xxxxxxxxx>
Cc: Hugh Dickins <hugh@xxxxxxxxxxx>
Cc: <stable@xxxxxxxxxx>		[2.6.everything]
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 ipc/shm.c |    4 ++++
 1 file changed, 4 insertions(+)

diff -puN ipc/shm.c~shm-fix-shmctlshm_info-lockup-with-config_shmem ipc/shm.c
--- a/ipc/shm.c~shm-fix-shmctlshm_info-lockup-with-config_shmem
+++ a/ipc/shm.c
@@ -565,11 +565,15 @@ static void shm_get_stat(struct ipc_name
 			struct hstate *h = hstate_file(shp->shm_file);
 			*rss += pages_per_huge_page(h) * mapping->nrpages;
 		} else {
+#ifdef CONFIG_SHMEM
 			struct shmem_inode_info *info = SHMEM_I(inode);
 			spin_lock(&info->lock);
 			*rss += inode->i_mapping->nrpages;
 			*swp += info->swapped;
 			spin_unlock(&info->lock);
+#else
+			*rss += inode->i_mapping->nrpages;
+#endif
 		}
 
 		total++;
_

Patches currently in -mm which might be from tonyb@xxxxxxxxxxxxxxx are

linux-next.patch
dmar-fix-endless-unknown-dmar-structure-type-loop.patch
shm-fix-shmctlshm_info-lockup-with-config_shmem.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux