2013-04-09 13:06:43

by Sedat Dilek

[permalink] [raw]
Subject: kdb: kgdb: CONFIG_DEBUG_RODATA setting?

>From [1]:

"If the architecture that you are using supports the kernel option
CONFIG_DEBUG_RODATA, you should consider turning it off. This option
will prevent the use of software breakpoints because it marks certain
regions of the kernel's memory space as read-only. If kgdb supports it
for the architecture you are using, you can use hardware breakpoints
if you desire to run with the CONFIG_DEBUG_RODATA option turned on,
else you need to turn off this option."

"Here is an example set of .config symbols to enable or disable for kgdb:

# CONFIG_DEBUG_RODATA is not set

CONFIG_FRAME_POINTER=y

CONFIG_KGDB=y

CONFIG_KGDB_SERIAL_CONSOLE=y
".

I am here on x86-64 and CONFIG_DEBUG_RODATA is always "=y" in
Linux-Next due to...


[ arch/x86/Kconfig.debug ]

config DEBUG_RODATA
bool "Write protect kernel read-only data structures"
default y
depends on DEBUG_KERNEL


So, is this setting now obsolete (means [1] not up2date?).
( See also my patch. )

Kind Regards,
- Sedat -

[1] https://www.kernel.org/pub/linux/kernel/people/jwessel/kdb/CompilingAKernel.html#CompileKGDB


Attachments:
0001-kdb-kgdb-x86-Unset-DEBUG_RODATA-when-KGDB.patch (1.37 kB)
config-3.9.0-rc6-next20130409-1-iniza-small (109.48 kB)
Download all attachments

2013-04-09 14:15:12

by Jason Wessel

[permalink] [raw]
Subject: Re: kdb: kgdb: CONFIG_DEBUG_RODATA setting?

On 04/09/2013 08:06 AM, Sedat Dilek wrote:

> config DEBUG_RODATA
> bool "Write protect kernel read-only data structures"
> - default y
> depends on DEBUG_KERNEL
> + default n if KGDB
> + default y
> ---help---
> Mark the kernel read-only data as write-protected in the pagetables,
> in order to catch accidental (and incorrect) writes to such const


This is wrong and should not be merged.

A) You should not change these defaults in this manner

B) You have pointed out that the documentation is currently
incorrect. The CONFIG_DEBUG_RODATA constraints were removed some time
ago, per commit 3751d3e85cf693e10e2c47c03c8caa65e171099b (x86,kgdb:
Fix DEBUG_RODATA limitation using text_poke())

Jason.

2013-04-09 14:26:42

by Sedat Dilek

[permalink] [raw]
Subject: Re: kdb: kgdb: CONFIG_DEBUG_RODATA setting?

On Tue, Apr 9, 2013 at 4:14 PM, Jason Wessel <[email protected]> wrote:
> On 04/09/2013 08:06 AM, Sedat Dilek wrote:
>
>> config DEBUG_RODATA
>> bool "Write protect kernel read-only data structures"
>> - default y
>> depends on DEBUG_KERNEL
>> + default n if KGDB
>> + default y
>> ---help---
>> Mark the kernel read-only data as write-protected in the pagetables,
>> in order to catch accidental (and incorrect) writes to such const
>
>
> This is wrong and should not be merged.
>
> A) You should not change these defaults in this manner
>
> B) You have pointed out that the documentation is currently
> incorrect. The CONFIG_DEBUG_RODATA constraints were removed some time
> ago, per commit 3751d3e85cf693e10e2c47c03c8caa65e171099b (x86,kgdb:
> Fix DEBUG_RODATA limitation using text_poke())
>

OK (B) has to be changed then.
I had a look at the new WIKI [1] and FAQ [2].

The new FAQ does not list any recommended kconfig-settings.
This is what I have:

$ egrep -i 'kdb|kgdb|debug_rodata|early_printk|frame_pointer' .config
CONFIG_SCHED_OMIT_FRAME_POINTER=y
CONFIG_SERIAL_KGDB_NMI=y
CONFIG_ARCH_WANT_FRAME_POINTERS=y
CONFIG_FRAME_POINTER=y
CONFIG_HAVE_ARCH_KGDB=y
CONFIG_KGDB=y
CONFIG_KGDB_SERIAL_CONSOLE=y
# CONFIG_KGDB_TESTS is not set
CONFIG_KGDB_LOW_LEVEL_TRAP=y
CONFIG_KGDB_KDB=y
CONFIG_KDB_KEYBOARD=y
CONFIG_KDB_CONTINUE_CATASTROPHIC=0
CONFIG_EARLY_PRINTK=y
CONFIG_EARLY_PRINTK_DBGP=y
CONFIG_DEBUG_RODATA=y
# CONFIG_DEBUG_RODATA_TEST is not set

OK? Sth. missing?

Booting with...

*** Configure kdb for early debugging: earlyprintk=vga ekgdboc=kbd ***

...shows me nothing here.

Might be the problem in Linux-Next [3,4] is not triggable with kdb/kgdb.

Thanks for your help in advance.

Regards,
- Sedat -

[1] https://kgdb.wiki.kernel.org/index.php/Main_Page
[2] https://kgdb.wiki.kernel.org/index.php/KDB_FAQ
[3] http://marc.info/?t=136545603700003&r=1&w=2
[4] http://marc.info/?t=136545773000008&r=1&w=2


> Jason.
>