public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Dangerous method: Cyg_SchedulerImplementation::set_idle_thread(Cyg_Thread* thread)?
@ 2005-06-10 21:05 Fabian Scheler
  2005-06-11 13:22 ` Bart Veer
  0 siblings, 1 reply; 4+ messages in thread
From: Fabian Scheler @ 2005-06-10 21:05 UTC (permalink / raw)
  To: ecos-discuss

Hello,

maybe I've just not read carefully enough through the source code of
eCos, but two methods appear a bit hazardous to me. These are the
implementations of the method

Cyg_SchedulerImplementation::set_idle_thread(Cyg_Thread* thread)

within the Multi-Level-Queue- and the Bitmap-Scheduler. In both cases
these methods set the current thread to the thread given as parameter,
at least for single processor systems, but this assumption only holds
at system startup in general when no other thread is running. Moreover
these methods are public, so the user can change the current idle
thread during runtime, and thus, mess up the pointer to the current
thread.

Ciao, Fabian

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

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

* Re: [ECOS] Dangerous method: Cyg_SchedulerImplementation::set_idle_thread(Cyg_Thread* thread)?
  2005-06-10 21:05 [ECOS] Dangerous method: Cyg_SchedulerImplementation::set_idle_thread(Cyg_Thread* thread)? Fabian Scheler
@ 2005-06-11 13:22 ` Bart Veer
  2005-06-13  7:41   ` Fabian Scheler
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Veer @ 2005-06-11 13:22 UTC (permalink / raw)
  To: fabian.scheler; +Cc: ecos-discuss

>>>>> "Fabian" == Fabian Scheler <fabian.scheler@gmail.com> writes:

    Fabian> maybe I've just not read carefully enough through the
    Fabian> source code of eCos, but two methods appear a bit
    Fabian> hazardous to me. These are the implementations of the
    Fabian> method

    Fabian> Cyg_SchedulerImplementation::set_idle_thread(Cyg_Thread* thread)

    Fabian> within the Multi-Level-Queue- and the Bitmap-Scheduler. In
    Fabian> both cases these methods set the current thread to the
    Fabian> thread given as parameter, at least for single processor
    Fabian> systems, but this assumption only holds at system startup
    Fabian> in general when no other thread is running. Moreover these
    Fabian> methods are public, so the user can change the current
    Fabian> idle thread during runtime, and thus, mess up the pointer
    Fabian> to the current thread.

This function is not part of the exported API: there is no C
equivalent in kapi.h, nor is there any documentation. It is intended
only for use within the kernel, and only gets used during system
initialization.

Bart

-- 
Bart Veer                       eCos Configuration Architect
http://www.ecoscentric.com/     The eCos and RedBoot experts


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

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

* Re: [ECOS] Dangerous method: Cyg_SchedulerImplementation::set_idle_thread(Cyg_Thread* thread)?
  2005-06-11 13:22 ` Bart Veer
@ 2005-06-13  7:41   ` Fabian Scheler
  2005-06-13  9:24     ` Nick Garnett
  0 siblings, 1 reply; 4+ messages in thread
From: Fabian Scheler @ 2005-06-13  7:41 UTC (permalink / raw)
  To: Bart Veer; +Cc: ecos-discuss

Hi,

> This function is not part of the exported API: there is no C
> equivalent in kapi.h, nor is there any documentation. It is intended
> only for use within the kernel, and only gets used during system
> initialization.

Ok, I agree that the eCos-user is intended to use the C-API, but he is
not forbidden to use the C++-API, is he? And if this method is used
for initialization pruposes only, why is it declared public?

Ciao, Fabian

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

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

* Re: [ECOS] Dangerous method: Cyg_SchedulerImplementation::set_idle_thread(Cyg_Thread* thread)?
  2005-06-13  7:41   ` Fabian Scheler
@ 2005-06-13  9:24     ` Nick Garnett
  0 siblings, 0 replies; 4+ messages in thread
From: Nick Garnett @ 2005-06-13  9:24 UTC (permalink / raw)
  To: Fabian Scheler; +Cc: Bart Veer, ecos-discuss

Fabian Scheler <fabian.scheler@gmail.com> writes:

> Hi,
> 
> > This function is not part of the exported API: there is no C
> > equivalent in kapi.h, nor is there any documentation. It is intended
> > only for use within the kernel, and only gets used during system
> > initialization.
> 
> Ok, I agree that the eCos-user is intended to use the C-API, but he is
> not forbidden to use the C++-API, is he? And if this method is used
> for initialization pruposes only, why is it declared public?

The C++ public/protected/private thing is fairly crude. It doen't
allow us to distinguish between public-in-the-kernel-only and
public-to-everyone. There's only so much we can do to keep kernel
interfaces secure.

-- 
Nick Garnett                                     eCos Kernel Architect
http://www.ecoscentric.com                The eCos and RedBoot experts


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

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

end of thread, other threads:[~2005-06-13  9:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-10 21:05 [ECOS] Dangerous method: Cyg_SchedulerImplementation::set_idle_thread(Cyg_Thread* thread)? Fabian Scheler
2005-06-11 13:22 ` Bart Veer
2005-06-13  7:41   ` Fabian Scheler
2005-06-13  9:24     ` Nick Garnett

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 read-only IMAP folder(s) and NNTP newsgroup(s).