Re: questions in linux process memory management

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Erik,

> >2)Can a process have two different pages (in linear address space)
> >that are allocated same frame.

>I think I don't understand your question. A process can have a single
>physical page mapped at two different virtual locations in its address
>space. Mapping a single virtual page to two different physical pages is
>inpossible.
Your first guess is right. My question is whether same physical page is mapped to two diffrent virtual address of a process. You said it is possble.

Can you give an example?? In which occasions it will happen??

KR

different virtual address

 Erik Mouw <J.A.K.Mouw@its.tudelft.nl> wrote:

On Wed, Feb 05, 2003 at 06:10:22PM -0800, kernel rakshakudu wrote:
> I have following questions regrading linux process memory management.
>
> 1) Can a process modify its own text region(code).

No, cause it is mapped read-only.

> 2)Can a process have two different pages (in linear address space)
> that are allocated same frame.

I think I don't understand your question. A process can have a single
physical page mapped at two different virtual locations in its address
space. Mapping a single virtual page to two different physical pages is
inpossible.

> 3) Process reads its text region for intructions to execute. But Is
> there an occasion when a process reads data from its text region ??

Sure:

int foo(int bar)
{
return bar+1;
}

int main(void)
{
unsigned int *gnu = (unsigned int *)foo;

printf("foo() is at 0x%08x and has value 0x%08x\n",
(unsigned int)gnu, *gnu);

return 0;
}

Which on my system prints:

foo() is at 0x080483f0 and has value 0x8be58955

Put *gnu = 0 in it, and the program will die because of a segfault: you
can't write the text section.


Erik

--
J.A.K. (Erik) Mouw
Email: J.A.K.Mouw@its.tudelft.nl mouw@nl.linux.org
> ATTACHMENT part 2 application/pgp-signature


"Conquering Myselves to Conquer The World"

"Securing Kernel to Secure Whole System"



Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux