linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* NULL-pointer dereference in ELF core dump, and proposed fix
@ 2003-12-23 14:46 John Whitney
  2003-12-24  3:51 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 11+ messages in thread
From: John Whitney @ 2003-12-23 14:46 UTC (permalink / raw)
  To: Mailing List: linuxppc-dev


Hello,

As stated in the subject, I've found a NULL-pointer dereference in the ELF
core dump code path, and wanted comments on my proposed solution.

In fs/binfmt_elf.c, elf_core_dump() calls elf_dump_thread_status().
elf_dump_thread_status calls elf_core_copy_task_fpregs() (elfcore.h), with a
second parameter (struct pt_regs *regs) of NULL.

This inlined routine in turn calls dump_fpu() (arch/ppc/kernel/process.c),
again with a NULL "regs" parameter.

dump_fpu immediately dereferences the regs parameter with the line:

if (regs->msr & MSR_FP)
    giveup_fpu (current);

This, obviously, causes a kernel oops.  My proposed solution to this problem
is to change the above line of code to

if (last_task_used_math == current)
    giveup_fpu (current);

Anyone see any problems with this change?

Thanks,
John Whitney


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: NULL-pointer dereference in ELF core dump, and proposed fix
  2003-12-23 14:46 NULL-pointer dereference in ELF core dump, and proposed fix John Whitney
@ 2003-12-24  3:51 ` Benjamin Herrenschmidt
  2003-12-30  6:34   ` A question on kernel clock: John Zhou
  0 siblings, 1 reply; 11+ messages in thread
From: Benjamin Herrenschmidt @ 2003-12-24  3:51 UTC (permalink / raw)
  To: John Whitney; +Cc: Mailing List: linuxppc-dev


> if (last_task_used_math == current)
>     giveup_fpu (current);
>
> Anyone see any problems with this change?

last_task_used_math doesn't exist on SMP

Ben.


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* A question on kernel clock:
  2003-12-24  3:51 ` Benjamin Herrenschmidt
@ 2003-12-30  6:34   ` John Zhou
  2003-12-30 10:22     ` Wolfgang Denk
  0 siblings, 1 reply; 11+ messages in thread
From: John Zhou @ 2003-12-30  6:34 UTC (permalink / raw)
  To: 'Mailing List: linuxppc-dev'


Dear All,

A question on kernel clock:

Normally, which is kernel clock source? Can we use any one of BRG1-8? Can we use bus clock?	Which is good for choice?

Can anyone give me some suggestions?

Regards,
John

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: A question on kernel clock:
  2003-12-30  6:34   ` A question on kernel clock: John Zhou
@ 2003-12-30 10:22     ` Wolfgang Denk
  2003-12-30 10:45       ` John Zhou
  0 siblings, 1 reply; 11+ messages in thread
From: Wolfgang Denk @ 2003-12-30 10:22 UTC (permalink / raw)
  To: zjzhou; +Cc: 'Mailing List: linuxppc-dev'


Dear John,

in message <000301c3ce9e$ff345440$b702a8c0@newrock2> you wrote:
>
> A question on kernel clock:

I wish you would explain in a bit more detail what you are talking about...

> Normally, which is kernel clock source? Can we use any one of

Normally the kernel clock source is a quartz oscillator.

Or what do you mean? "clock source"  can  mean  different  things  to
different people and may be different on differenrt processors.

The kernel uses the decrementer for the system tick.

> BRG1-8? Can we use bus clock? Which is good for choice?

Use BRG1-8? On which processor? What for?

Good for choice? On which hardware? For which purpose?

> Can anyone give me some suggestions?

Yes: please ask more specific questions.


Best regards, and a Happy New Year!

Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
In general, they do what you want, unless you want consistency.
                                    - Larry Wall in the perl man page

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: A question on kernel clock:
  2003-12-30 10:22     ` Wolfgang Denk
@ 2003-12-30 10:45       ` John Zhou
  2003-12-30 18:49         ` Wolfgang Denk
  0 siblings, 1 reply; 11+ messages in thread
From: John Zhou @ 2003-12-30 10:45 UTC (permalink / raw)
  To: wd; +Cc: 'Mailing List: linuxppc-dev'


Dear Wolfgang,

Thanks very much and Happy New year to you and your family!

I'm sorry for my simple question description.

The processor I mentioned is MPC82xx. Now, I have kernel from kernel.org
run on the board. But, my "nsleep()" is not exactly. So, I want to
realize the timer mechanism of Linux used.

(1) which timer is used for nsleep?

(2) can udelay() be changed to be preempted by other process?

(3) which is good choice for Kernel timeslice?

Additional, could we develop a bootloader like vxworks' bootloader? (
vxworks bootloader is a little vxworks, I think.)

John

-----Original Message-----
From: wd@denx.de [mailto:wd@denx.de]
Sent: Tuesday, December 30, 2003 6:23 PM
Subject: Re: A question on kernel clock:

in message <000301c3ce9e$ff345440$b702a8c0@newrock2> you wrote:
>
> A question on kernel clock:

I wish you would explain in a bit more detail what you are talking
about...

> Normally, which is kernel clock source? Can we use any one of

Normally the kernel clock source is a quartz oscillator.

Or what do you mean? "clock source" can mean different things to
different people and may be different on differenrt processors.

The kernel uses the decrementer for the system tick.

> BRG1-8? Can we use bus clock? Which is good for choice?

Use BRG1-8? On which processor? What for?

Good for choice? On which hardware? For which purpose?

> Can anyone give me some suggestions?

Yes: please ask more specific questions.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: A question on kernel clock:
  2003-12-30 10:45       ` John Zhou
@ 2003-12-30 18:49         ` Wolfgang Denk
  2003-12-30 21:07           ` Dale Harris
                             ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Wolfgang Denk @ 2003-12-30 18:49 UTC (permalink / raw)
  To: zjzhou; +Cc: 'Mailing List: linuxppc-dev'


Dear John,

in message <000501c3cec2$130dbab0$b702a8c0@newrock2> you wrote:
>
> The processor I mentioned is MPC82xx. Now, I have kernel from kernel.org

[I guessed that from the ...BRG8 part.]

> run on the board. But, my "nsleep()" is not exactly. So, I want to
> realize the timer mechanism of Linux used.

> (1) which timer is used for nsleep?

I have not the slightest idea. I don't know of any  standard  funtion
with that name - neither in user space nor in kernel code.

> (2) can udelay() be changed to be preempted by other process?

That makes little sense. If you allow to run other prcesses inbetween
you will have  looong  delays  -  udelay()  was  not  made  for  such
purposes,  but  for  very  short delays (as the name suggests: in the
range of a few microseconds).

> (3) which is good choice for Kernel timeslice?

What's wrong with the standard 10 ms ?

> Additional, could we develop a bootloader like vxworks' bootloader? (
> vxworks bootloader is a little vxworks, I think.)

Of course you can. But what for? If you like the VxWorks boot loader,
then use it. If you like something more powerful, use U-Boot.


Best regards,

Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
This all sounds complicated, but it mostly does excatly what you  ex-
pect. It's just difficult for us to explain what you expect...
                       - L. Wall & R. L. Schwartz, _Programming Perl_

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: A question on kernel clock:
  2003-12-30 18:49         ` Wolfgang Denk
@ 2003-12-30 21:07           ` Dale Harris
  2003-12-30 21:40             ` Wolfgang Denk
  2003-12-31  2:44           ` John Zhou
  2003-12-31  2:44           ` about small dhcp client/server and http client/server John Zhou
  2 siblings, 1 reply; 11+ messages in thread
From: Dale Harris @ 2003-12-30 21:07 UTC (permalink / raw)
  To: 'Mailing List: linuxppc-dev'


On Tue, Dec 30, 2003 at 07:49:46PM +0100, Wolfgang Denk elucidated:
> Dear John,
>
> in message <000501c3cec2$130dbab0$b702a8c0@newrock2> you wrote:
> > (1) which timer is used for nsleep?
>
> I have not the slightest idea. I don't know of any  standard  funtion
> with that name - neither in user space nor in kernel code.
>

Perhaps he means nanosleep().


--
Dale Harris
rodmur@maybe.org
/.-)

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: A question on kernel clock:
  2003-12-30 21:07           ` Dale Harris
@ 2003-12-30 21:40             ` Wolfgang Denk
  2003-12-31  4:15               ` John Zhou
  0 siblings, 1 reply; 11+ messages in thread
From: Wolfgang Denk @ 2003-12-30 21:40 UTC (permalink / raw)
  To: Dale Harris; +Cc: 'Mailing List: linuxppc-dev'


In message <20031230210713.GC5005@maybe.org> you wrote:
>
> > > (1) which timer is used for nsleep?
> >
> > I have not the slightest idea. I don't know of any  standard  funtion
> > with that name - neither in user space nor in kernel code.
>
> Perhaps he means nanosleep().

Perhaps. But then the definition of nanosleep()  says  that  it  will
cause  a  delay  of  "at least the time specified in *req", i. e. the
upper bound is not even specified. But the  OP  seemed  to  assume  a
strict timing, so maybe it was yet another function.

Best regards, and a Happy New Year!

Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
Old programmers never die, they just become managers.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: A question on kernel clock:
  2003-12-30 18:49         ` Wolfgang Denk
  2003-12-30 21:07           ` Dale Harris
@ 2003-12-31  2:44           ` John Zhou
  2003-12-31  2:44           ` about small dhcp client/server and http client/server John Zhou
  2 siblings, 0 replies; 11+ messages in thread
From: John Zhou @ 2003-12-31  2:44 UTC (permalink / raw)
  To: 'Wolfgang Denk'; +Cc: 'Mailing List: linuxppc-dev', rodmur


Thanks a lot!

I means nanosleep() function.

Best Regards,
John

> (1) which timer is used for nsleep?

> I have not the slightest idea. I don't know of any  standard  funtion
> with that name - neither in user space nor in kernel code.


-----Original Message-----
From: owner-linuxppc-dev@lists.linuxppc.org
[mailto:owner-linuxppc-dev@lists.linuxppc.org]On Behalf Of Wolfgang Denk
Sent: Wednesday, December 31, 2003 2:50 AM
To: zjzhou@newrocktech.com
Cc: 'Mailing List: linuxppc-dev'
Subject: Re: A question on kernel clock:



Dear John,

in message <000501c3cec2$130dbab0$b702a8c0@newrock2> you wrote:
>
> The processor I mentioned is MPC82xx. Now, I have kernel from kernel.org

[I guessed that from the ...BRG8 part.]

> run on the board. But, my "nsleep()" is not exactly. So, I want to
> realize the timer mechanism of Linux used.

> (1) which timer is used for nsleep?

I have not the slightest idea. I don't know of any  standard  funtion
with that name - neither in user space nor in kernel code.

> (2) can udelay() be changed to be preempted by other process?

That makes little sense. If you allow to run other prcesses inbetween
you will have  looong  delays  -  udelay()  was  not  made  for  such
purposes,  but  for  very  short delays (as the name suggests: in the
range of a few microseconds).

> (3) which is good choice for Kernel timeslice?

What's wrong with the standard 10 ms ?

> Additional, could we develop a bootloader like vxworks' bootloader? (
> vxworks bootloader is a little vxworks, I think.)

Of course you can. But what for? If you like the VxWorks boot loader,
then use it. If you like something more powerful, use U-Boot.


Best regards,

Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
This all sounds complicated, but it mostly does excatly what you  ex-
pect. It's just difficult for us to explain what you expect...
                       - L. Wall & R. L. Schwartz, _Programming Perl_


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* about small dhcp client/server and http client/server
  2003-12-30 18:49         ` Wolfgang Denk
  2003-12-30 21:07           ` Dale Harris
  2003-12-31  2:44           ` John Zhou
@ 2003-12-31  2:44           ` John Zhou
  2 siblings, 0 replies; 11+ messages in thread
From: John Zhou @ 2003-12-31  2:44 UTC (permalink / raw)
  To: 'Mailing List: linuxppc-dev'


Hi All,

I searched small dhcp client/server and http client/server on www.google.com. so many information to be chose. udhcp,dhcpcd-1.3.22-pl4, .... boa, wget,....

But, does anybody give me some suggestion which is good for choice? My system is run Linux kernel 2.4 based on MPC8260.

I think udhcp and boa may be good for embedded system. How do you think?

Best Regards,
John

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: A question on kernel clock:
  2003-12-30 21:40             ` Wolfgang Denk
@ 2003-12-31  4:15               ` John Zhou
  0 siblings, 0 replies; 11+ messages in thread
From: John Zhou @ 2003-12-31  4:15 UTC (permalink / raw)
  To: 'Wolfgang Denk', 'Dale Harris'
  Cc: 'Mailing List: linuxppc-dev'


Sorry! It should be usleep() used in user space!

Best Regards,
John

> run on the board. But, my "nsleep()" is not exactly. So, I want to
> realize the timer mechanism of Linux used.

> (1) which timer is used for nsleep?

I have not the slightest idea. I don't know of any  standard  funtion
with that name - neither in user space nor in kernel code.

-----Original Message-----
From: Wolfgang Denk
Sent: Wednesday, December 31, 2003 5:41 AM
Subject: Re: A question on kernel clock:

In message <20031230210713.GC5005@maybe.org> you wrote:
>
> > > (1) which timer is used for nsleep?
> >
> > I have not the slightest idea. I don't know of any standard funtion
> > with that name - neither in user space nor in kernel code.
>
> Perhaps he means nanosleep().

Perhaps. But then the definition of nanosleep() says that it will cause
a delay of "at least the time specified in *req", i. e. the upper bound
is not even specified. But the OP seemed to assume a strict timing, so
maybe it was yet another function.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2003-12-31  4:15 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-23 14:46 NULL-pointer dereference in ELF core dump, and proposed fix John Whitney
2003-12-24  3:51 ` Benjamin Herrenschmidt
2003-12-30  6:34   ` A question on kernel clock: John Zhou
2003-12-30 10:22     ` Wolfgang Denk
2003-12-30 10:45       ` John Zhou
2003-12-30 18:49         ` Wolfgang Denk
2003-12-30 21:07           ` Dale Harris
2003-12-30 21:40             ` Wolfgang Denk
2003-12-31  4:15               ` John Zhou
2003-12-31  2:44           ` John Zhou
2003-12-31  2:44           ` about small dhcp client/server and http client/server John Zhou

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).