* 405 -- a little console help, part 2
@ 2001-11-08 13:36 Mark Pilon
2001-11-08 15:46 ` Mark Hatle
2001-11-08 17:37 ` Scott Anderson
0 siblings, 2 replies; 7+ messages in thread
From: Mark Pilon @ 2001-11-08 13:36 UTC (permalink / raw)
To: linuxppc-embedded
I've got a little more info -- /bin/sash doesn't produce any
output and just sits there, echoing charachters typed. I'll try poking
around w/ gdb/abatron but am not sure how to find the exec'd shell.
if I spawn ash w/ init=/bin/ash:
...
Looking up port of RPC 100003/2 on 192.168.200.4
Looking up port of RPC 100005/1 on 192.168.200.4
VFS: Mounted root (nfs filesystem).
Freeing unused kernel memory: 56k init
executing init = /bin/ash
sh: can't access tty; job control turned off
#
-- but at least I get a prompt and it seems to work.
I'm not sure what the message "can't access tty; job control turned off"
means -- I'll have to get the source for ash and debug it.
I would have thought that spawning init=/bin/sash would have been the
easiest.
the target filesystem is pieces of mvista's hhl2.0 target
for ppc405.
Since I'm nfs mounting it, I'm going to just mount the whole
thing and see if what I need turns up; it'd be nice to know
for those wanting to run a more spare system.
Mark
--
Mark Pilon
Minolta-QMS
P.O. Box 37
Fallon, MT. 59326-0037
1-406-853-0433
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: 405 -- a little console help, part 2
2001-11-08 13:36 405 -- a little console help, part 2 Mark Pilon
@ 2001-11-08 15:46 ` Mark Hatle
2001-11-09 0:44 ` David Gibson
2001-11-08 17:37 ` Scott Anderson
1 sibling, 1 reply; 7+ messages in thread
From: Mark Hatle @ 2001-11-08 15:46 UTC (permalink / raw)
To: Mark Pilon; +Cc: linuxppc-embedded
Mark Pilon wrote:
>
> I've got a little more info -- /bin/sash doesn't produce any
> output and just sits there, echoing charachters typed. I'll try poking
> around w/ gdb/abatron but am not sure how to find the exec'd shell.
>
> if I spawn ash w/ init=/bin/ash:
> ...
> -- but at least I get a prompt and it seems to work.
That is very odd, I don't know why ash would work and sash does not.
Very strange indeed.
> I'm not sure what the message "can't access tty; job control turned off"
> means -- I'll have to get the source for ash and debug it.
This sounds like you do not have proper /dev/* populated.. i.e.
/dev/console, /dev/tty, /dev/pts, etc. For initial system bringup you
can ignore that warning. (However, keep in mind that ctrl-C, ctrl-Z,
etc job control will not work..) This might also partially be a symptom
of ash starting as process 1, process 1 contains special rules in the
kernel as it is the init process.
--Mark
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: 405 -- a little console help, part 2
2001-11-08 13:36 405 -- a little console help, part 2 Mark Pilon
2001-11-08 15:46 ` Mark Hatle
@ 2001-11-08 17:37 ` Scott Anderson
1 sibling, 0 replies; 7+ messages in thread
From: Scott Anderson @ 2001-11-08 17:37 UTC (permalink / raw)
To: Mark Pilon; +Cc: linuxppc-embedded
[-- Attachment #1: .gdbinit --]
[-- Type: application/octet-stream, Size: 5010 bytes --]
set output-radix 16
define task_struct_header
printf "Address pid ST device comm\n"
end
define task_struct_show
printf "0x%08X %5d %2d ", $arg0, $arg0->pid, $arg0->state
if ($arg0->tty)
printf "0x%04X ", $arg0->tty->device
else
printf " "
end
printf "%s\n", $arg0->comm
end
define ps
task_struct_header
task_struct_show current
set $t=current->next_task
while current!=$t
task_struct_show $t
set $t=$t->next_task
end
end
document ps
Print points of interest for all tasks starting at current
end
define task
task_struct_header
set $t=(struct task_struct *)$arg0
task_struct_show $t
end
document task
Print points of interest for the given task_struct
end
define maps
set $t=(struct task_struct *)$arg0
if ($t->mm)
set $m=$t->mm->mmap
while ($m != 0)
printf "0x%08X 0x%08X ", $m->vm_start, $m->vm_end
printf "%c", ($m->vm_flags & 0x01) ? 'r' : '-'
printf "%c", ($m->vm_flags & 0x02) ? 'w' : '-'
printf "%c", ($m->vm_flags & 0x04) ? 'x' : '-'
printf "%c", ($m->vm_flags & 0x80) ? 's' : 'p'
if ($m->vm_file && $m->vm_file->f_dentry)
printf " %s", $m->vm_file->f_dentry->d_name.name
end
printf "\n"
set $m=$m->vm_next
end
else
printf "No mm for task\n"
end
end
document maps
Print the address map for a given task_struct (ala /proc/<pid>/maps)
end
define pgdir
printf "Virtual Physical Flags\n"
set $t=(struct task_struct *)$arg0
if ($t->thread)
set $i=0
set $pgdir=(unsigned long **)$t->thread.pgdir
while ($i < 1024)
if (*$pgdir)
set $j=0
set $pte=(unsigned long *)*$pgdir
while ($j < 1024)
# To see all non-zero entries
# if (*$pte)
# To see _PAGE_PRESENT entries on PPC 4xx
if (*$pte & 0x20)
# To see _PAGE_PRESENT entries on PPC non-4xx
# if (*$pte & 0x1)
printf "0x%08X 0x%08X 0x%03X\n", ($i<<22)|($j<<12), *$pte&~0xFFF, *$pte&0xFFF
end
set $j=$j+1
set $pte=$pte+1
end
end
set $i=$i+1
set $pgdir=$pgdir+1
end
end
end
document pgdir
Print the virtual to physical mappings for a given task_struct's memory
end
define phys
set $t=(struct task_struct *)$arg0
set $virt=(unsigned long)$arg1
set $pgdir=(unsigned long **)$t->thread.pgdir + ($virt>>22)
if (*$pgdir != 0)
set $pte=(unsigned long *)*$pgdir + (($virt>>12)&0x3FF)
if (*$pte != 0)
printf "0x%08X 0x%03X\n", (*$pte&(~0xFFF))|($virt&0xFFF), *$pte&0xFFF
else
printf "No pte for given address\n"
end
else
printf "No pgdir for given address\n"
end
end
document phys
Print the physical address and PTE flags for a given task/address
end
define nip
set $t=(struct task_struct *)$arg0
printf "NIP=0x%08X\n", $t->thread.regs.nip
if ($t->mm)
set $m=$t->mm->mmap
while ($m != 0)
if ($m->vm_start < $t->thread.regs.nip && $t->thread.regs.nip < $m->vm_end)
printf "section: 0x%08X 0x%08X ", $m->vm_start, $m->vm_end
printf "%c", ($m->vm_flags & 0x01) ? 'r' : '-'
printf "%c", ($m->vm_flags & 0x02) ? 'w' : '-'
printf "%c", ($m->vm_flags & 0x04) ? 'x' : '-'
printf "%c", ($m->vm_flags & 0x80) ? 's' : 'p'
if ($m->vm_file && $m->vm_file->f_dentry)
printf " %s", $m->vm_file->f_dentry->d_name.name
end
printf "\noffset=0x%08X\n", $t->thread.regs.nip - $m->vm_start
set $m=0
else
set $m=$m->vm_next
end
end
else
printf "No mm for task\n"
end
end
document nip
Print the next instruction pointer and offset within a
memory mapping for a given task_struct
end
define sp
set $t=(struct task_struct *)$arg0
printf "SP(R1)=0x%08X\n", $t->thread.regs.gpr[1]
if ($t->mm)
set $m=$t->mm->mmap
while ($m != 0)
if ($m->vm_start < $t->thread.regs.gpr[1] && $t->thread.regs.gpr[1] < $m->vm_end)
printf "section: 0x%08X 0x%08X ", $m->vm_start, $m->vm_end
printf "%c", ($m->vm_flags & 0x01) ? 'r' : '-'
printf "%c", ($m->vm_flags & 0x02) ? 'w' : '-'
printf "%c", ($m->vm_flags & 0x04) ? 'x' : '-'
printf "%c", ($m->vm_flags & 0x80) ? 's' : 'p'
if ($m->vm_file && $m->vm_file->f_dentry)
printf " %s", $m->vm_file->f_dentry->d_name.name
end
printf "\noffset=0x%08X\n", $t->thread.regs.gpr[1] - $m->vm_start
set $m=0
else
set $m=$m->vm_next
end
end
else
printf "No mm for task\n"
end
end
document sp
Print the stack pointer and offset within a memory mapping
for a given task_struct
end
define kbt
set $t=(struct task_struct *)$arg0
set $last_ksp=$t
set $ksp=$t->thread.ksp
while ($ksp > $last_ksp && $ksp < $t+8192)
printf "0x%08X: ", $ksp
if (*($ksp+4) > 0xC0000000)
x/1i *($ksp+4)
# list **($ksp+4)
else
printf "0x%08X\n", *($ksp+4)
end
set $ksp=*$ksp
end
end
document kbt
Print the backtrace of a given task_struct's kernel stack
end
[-- Attachment #2: Type: text/plain, Size: 471 bytes --]
On Thursday, November 8, 2001, at 05:36 AM, Mark Pilon wrote:
> I'll try poking
> around w/ gdb/abatron but am not sure how to find the exec'd shell.
I hacked up some user defined functions in gdb to let me do ps
and some other things that I found useful for kernel debugging.
I've attached my .gdbinit so you can see what I did. Warning:
there are some processor specific bits in some of the functions,
but the ps function "should just work".
Scott Anderson
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: 405 -- a little console help, part 2
2001-11-08 15:46 ` Mark Hatle
@ 2001-11-09 0:44 ` David Gibson
2001-11-09 13:40 ` Mark Pilon
0 siblings, 1 reply; 7+ messages in thread
From: David Gibson @ 2001-11-09 0:44 UTC (permalink / raw)
To: linuxppc-embedded
On Thu, Nov 08, 2001 at 09:46:27AM -0600, Mark Hatle wrote:
>
> Mark Pilon wrote:
> >
> > I've got a little more info -- /bin/sash doesn't produce any
> > output and just sits there, echoing charachters typed. I'll try poking
> > around w/ gdb/abatron but am not sure how to find the exec'd shell.
> >
> > if I spawn ash w/ init=/bin/ash:
> > ...
>
> That is very odd, I don't know why ash would work and sash does not.
> Very strange indeed.
Ah, I think I know why this might be - are you using the 2_4_devel
tree?
All static executables segfaulted before reaching main until very
recently: the 4xx's MMU makes it possible to actually enforce the
execute permission bit on pages. Since most processors don't allow
this, however, there are heaps of bugs in userland (binutils etc.)
where pages aren't marked executable that need to be. In this case
there was instruction just before the got that wasn't marked
executable.
For now, at least, I've disabled enforcement of the page execute
permissions, because there's just too much stuff that breaks with it
on.
--
David Gibson | For every complex problem there is a
david@gibson.dropbear.id.au | solution which is simple, neat and
| wrong. -- H.L. Mencken
http://www.ozlabs.org/people/dgibson
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: 405 -- a little console help, part 2
2001-11-09 0:44 ` David Gibson
@ 2001-11-09 13:40 ` Mark Pilon
2001-11-09 13:53 ` David Gibson
0 siblings, 1 reply; 7+ messages in thread
From: Mark Pilon @ 2001-11-09 13:40 UTC (permalink / raw)
To: David Gibson; +Cc: linuxppc-embedded
David Gibson wrote:
>
> Ah, I think I know why this might be - are you using the 2_4_devel
> tree?
>
> All static executables segfaulted before reaching main until very
> recently: the 4xx's MMU makes it possible to actually enforce the
> execute permission bit on pages. Since most processors don't allow
> this, however, there are heaps of bugs in userland (binutils etc.)
> where pages aren't marked executable that need to be. In this case
> there was instruction just before the got that wasn't marked
> executable.
>
> For now, at least, I've disabled enforcement of the page execute
> permissions, because there's just too much stuff that breaks with it
> on.
What's the fix for this? It sounds like I want to un-do that change
enforcing page execute permissions -- David, could you give me
a spot to look and a suggested patch? anyone?
thanks,
Mark
--
Mark Pilon
Minolta-QMS
P.O. Box 37
Fallon, MT. 59326-0037
1-406-853-0433
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: 405 -- a little console help, part 2
2001-11-09 13:40 ` Mark Pilon
@ 2001-11-09 13:53 ` David Gibson
2001-11-11 13:28 ` Jure Menart
0 siblings, 1 reply; 7+ messages in thread
From: David Gibson @ 2001-11-09 13:53 UTC (permalink / raw)
To: linuxppc-embedded
On Fri, Nov 09, 2001 at 06:40:25AM -0700, Mark Pilon wrote:
> David Gibson wrote:
> >
> > Ah, I think I know why this might be - are you using the 2_4_devel
> > tree?
> >
> > All static executables segfaulted before reaching main until very
> > recently: the 4xx's MMU makes it possible to actually enforce the
> > execute permission bit on pages. Since most processors don't allow
> > this, however, there are heaps of bugs in userland (binutils etc.)
> > where pages aren't marked executable that need to be. In this case
> > there was instruction just before the got that wasn't marked
> > executable.
> >
> > For now, at least, I've disabled enforcement of the page execute
> > permissions, because there's just too much stuff that breaks with it
> > on.
>
> What's the fix for this? It sounds like I want to un-do that change
> enforcing page execute permissions -- David, could you give me
> a spot to look and a suggested patch? anyone?
I've checked the fix into the latest linuxppc_2_4_devel. Failing
that, look in do_page_fault() in arch/ppc/mm/fault.c, look for a test
against vma->flags & VM_EXEC, and remove it.
--
David Gibson | For every complex problem there is a
david@gibson.dropbear.id.au | solution which is simple, neat and
| wrong. -- H.L. Mencken
http://www.ozlabs.org/people/dgibson
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: 405 -- a little console help, part 2
2001-11-09 13:53 ` David Gibson
@ 2001-11-11 13:28 ` Jure Menart
0 siblings, 0 replies; 7+ messages in thread
From: Jure Menart @ 2001-11-11 13:28 UTC (permalink / raw)
To: linuxppc-embedded
Hi,
On Sat, Nov 10, 2001 at 12:53:49AM +1100, David Gibson wrote:
> I've checked the fix into the latest linuxppc_2_4_devel. Failing
> that, look in do_page_fault() in arch/ppc/mm/fault.c, look for a test
> against vma->flags & VM_EXEC, and remove it.
>
I've got similiar problem, just that Seg faults form Dynamically linked
programs is just a beginning...
When I boot from ramdisk all programs work fine... aka mount, ls, bash...
but when I try to boot from disk (root=/dev/hda2 for example) my init prints
'Bug in dynamic linker: dynamic-link.h in line 62' (it might be slightly
changed because I wrote it from head, but error describes same informations).
So I checked in glibcs what this error is and I found out that assertion was
caused because of 'bad dynamic tag'.
If I mount disk from ramdisk and try to execute programs the same happens...
if they are dynamically compiled the same bug ('bad dynamic tag') happens.
I use linuxppc_2_4_devel kernel from mvista, daytagged from last wednesday
(7.11.2001), glibcs from HardHat linux (precompiled for IBM 405 gp).
Has anyone same problems? Could it be another bug in standard libarires?
Anywhere else in cross-compiler enviroment... binutils maybe?
Regards, Jure
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2001-11-11 13:28 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-11-08 13:36 405 -- a little console help, part 2 Mark Pilon
2001-11-08 15:46 ` Mark Hatle
2001-11-09 0:44 ` David Gibson
2001-11-09 13:40 ` Mark Pilon
2001-11-09 13:53 ` David Gibson
2001-11-11 13:28 ` Jure Menart
2001-11-08 17:37 ` Scott Anderson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).