Re: [rvm-research] Potential issues with longjmp in bootImageRunner

Kathiravelu Pradeeban <[email protected]>
Newsgroups gmane.comp.java.jikes.rvm.devel
Message-ID <CAAarrSkKzP1x_Hb_kkCpKNkzDLH4QWjUJy0YYJ0EURHibMLJ9w@mail.gmail.com>
Thanks for the fix. I was able to reproduce the same issue also in a
simple micro-benchmark I developed for the GC algorithms [1]. With the
commit for RVM-1027 [2], the issue doesn't appear anymore.

[1] https://sourceforge.net/projects/xpd/files/latest/download
[2] https://jira.codehaus.org/browse/RVM-1027

Regards,
Pradeeban.

On Mon, Apr 15, 2013 at 6:22 PM, Carl Ritson <[email protected]> wrote:
>>>> There are a number of approaches to dealing with this:
>>>>  1. assume allocation will always be top-down and ignore,
>>>>  2. explicitly allocate thread stacks (these can be passed to pthread_create),
>>>>  3. replace use of setjmp/longjmp with savecontext/swapcontext
>>>> (although these are deprecated in POSIX),
>>>>  4. implement a local version of longjmp without a check,
>>>>  5. bypass the __longjmp_chk by using glibc's internal __libc_longjmp().
>>>>
>>>> Disregarding (1), (5) is the smallest change set.
>>>
>>> I'd also disregard (1). (3) and (4) don't seem attractive to me; we
>>> ought to rely on non-deprecated methods from the system libraries as
>>> much as possible.
>>
>> My opinion is (3) the best option as (2) requires the bootImageRunner
>> to allocate memory at a specific place in memory and manage it
>> (because thread heap will need to be freed).  Instead of
>> reimplementing setjmp/longjmp completely, bootThread already has to be
>> implemented in machine specific assembly to pivot the stack when
>> entering the VM, the existing code should hence be extended to allow
>> for pivoting back onto the thread stack.  In effect bootThread should
>> return when sysThreadTerminate is called.
>
> It has been pointed out to me that where I said (3), I meant (4).  I
> agree that the use of deprecated APIs is not a good option.  An
> possible extension to (2) is to use the explicitly allocated stacks
> from inside the VM and entirely bypass the allocated of thread stacks
> in C/C++.  Although issues regarding the primordial thread would still
> need to be addressed.
>
> ------------------------------------------------------------------------------
> Precog is a next-generation analytics platform capable of advanced
> analytics on semi-structured data. The platform includes APIs for building
> apps and a phenomenal toolset for data science. Developers can use
> our toolset for easy data analysis & visualization. Get a free account!
> http://www2.precog.com/precogplatform/slashdotnewsletter
> _______________________________________________
> Jikesrvm-researchers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers



-- 
Pradeeban Kathiravelu.
Postgraduate Student,
Erasmus Mundus European Master in Distributed Computing,
Instituto Superior Técnico, Lisbon, Portugal.

Blog: [Llovizna] http://kkpradeeban.blogspot.com/

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.