* favourite vfs globals
@ 2003-11-28 21:05 Pat LaVarre
2003-11-28 21:22 ` Pat LaVarre
0 siblings, 1 reply; 5+ messages in thread
From: Pat LaVarre @ 2003-11-28 21:05 UTC (permalink / raw)
To: linux-fsdevel
Which vfs globals are the most fun, in lk like 2.6.0-test11?
Pat LaVarre
P.S. I ask because:
> From: http://marc.theaimsgroup.com/?l=linux-fsdevel&m=107004461717172
> Subject: Re: zeroes read back more often than appended
> Date: 2003-11-28 18:29:39
>
> CONFIG_DEBUG_KERNEL=y
> CONFIG_DEBUG_INFO=y
> CONFIG_DEBUG_SLAB=y
> CONFIG_MAGIC_SYSRQ=y
gdb vmlinux /proc/kcore
indeed does let me print globals that make some kind of sense.
Specifically on my own in stunning ignorance, I notice Six things:
1) `?` suggests `help`.
2) `help` suggests `info variables`.
3) `info variables` takes minutes to complete, but writes its list out
thru tee if first you thought to tee your sudo'ed gdb.
4) `info variables vfs` completes much more quickly.
5) `print xtime` returns the same result til you `quit` and re-enter
gdb, also that result appears in between what `date +'%s %N'` prints
before and after, suggesting that this approach to gdb takes a blurry
snapshot of kernel memory and then walks us thru a stale copy of all the
bits.
6) Substituting /dev/kmem for /proc/kcore prints zero for xtime,
suggesting sym table addresses somehow not sync'ed with physical memory
in that abuse.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: favourite vfs globals
2003-11-28 21:05 favourite vfs globals Pat LaVarre
@ 2003-11-28 21:22 ` Pat LaVarre
2003-11-28 21:43 ` Pat LaVarre
0 siblings, 1 reply; 5+ messages in thread
From: Pat LaVarre @ 2003-11-28 21:22 UTC (permalink / raw)
To: linux-fsdevel
> Which vfs globals are the most fun, in lk like 2.6.0-test11?
That question I can't yet answer, but:
> gdb vmlinux /proc/kcore
> ... this approach to gdb takes a blurry snapshot of kernel memory and
> then walks us thru a stale copy of all the bits.
Also I suppose we can't see the global variables of modules this way,
except when the modules share those variables with non-module code i.e.
code linked into the kernel before boot. I'm guessing wildly from
experiences like the following.
(gdb) info variables scsi_comm
All variables matching regular expression "scsi_comm":
File drivers/block/scsi_ioctl.c:
const unsigned char scsi_command_size[8];
static const char __kstrtab_scsi_command_size[18];
static const struct kernel_symbol __ksymtab_scsi_command_size;
(gdb) #
(gdb) print /x scsi_command_size
$2 = {0x6, 0xa, 0xa, 0xc, 0x10, 0xc, 0xa, 0xa}
(gdb) #
(gdb) file /lib/modules/2.6.0-11.udf/kernel/drivers/scsi/scsi_mod.ko
warning: core file may not match specified executable file.
Load new symbol table from
"/lib/modules/2.6.0-11.udf/kernel/drivers/scsi/scsi_mod.ko"? (y or n) y
Reading symbols from
/lib/modules/2.6.0-11.udf/kernel/drivers/scsi/scsi_mod.ko...done.
(gdb) #
(gdb) info variables xtime
...
(gdb) print xtime
Address of symbol "xtime" is unknown.
(gdb) #
(gdb) info variables scsi_command_size
...
(gdb) print scsi_command_size
Address of symbol "scsi_command_size" is unknown.
(gdb) #
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: favourite vfs globals
2003-11-28 21:22 ` Pat LaVarre
@ 2003-11-28 21:43 ` Pat LaVarre
2003-11-28 21:51 ` Pat LaVarre
0 siblings, 1 reply; 5+ messages in thread
From: Pat LaVarre @ 2003-11-28 21:43 UTC (permalink / raw)
To: linux-fsdevel
> > Which vfs globals are the most fun, in lk like 2.6.0-test11?
"That question I can't yet answer, but":
> > gdb vmlinux /proc/kcore
> > ... this approach to gdb takes a blurry snapshot of kernel memory and
> > then walks us thru a stale copy of all the bits.
>
> ... we ... see the global variables of modules this way,
> ... when the modules share those variables with non-module code i.e.
> code linked into the kernel before boot.
I see directly adding a global to a module does not work:
MODPOST
*** Warning: "hello_gdb" [fs/udf/udf.ko] undefined!
Ouch.
I'll go ask the kernelnewbies list to comment.
Pat LaVarre
diff -Nur linux-2.6.0-test11/drivers/block/ll_rw_blk.c linux/drivers/block/ll_rw_blk.c
--- linux-2.6.0-test11/drivers/block/ll_rw_blk.c 2003-11-26 13:42:58.000000000 -0700
+++ linux/drivers/block/ll_rw_blk.c 2003-11-28 14:29:53.613346536 -0700
@@ -2445,6 +2445,9 @@
}
}
+extern int hello_gdb;
+int hello_gdb = 'P';
+
static int __end_that_request_first(struct request *req, int uptodate,
int nr_bytes)
{
diff -Nur linux-2.6.0-test11/fs/udf/super.c linux/fs/udf/super.c
--- linux-2.6.0-test11/fs/udf/super.c 2003-11-26 13:44:41.000000000 -0700
+++ linux/fs/udf/super.c 2003-11-28 14:25:31.248232096 -0700
@@ -189,10 +189,15 @@
struct nls_table *nls_map;
};
+extern int hello_gdb;
+
static int __init init_udf_fs(void)
{
int err;
printk(KERN_NOTICE "udf: registering filesystem\n");
+ printk(KERN_NOTICE "udf: before incrementing hello_gdb\n");
+ ++hello_gdb;
+ printk(KERN_NOTICE "udf: after incrementing hello_gdb\n");
err = init_inodecache();
if (err)
goto out1;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: favourite vfs globals
2003-11-28 21:43 ` Pat LaVarre
@ 2003-11-28 21:51 ` Pat LaVarre
2003-11-28 22:42 ` Pat LaVarre
0 siblings, 1 reply; 5+ messages in thread
From: Pat LaVarre @ 2003-11-28 21:51 UTC (permalink / raw)
To: linux-fsdevel
> > > Which vfs globals are the most fun, in lk like 2.6.0-test11?
"That question I can't yet answer, but":
> > > ... we ... see the global variables of modules ...
> > ... when the modules share those variables with non-module code
> ...
> I see directly adding a global to a module does not work:
>
> MODPOST
> *** Warning: "hello_gdb" [fs/udf/udf.ko] undefined!
>
> Ouch.
>
> I'll go ask the kernelnewbies list to comment.
Ouch, I speak and only then do I remember finally now where I saw this
working before. Not in drivers/usb/storage but rather in scsi/ e.g.
http://lxr.linux.no/ident?v=2.6.0-test7;i=scsi_command_size
yields:
http://lxr.linux.no/source/drivers/block/scsi_ioctl.c?v=2.6.0-test7#L530
i.e. the use of such std. C extensions as:
EXPORT_SYMBOL(scsi_command_size);
Pat LaVarre
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: favourite vfs globals
2003-11-28 21:51 ` Pat LaVarre
@ 2003-11-28 22:42 ` Pat LaVarre
0 siblings, 0 replies; 5+ messages in thread
From: Pat LaVarre @ 2003-11-28 22:42 UTC (permalink / raw)
To: linux-fsdevel
> > > > Which vfs globals are the most fun, in lk like 2.6.0-test11?
"That question I can't yet answer, but":
> > > > ... we ... see the global variables of modules ...
> > > ... when the modules share those variables with non-module code
Success! Thanks again for the hints.
(gdb) print /x udf_gdb
$1 = 0xcafefacf
(gdb) #
(gdb) print udf_gdb_fstype
$3 = (struct file_system_type *) 0xdf9639c0
(gdb) #
(gdb) print *udf_gdb_fstype
$4 = {name = 0xdf95fc65 "udf", fs_flags = 1, get_sb = 0xdf9592d4,
kill_sb = 0xc0153d9c <kill_block_super>, owner = 0xdf963e80, next = 0x0,
fs_supers = {next = 0xd5fa7d5c, prev = 0xd5fa7d5c}}
(gdb)
diff -Nur linux-2.6.0-test11/fs/udf/super.c linux/fs/udf/super.c
--- linux-2.6.0-test11/fs/udf/super.c 2003-11-26 13:44:41.000000000 -0700
+++ linux/fs/udf/super.c 2003-11-28 15:23:55.000000000 -0700
@@ -189,10 +189,19 @@
struct nls_table *nls_map;
};
+extern int udf_gdb;
+extern struct file_system_type * udf_gdb_fstype;
+
static int __init init_udf_fs(void)
{
int err;
printk(KERN_NOTICE "udf: registering filesystem\n");
+
+ printk(KERN_NOTICE "udf: before incrementing hello_gdb\n");
+ udf_gdb_fstype = &udf_fstype;
+ ++udf_gdb;
+ printk(KERN_NOTICE "udf: after incrementing hello_gdb\n");
+
err = init_inodecache();
if (err)
goto out1;
diff -Nur linux-2.6.0-test11/drivers/block/scsi_ioctl.c linux/drivers/block/scsi_ioctl.c
diff -Nur linux-2.6.0-test11/drivers/block/ll_rw_blk.c linux/drivers/block/ll_rw_blk.c
--- linux-2.6.0-test11/drivers/block/ll_rw_blk.c 2003-11-26 13:42:58.000000000 -0700
+++ linux/drivers/block/ll_rw_blk.c 2003-11-28 15:24:06.000000000 -0700
@@ -2445,6 +2445,11 @@
}
}
+int udf_gdb = 0xCAFEFACE;
+struct file_system_type * udf_gdb_fstype;
+EXPORT_SYMBOL(udf_gdb);
+EXPORT_SYMBOL(udf_gdb_fstype);
+
static int __end_that_request_first(struct request *req, int uptodate,
int nr_bytes)
{
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2003-11-28 22:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-28 21:05 favourite vfs globals Pat LaVarre
2003-11-28 21:22 ` Pat LaVarre
2003-11-28 21:43 ` Pat LaVarre
2003-11-28 21:51 ` Pat LaVarre
2003-11-28 22:42 ` Pat LaVarre
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox