lcc vs lcc-win

lcc vs lcc-win

Post by Juan Carlo » Sat, 18 Apr 2009 01:17:07


Can I use lcc-win (for a x86-linux architecture) to handle to
different stack? or Do I need to work with lcc?
 
 
 

lcc vs lcc-win

Post by jacob navi » Sat, 18 Apr 2009 02:31:21


what is this?

"to handle to different stack"

What do you mean?

--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.yqcomputer.com/ . *** ia.edu/~lcc-win32

 
 
 

lcc vs lcc-win

Post by Juan Carlo » Sat, 18 Apr 2009 04:16:25


For handling two stack I mean, split the current stack in two
segments, in one of them the compiler will be allocate the critical
stuff (frame pointer, return address, maybe some variables); in the
other, it will allocate the arguments and local variables.
 
 
 

lcc vs lcc-win

Post by jacob navi » Sat, 18 Apr 2009 17:46:00


Anything is possible. You can have 165 stacks if you like.

Just build a circular list of 165 positions, and use a dedicated
register to point to the current stack pointer in that 165
positions.

If you have two stacks, then you have to manage two stack pointers.
Since the call instruction will use the (single) machine stack
(that pointed to by the stack register esp) the second stack will be
in some other place.

To access the arguments you would use your second stack pointer
and to use the return from procedure instruction, you would
use the machine stack.

You need to rewrite the code of your favorite compiler completely
since managing two stacks will break most of it.

Then, you have to recompile the C library too, since all calls to
procedures that use only one stack must be different...

To be able to use windows at all, you need somehow to mark
procedures with one stack as special to make your compiler
generate the right sequence for system calls.

I think if you do this 8 hours a day you would take at least
a year...

And then, when finished you can start asking

What's the use of this stuff?

--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.yqcomputer.com/ . *** ia.edu/~lcc-win32
 
 
 

lcc vs lcc-win

Post by Keith Thom » Sun, 19 Apr 2009 01:09:47

jacob navia < XXXX@XXXXX.COM > writes:



[...]
[...]

I can't speak for Juan Carlos, but I suspect the point is additional
safety. If you write past the bounds of a local array, you risk
clobbering the frame pointer or the return address. (I think some
malware uses this.) If the frame pointer and return address are in a
separate stack, there's less danger; if you don't go too far beyond
the array, you can only clobber other declared variables.

--
Keith Thompson (The_Other_Keith) XXXX@XXXXX.COM < http://www.yqcomputer.com/ ~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
 
 
 

lcc vs lcc-win

Post by Juan Carlo » Sun, 19 Apr 2009 01:58:20


> clobbering the frame pointer or the return address. I think some >> malware uses this.) f the frame pointer and return address are in a >> separate stack, there's less danger; if you don't go too far beyond >> the array, you can only clobber other declared variables. >> >> -- >> Keith Thompson (The_Other_Keith) XXXX@XXXXX.COM http://www.yqcomputer.com/ ~k>t>> > Nokia> > "We must do something. his is something. herefore, we must do this."> > -- Antony Jay and Jonathan Lynn, "Yes Minister"

Thanks Keith, you saw my point!!!

In addition, I just want to show that it is possible. I don't want to
implement it in Windows yet. If I can show that it works for a x86-
linux, it will be ok for me.
 
 
 

lcc vs lcc-win

Post by Keith Thom » Sun, 19 Apr 2009 08:12:12

Juan Carlos < XXXX@XXXXX.COM > writes:

[...]

There may be existing practice for this. I'm not familiar with the
internals of either lcc or lcc-win, but if they don't support this you
might look at other compilers.

--
Keith Thompson (The_Other_Keith) XXXX@XXXXX.COM << http://www.yqcomputer.com/ ~ks>>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
 
 
 

lcc vs lcc-win

Post by Juan Carlo » Thu, 23 Apr 2009 13:42:21


> >> clobbering the frame pointer or the return address. I think some >>>>> malware uses this.) f the frame pointer and return address are in a >>>>> separate stack, there's less danger; if you don't go too far beyond >>>>> the array, you can only clobber other declared variables. >> >>>> Thanks Keith, you saw my point!!! >> >>>> In addition, I just want to show that it is possible. I don't want to >>>> implement it in Windows yet. If I can show that it works for a x86- >>>> linux, it will be ok for me. >> >> There may be existing practice for this. 'm not familiar with the >> internals of either lcc or lcc-win, but if they don't support this you >> might look at other compilers. >> >> -- >> Keith Thompson (The_Other_Keith) XXXX@XXXXX.COM http://www.yqcomputer.com/ ~k>t>> > Nokia> > "We must do something. his is something. herefore, we must do this."> > -- Antony Jay and Jonathan Lynn, "Yes Minister"

I need to split the DATA segment in two pieces. One will hold
variables that I will assume "secure" and the other that I will call
"insecure". The idea is how to identify variables defined by the
programmer and used for the program itself like a counter (secure)
from variables that come from an input (insecure). How I can handle
it? Can I define a new attribute, e.g. s_int (secure int) or i_int
(insecure int)? How I will pass that information for the back-end
compiler in order to assign each variable in the correct DATA segment?

This is my idea: I am thinking in handling the two segments with two
different addresses or offsets; however, how the system will be assign
one of them? I guess it will need extra information, and for this
reason I think in a new attribute. The attribute will be used for the
programmer, who will define what variables is "secure" or no (high
level).

At the same time, my goal is to implement it and prove that it is
possible, but I am not sure if lcc or lcc-win are the compilers that I
need. Can I modify lcc-win at the same way that lcc? Someone has
installed lcc in a Ubuntu-PC?