What does the linux page address '0xdead0000~~' mean? - linux

I used kgdb to debug linux kernel and print *page.
The result shows some addresses started with '0xdead'
Like, {lru = {next = 0xdead000000000100, prev = 0xdead000000000122},
0xdead pages
What those pages mean? a NULL page? or something meaningful?
Thank you.

These pointers are poison constants. They are set to next and previous when a list entry is removed from the list. See list_del().

Related

^HV Only returning some values

I'm trying to print some RFID tags and retrieve their TIDs to store them in my system and know which tags have been printed. Right now I'm reading the TID and sending it back to my computer (connected via USB with the my ZT421 printer) with the following code:
^RFR,H,0,12,2^FN0^FS^FH_^HV0,24,,_0D_0A,L^FS
^RFW,H,2,12,1^FD17171999ABABABAAAAAAAAAB^FS
This is repeated for each tag that I'm printing. However, when printing 10 tags, I only get 9 TIDs. If after that I try to print 7 tags, I still get 9 TIDs. To be honest I'm a bit lost now, because even trying to use the code examples from the ZPL manual (I've tried the ^RI instruction also) it doesn't seem to work.
The communication with the printer is beeing done through Zebra Setup Utilities' direct communication tool.
I tried to retrieve each printed tag TID with:
^RFR,H,0,12,2^FN0^FS^FH_^HV0,24,,_0D_0A,L^FS
^RFW,H,2,12,1^FD17171999ABABABAAAAAAAAAB^FS
but I always get 9 TIDs.
I also tried getting the TID with the ZPL manual example for the ^RI command:
^XA
^FO20,120^A0N,60^FN0^FS
^RI0,,5^FS
^HV0,,Tag ID:^FS
^XZ
And I got absolutely nothing returned to the computer, just a mssage saying "Tag ID:" and no value shown.
I would really appreciate some help with this...
Thanks in advance!
I've fixed the issue, but I'm going to leave the solution here just in case someone else is facing the same problem.
I thought that maybe it wasn't a code issue, but something related to the computer-printer communication. It turned out to be the case. The Zebra Setup Utilities program has a button that says "options". If you click it, a new screen will open and there you can configure the seconds that the program will wait for the printer response (in this case through USB). By default it's set to 5, i changed this value to 100, which is the maximum. This meant that instead of just printing and retrieving the TIDs of 6-9 tags, now I can do it for about 100.
This is not amazing because in my case it implied creating 25 files for the 2500 tags I had to print and store the TIDs, however it's far better than before.

Do I need to create my own virtual ttys with n_gsm line discipline?

There are a few "how to" pages that give instructions on using n_gsm line discipline, including this one, which comes from the tome of Linux kernel knowledge. On that page, step 4 give instructions on how to create virtual serial ports, which I did when I first started using n_gsm. However, I've noticed that when I enable n_gsm line dicipline with the following code:
int ldisc = N_GSM0710;
struct gsm_config gsm;
ioctl(_fd, TIOCSETD, &ldisc);
ioctl(_fd, GSMIOC_GETCONF, &gsm);
gsm.initiator = 1;
gsm.encapsulation = 0;
gsm.mru = 121;
gsm.mtu = 121;
ioctl(_fd, GSMIOC_SETCONF, &gsm);
A whole bunch of gsmtty's show up in /dev, (i.e. /dev/gsmtty[1-63]) and disappear when my program exits (clears n_gsm line discipline).
So is it necessary to create my own virtual serial ports or can I use these gsmtty* ports? Also, I seem to recall reading that there is something special about /dev/gsmtty1, but I can't find the page. Is there something special about gsmtty1?
Thanks

gdb backtrace by walking frame pointers

Sometimes there is some small stack corruption that causes gdb to fail doing a "backtrace", I have created the below gdb macro (x86-64, can be easily made to work for x86) that depends on turning off omit-frame-pointer (i.e. -fno-omit-frame-pointer) and shows me the functions in the backtrace. However, I'd like it to also show parameter values and ideally be able to select one of these frames. (i.e. something such as "frame 0x0123456789ABCDEF").
define et
set $frameptr = $rbp
while $frameptr != 0
set $oldbp = *((void**)($frameptr+8))
print $frameptr
print $oldbp
info symbol $oldbp
set $frameptr = *((void**)($frameptr))
end
end

How can I find the pages that belong to the heap in a linux process?

I would like to write a simple kernel function that iterates over all the vm_area_structs that belong to a specific process and mark each one of them as belonging to the heap or not. Assume that I can add a boolean field in the vm_area_struct that will be set for heap pages and reset for other pages.
I have looked into the mm_struct, vm_area_struct, and task_struct... but found nothing that can help.
Update: I am guessing start_brk and brk have something to do with this?
(Am inserting my last comment as an answer, as the formatting within "Comment" is not that great):
Wrt my prev comment: the relevant code (to look up VMAs of a given PID) seems to be here: fs/proc/task_mmu.c .
And, yes indeed, the "[heap]" is marked by this code snippet from the above src file (kernel ver 3.10.24):
*fs/proc/task_mmu.c:show_map_vma()*
...
if (vma->vm_start <= mm->brk &&
vma->vm_end >= mm->start_brk) {
name = "[heap]";
goto done; }
...

Find the value for the address in GDB (Cent OS 6)

For analysis purpose we want to know the which data(message) is stored in the address. Is there any option to find the message in GDB.
In the other words we know the address (0x80488b4) of memory but we want also know the message stored in that address through GDB.
Sample code :
(gdb) print option_value
$1 = (const void *) 0x80488b4
If you know the type typemsg_tof the message, you could dereference it, e.g. print *(typemsg_t*) option_value
You might also be interested by the GDB watchpoint ability.
It is worth taking some time to read GDB documentation !
What is "the message"? You can of course examine the contents of memory at that address, using gdb's x (for examine) command:
(gdb) x option_value
If you know that option_value, despite looking like a const void * in the current scope, is really of some other type, you can cast and dereference:
(gdb) print *(MessageType *) option_value

Resources