Lorel / 0MQRxLua-MFR-POC

Try map filter reduce based on 0MQ and RxLua (et un peu de SGX)
0 stars 0 forks source link

LuaSGX core dumped #9

Closed Lorel closed 7 years ago

Lorel commented 7 years ago

Too many calls of sgxprocess(func, params) lead to a fatal error: Illegal instruction (core dumped) In my case, it happens when 1266000 calls have been done with:

It looks like a kind of memory issue

During my discover of LuaSGX, I've noticed that when you give a malformed function to sgxprocess after having already called at least once the latter with a well-formed function, this is the previously evaluated function which is called into the enclave

Then I am suspecting like a kind of data persistence which should not happen


UPDATE During another run experiment, using the same workload, it failed at the 1242312th call with params value:

["2005,3,13,7,1807,1755,2347,2350,WN,2445,N432,220,235,211,-3,12,PHX,RDU,1891,2,7,0,,0,0,0,0,0,0"]

So the failure is not related to the given datas

Lorel commented 7 years ago

Test chunk:

func = 'function(params) func = function(value) local csv = nil if ccsv then   csv = ccsv else   csv = require("csv") end if not value then   return {} end local array = (csv.parse)(value) local event = {} event.uniquecarrier = array[9] event.arrdelay = array[15] return event end if not cjson then cjson = SGX.cjson end  return cjson.encode(func(table.unpack(cjson.decode(params)))) end'

data = '["2005,3,13,7,1120,1120,1239,1240,WN,1565,N317SW,79,80,65,-1,0,BHM,STL,410,4,10,0,,0,0,0,0,0,0"]'

for i=0,50000000,1 do
  print("Process " .. i, sgxdecrypt(sgxprocess(sgxencrypt(func), sgxencrypt(data))))
end

Running this simple test:

Lorel commented 7 years ago

With EnclavedLua.signed.so version from ec37d91fd9e29d7a4354f15eab579b06a4d41b5f, 100M calls have been done successfully

rafaelppires commented 7 years ago

Bug in the way files were mocked: an ever-growing table (that relates file ids with the descriptive struct) Even though the filename was the same, a new pair <id,ptr> in every call was being allocated