All of lore.kernel.org
 help / color / mirror / Atom feed
* init: How did init/do_mounts_rd.c overcome memory protection ?
@ 2015-11-10 18:38 Badhri Jagan Sridharan
  2015-11-10 21:37 ` Richard Weinberger
  0 siblings, 1 reply; 3+ messages in thread
From: Badhri Jagan Sridharan @ 2015-11-10 18:38 UTC (permalink / raw)
  To: linux-kernel; +Cc: dhowells, akpm

Mighty upstream,

I see that do_mounts_rd.c seems to make calls to sys_read and
sys_lseek functions. As these are syscall functions, they expects
some of the arguments to be from userspace.

I was going through the article that Greg KH wrote a while back:
http://www.linuxjournal.com/article/8110?page=0,1 . I don't see any
references to set_fs/get_fs under init/*. Does the memory protection
get enabled only in the later stage ? Or does do_mounts_rd.c accomplish
this in some other way ?

Thanks,
Badhri

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

* Re: init: How did init/do_mounts_rd.c overcome memory protection ?
  2015-11-10 18:38 init: How did init/do_mounts_rd.c overcome memory protection ? Badhri Jagan Sridharan
@ 2015-11-10 21:37 ` Richard Weinberger
  2015-11-11  1:22   ` Badhri Jagan Sridharan
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Weinberger @ 2015-11-10 21:37 UTC (permalink / raw)
  To: Badhri Jagan Sridharan; +Cc: LKML, David Howells, Andrew Morton

On Tue, Nov 10, 2015 at 7:38 PM, Badhri Jagan Sridharan
<badhri@google.com> wrote:
> Mighty upstream,
>
> I see that do_mounts_rd.c seems to make calls to sys_read and
> sys_lseek functions. As these are syscall functions, they expects
> some of the arguments to be from userspace.
>
> I was going through the article that Greg KH wrote a while back:
> http://www.linuxjournal.com/article/8110?page=0,1 . I don't see any
> references to set_fs/get_fs under init/*. Does the memory protection
> get enabled only in the later stage ? Or does do_mounts_rd.c accomplish
> this in some other way ?

The stuff in init/ is PID 1 and it inherits addr_limit from the
initial thread (PID 0 or swapper called).
INIT_THREAD_INFO() sets addr_limit to KERNEL_DS.

-- 
Thanks,
//richard

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

* Re: init: How did init/do_mounts_rd.c overcome memory protection ?
  2015-11-10 21:37 ` Richard Weinberger
@ 2015-11-11  1:22   ` Badhri Jagan Sridharan
  0 siblings, 0 replies; 3+ messages in thread
From: Badhri Jagan Sridharan @ 2015-11-11  1:22 UTC (permalink / raw)
  To: Richard Weinberger; +Cc: LKML, David Howells, Andrew Morton

Thanks Richard !!
That's the one that I was looking for.

On Tue, Nov 10, 2015 at 1:37 PM, Richard Weinberger
<richard.weinberger@gmail.com> wrote:
> On Tue, Nov 10, 2015 at 7:38 PM, Badhri Jagan Sridharan
> <badhri@google.com> wrote:
>> Mighty upstream,
>>
>> I see that do_mounts_rd.c seems to make calls to sys_read and
>> sys_lseek functions. As these are syscall functions, they expects
>> some of the arguments to be from userspace.
>>
>> I was going through the article that Greg KH wrote a while back:
>> http://www.linuxjournal.com/article/8110?page=0,1 . I don't see any
>> references to set_fs/get_fs under init/*. Does the memory protection
>> get enabled only in the later stage ? Or does do_mounts_rd.c accomplish
>> this in some other way ?
>
> The stuff in init/ is PID 1 and it inherits addr_limit from the
> initial thread (PID 0 or swapper called).
> INIT_THREAD_INFO() sets addr_limit to KERNEL_DS.
>
> --
> Thanks,
> //richard

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

end of thread, other threads:[~2015-11-11  1:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-10 18:38 init: How did init/do_mounts_rd.c overcome memory protection ? Badhri Jagan Sridharan
2015-11-10 21:37 ` Richard Weinberger
2015-11-11  1:22   ` Badhri Jagan Sridharan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.