Преглед изворни кода

Merge branch 'akpm' (patches from Andrew)

Merge misc fixes from Andrew Morton:
 "10 fixes"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
  scripts/gdb: fix lx-lsmod refcnt
  omfs: fix potential integer overflow in allocator
  omfs: fix sign confusion for bitmap loop counter
  omfs: set error return when d_make_root() fails
  fs, omfs: add NULL terminator in the end up the token list
  MAINTAINERS: update CAPABILITIES pattern
  fs/binfmt_elf.c:load_elf_binary(): return -EINVAL on zero-length mappings
  tracing/mm: don't trace mm_page_pcpu_drain on offline cpus
  tracing/mm: don't trace mm_page_free on offline cpus
  tracing/mm: don't trace kmem_cache_free on offline cpus
Linus Torvalds пре 10 година
родитељ
комит
c2102f3d73
6 измењених фајлова са 60 додато и 18 уклоњено
  1. 0 1
      MAINTAINERS
  2. 1 1
      fs/binfmt_elf.c
  3. 1 1
      fs/omfs/bitmap.c
  4. 7 3
      fs/omfs/inode.c
  5. 50 4
      include/trace/events/kmem.h
  6. 1 8
      scripts/gdb/linux/modules.py

+ 0 - 1
MAINTAINERS

@@ -2427,7 +2427,6 @@ L:	linux-security-module@vger.kernel.org
 S:	Supported
 S:	Supported
 F:	include/linux/capability.h
 F:	include/linux/capability.h
 F:	include/uapi/linux/capability.h
 F:	include/uapi/linux/capability.h
-F:	security/capability.c
 F:	security/commoncap.c
 F:	security/commoncap.c
 F:	kernel/capability.c
 F:	kernel/capability.c
 
 

+ 1 - 1
fs/binfmt_elf.c

@@ -918,7 +918,7 @@ static int load_elf_binary(struct linux_binprm *bprm)
 			total_size = total_mapping_size(elf_phdata,
 			total_size = total_mapping_size(elf_phdata,
 							loc->elf_ex.e_phnum);
 							loc->elf_ex.e_phnum);
 			if (!total_size) {
 			if (!total_size) {
-				error = -EINVAL;
+				retval = -EINVAL;
 				goto out_free_dentry;
 				goto out_free_dentry;
 			}
 			}
 		}
 		}

+ 1 - 1
fs/omfs/bitmap.c

@@ -159,7 +159,7 @@ int omfs_allocate_range(struct super_block *sb,
 	goto out;
 	goto out;
 
 
 found:
 found:
-	*return_block = i * bits_per_entry + bit;
+	*return_block = (u64) i * bits_per_entry + bit;
 	*return_size = run;
 	*return_size = run;
 	ret = set_run(sb, i, bits_per_entry, bit, run, 1);
 	ret = set_run(sb, i, bits_per_entry, bit, run, 1);
 
 

+ 7 - 3
fs/omfs/inode.c

@@ -306,7 +306,8 @@ static const struct super_operations omfs_sops = {
  */
  */
 static int omfs_get_imap(struct super_block *sb)
 static int omfs_get_imap(struct super_block *sb)
 {
 {
-	unsigned int bitmap_size, count, array_size;
+	unsigned int bitmap_size, array_size;
+	int count;
 	struct omfs_sb_info *sbi = OMFS_SB(sb);
 	struct omfs_sb_info *sbi = OMFS_SB(sb);
 	struct buffer_head *bh;
 	struct buffer_head *bh;
 	unsigned long **ptr;
 	unsigned long **ptr;
@@ -359,7 +360,7 @@ nomem:
 }
 }
 
 
 enum {
 enum {
-	Opt_uid, Opt_gid, Opt_umask, Opt_dmask, Opt_fmask
+	Opt_uid, Opt_gid, Opt_umask, Opt_dmask, Opt_fmask, Opt_err
 };
 };
 
 
 static const match_table_t tokens = {
 static const match_table_t tokens = {
@@ -368,6 +369,7 @@ static const match_table_t tokens = {
 	{Opt_umask, "umask=%o"},
 	{Opt_umask, "umask=%o"},
 	{Opt_dmask, "dmask=%o"},
 	{Opt_dmask, "dmask=%o"},
 	{Opt_fmask, "fmask=%o"},
 	{Opt_fmask, "fmask=%o"},
+	{Opt_err, NULL},
 };
 };
 
 
 static int parse_options(char *options, struct omfs_sb_info *sbi)
 static int parse_options(char *options, struct omfs_sb_info *sbi)
@@ -548,8 +550,10 @@ static int omfs_fill_super(struct super_block *sb, void *data, int silent)
 	}
 	}
 
 
 	sb->s_root = d_make_root(root);
 	sb->s_root = d_make_root(root);
-	if (!sb->s_root)
+	if (!sb->s_root) {
+		ret = -ENOMEM;
 		goto out_brelse_bh2;
 		goto out_brelse_bh2;
+	}
 	printk(KERN_DEBUG "omfs: Mounted volume %s\n", omfs_rb->r_name);
 	printk(KERN_DEBUG "omfs: Mounted volume %s\n", omfs_rb->r_name);
 
 
 	ret = 0;
 	ret = 0;

+ 50 - 4
include/trace/events/kmem.h

@@ -140,19 +140,42 @@ DEFINE_EVENT(kmem_free, kfree,
 	TP_ARGS(call_site, ptr)
 	TP_ARGS(call_site, ptr)
 );
 );
 
 
-DEFINE_EVENT(kmem_free, kmem_cache_free,
+DEFINE_EVENT_CONDITION(kmem_free, kmem_cache_free,
 
 
 	TP_PROTO(unsigned long call_site, const void *ptr),
 	TP_PROTO(unsigned long call_site, const void *ptr),
 
 
-	TP_ARGS(call_site, ptr)
+	TP_ARGS(call_site, ptr),
+
+	/*
+	 * This trace can be potentially called from an offlined cpu.
+	 * Since trace points use RCU and RCU should not be used from
+	 * offline cpus, filter such calls out.
+	 * While this trace can be called from a preemptable section,
+	 * it has no impact on the condition since tasks can migrate
+	 * only from online cpus to other online cpus. Thus its safe
+	 * to use raw_smp_processor_id.
+	 */
+	TP_CONDITION(cpu_online(raw_smp_processor_id()))
 );
 );
 
 
-TRACE_EVENT(mm_page_free,
+TRACE_EVENT_CONDITION(mm_page_free,
 
 
 	TP_PROTO(struct page *page, unsigned int order),
 	TP_PROTO(struct page *page, unsigned int order),
 
 
 	TP_ARGS(page, order),
 	TP_ARGS(page, order),
 
 
+
+	/*
+	 * This trace can be potentially called from an offlined cpu.
+	 * Since trace points use RCU and RCU should not be used from
+	 * offline cpus, filter such calls out.
+	 * While this trace can be called from a preemptable section,
+	 * it has no impact on the condition since tasks can migrate
+	 * only from online cpus to other online cpus. Thus its safe
+	 * to use raw_smp_processor_id.
+	 */
+	TP_CONDITION(cpu_online(raw_smp_processor_id())),
+
 	TP_STRUCT__entry(
 	TP_STRUCT__entry(
 		__field(	unsigned long,	pfn		)
 		__field(	unsigned long,	pfn		)
 		__field(	unsigned int,	order		)
 		__field(	unsigned int,	order		)
@@ -253,12 +276,35 @@ DEFINE_EVENT(mm_page, mm_page_alloc_zone_locked,
 	TP_ARGS(page, order, migratetype)
 	TP_ARGS(page, order, migratetype)
 );
 );
 
 
-DEFINE_EVENT_PRINT(mm_page, mm_page_pcpu_drain,
+TRACE_EVENT_CONDITION(mm_page_pcpu_drain,
 
 
 	TP_PROTO(struct page *page, unsigned int order, int migratetype),
 	TP_PROTO(struct page *page, unsigned int order, int migratetype),
 
 
 	TP_ARGS(page, order, migratetype),
 	TP_ARGS(page, order, migratetype),
 
 
+	/*
+	 * This trace can be potentially called from an offlined cpu.
+	 * Since trace points use RCU and RCU should not be used from
+	 * offline cpus, filter such calls out.
+	 * While this trace can be called from a preemptable section,
+	 * it has no impact on the condition since tasks can migrate
+	 * only from online cpus to other online cpus. Thus its safe
+	 * to use raw_smp_processor_id.
+	 */
+	TP_CONDITION(cpu_online(raw_smp_processor_id())),
+
+	TP_STRUCT__entry(
+		__field(	unsigned long,	pfn		)
+		__field(	unsigned int,	order		)
+		__field(	int,		migratetype	)
+	),
+
+	TP_fast_assign(
+		__entry->pfn		= page ? page_to_pfn(page) : -1UL;
+		__entry->order		= order;
+		__entry->migratetype	= migratetype;
+	),
+
 	TP_printk("page=%p pfn=%lu order=%d migratetype=%d",
 	TP_printk("page=%p pfn=%lu order=%d migratetype=%d",
 		pfn_to_page(__entry->pfn), __entry->pfn,
 		pfn_to_page(__entry->pfn), __entry->pfn,
 		__entry->order, __entry->migratetype)
 		__entry->order, __entry->migratetype)

+ 1 - 8
scripts/gdb/linux/modules.py

@@ -73,18 +73,11 @@ class LxLsmod(gdb.Command):
                 "        " if utils.get_long_type().sizeof == 8 else ""))
                 "        " if utils.get_long_type().sizeof == 8 else ""))
 
 
         for module in module_list():
         for module in module_list():
-            ref = 0
-            module_refptr = module['refptr']
-            for cpu in cpus.cpu_list("cpu_possible_mask"):
-                refptr = cpus.per_cpu(module_refptr, cpu)
-                ref += refptr['incs']
-                ref -= refptr['decs']
-
             gdb.write("{address} {name:<19} {size:>8}  {ref}".format(
             gdb.write("{address} {name:<19} {size:>8}  {ref}".format(
                 address=str(module['module_core']).split()[0],
                 address=str(module['module_core']).split()[0],
                 name=module['name'].string(),
                 name=module['name'].string(),
                 size=str(module['core_size']),
                 size=str(module['core_size']),
-                ref=str(ref)))
+                ref=str(module['refcnt']['counter'])))
 
 
             source_list = module['source_list']
             source_list = module['source_list']
             t = self._module_use_type.get_type().pointer()
             t = self._module_use_type.get_type().pointer()