Re: [PATCH] Kprobes: Verify probepoint in register_jprobe()

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

 



Luca Falavigna wrote:
[...]
 int register_jprobe(struct jprobe *jp)
 {
-	/* Todo: Verify probepoint is a function entry point */
+	unsigned long size, offset;
+	char *modname, namebuf[KSYM_NAME_LEN+1];
+	
+	kallsyms_lookup((unsigned long)jp->kp.addr, &size,
+			&offset, &modname, namebuf);
+	
+	if(unlikely(offset))
+		return -EINVAL;

Hmmm, kallsyms_lookup might return NULL if either the address is not found or CONFIG_KALLSYMS is not set, and in this case "offset" is not initialized at all before this test.

We should either fail in this case, or accept the address as valid without confirmation. I don't have sufficient knowledge about kprobes to advise either way, but a test should be made nevertheless (or we could just initialize "offset" to 0, if we want to accept the address without confirmation).

--
Paulo Marques - www.grupopie.com

It is a mistake to think you can solve any major problems
just with potatoes.
Douglas Adams
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux