Re: [git pull] kgdb light, v5

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Linus Torvalds <torvalds@...>
Cc: Jan Kiszka <jan.kiszka@...>, Ray Lee <ray-lk@...>, Sam Ravnborg <sam@...>, <linux-kernel@...>, Andrew Morton <akpm@...>, Thomas Gleixner <tglx@...>, Jason Wessel <jason.wessel@...>
Date: Sunday, February 10, 2008 - 4:29 pm

* Linus Torvalds <torvalds@linux-foundation.org> wrote:


ok, on a second thought: kgdb_{get|set}_mem() is _only_ used to validate 
and set the software breakpoint (int3). And i think kgdb correctly 
restricts that to kernel-space addresses only - you can typo an address 
down into user-space and overwrite user-space memory and not know what 
hit you ... [you can still explicitly touch user-space memory, but that 
has to be done intentionally]

So to reduce the confusion i've removed these functions and open-coded 
the probe_kernel_*() functions into kgdb_validate_break_address() and 
kgdb_arch_set_breakpoint().

all other places already use probe_kernel_{read|write}. (Now, there are 
a few stray TASK_SIZE checks still, i'll double check them and convert 
them to access_ok() checks.)

btw., based on your previous comment about alignment, i found another 
function that used weird alignment checks, kgdb_hex2mem():

	if (count == 2 && ((long)mem & 1) == 0)
		err = probe_kernel_write(mem, tmp_raw, 2);
	else if (count == 4 && ((long)mem & 3) == 0)
		err = probe_kernel_write(mem, tmp_raw, 4);
	else if (count == 8 && ((long)mem & 7) == 0)
		err = probe_kernel_write(mem, tmp_raw, 8);
	else
		err = probe_kernel_write(mem, tmp_raw, count);

	return err;
}

I just converted it to:

	return probe_kernel_write(mem, tmp_raw, count);

which looks _a lot_ cleaner.

	Ingo
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[0/6] kgdb light, Ingo Molnar, (Sun Feb 10, 3:13 am)
Re: [0/6] kgdb light, Sam Ravnborg, (Sun Feb 10, 6:47 am)
[git pull] kgdb light, v5, Ingo Molnar, (Sun Feb 10, 12:36 pm)
Re: [git pull] kgdb light, v5, Sam Ravnborg, (Sun Feb 10, 3:34 pm)
Re: [git pull] kgdb light, v5, Ray Lee, (Sun Feb 10, 1:30 pm)
Re: [git pull] kgdb light, v5, Jan Kiszka, (Sun Feb 10, 2:53 pm)
Re: [git pull] kgdb light, v5, Linus Torvalds, (Sun Feb 10, 3:44 pm)
Re: [git pull] kgdb light, v5, Ingo Molnar, (Sun Feb 10, 4:29 pm)
Re: [git pull] kgdb light, v5, Ingo Molnar, (Sun Feb 10, 4:41 pm)
Re: [git pull] kgdb light, v5, Jan Kiszka, (Sun Feb 10, 4:22 pm)
Re: [git pull] kgdb light, v5, Ingo Molnar, (Sun Feb 10, 5:13 pm)
Re: [git pull] kgdb light, v5, Ingo Molnar, (Sun Feb 10, 4:19 pm)
Re: [git pull] kgdb light, v5, Ingo Molnar, (Sun Feb 10, 3:34 pm)
Re: [git pull] kgdb light, v5, Jan Kiszka, (Sun Feb 10, 1:39 pm)
Re: [git pull] kgdb light, v5, Ray Lee, (Sun Feb 10, 2:59 pm)
Re: [0/6] kgdb light, Jan Kiszka, (Sun Feb 10, 9:25 am)
Re: [0/6] kgdb light, Sam Ravnborg, (Sun Feb 10, 3:31 pm)
Re: [0/6] kgdb light, Ingo Molnar, (Sun Feb 10, 5:16 pm)
Re: [0/6] kgdb light, Sam Ravnborg, (Sun Feb 10, 5:30 pm)
Re: [0/6] kgdb light, Ingo Molnar, (Sun Feb 10, 5:34 pm)
Re: [0/6] kgdb light, Jan Kiszka, (Sun Feb 10, 4:23 pm)
Re: [0/6] kgdb light, David Miller, (Sun Feb 10, 3:37 am)