NULL-pointer dereference in ELF core dump, and proposed fix
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/
Quoted 5 lines
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/
A question on kernel clock:
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/
Re: A question on kernel clock:
Dear John,
Quoted 2 lines · 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...
Quoted 1 line
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.
Quoted 1 line
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?
Quoted 1 line
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: [email protected] 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/
RE: A question on kernel clock:
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: [email protected] [mailto:[email protected]]
Sent: Tuesday, December 30, 2003 6:23 PM
Subject: Re: A question on kernel clock:
Quoted 2 lines · 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...
Quoted 1 line
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.
Quoted 1 line
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?
Quoted 1 line
Can anyone give me some suggestions?
Yes: please ask more specific questions.
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
Re: A question on kernel clock:
Dear John,
Quoted 2 lines · 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.]
Quoted 4 lines
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.
Quoted 1 line
(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).
Quoted 1 line
(3) which is good choice for Kernel timeslice?
What's wrong with the standard 10 ms ?
Quoted 2 lines
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: [email protected] 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/
Re: A question on kernel clock:
On Tue, Dec 30, 2003 at 07:49:46PM +0100, Wolfgang Denk elucidated:
Quoted 8 lines
Dear John,
Quoted 1 line · 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
[email protected]
/.-)
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
Re: A question on kernel clock:
Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 5 lines
Quoted 2 lines
(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: [email protected] Old programmers never die, they just become managers.
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
RE: A question on kernel clock:
Sorry! It should be usleep() used in user space!
Best Regards,
John
Quoted 4 lines
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:
Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 5 lines
Quoted 2 lines
(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/
RE: A question on kernel clock:
In reply to Wolfgang DenkThanks a lot!
I means nanosleep() function.
Best Regards,
John
Quoted 4 lines
(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: [email protected] [mailto:[email protected]]On Behalf Of Wolfgang Denk
Sent: Wednesday, December 31, 2003 2:50 AM
To: [email protected]
Cc: 'Mailing List: linuxppc-dev'
Subject: Re: A question on kernel clock:
Dear John,
Quoted 2 lines · 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.]
Quoted 4 lines
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.
Quoted 1 line
(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).
Quoted 1 line
(3) which is good choice for Kernel timeslice?
What's wrong with the standard 10 ms ?
Quoted 2 lines
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: [email protected] 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/
about small dhcp client/server and http client/server
In reply to Wolfgang DenkHi 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/