Git Product home page Git Product logo

Comments (8)

piyush-kurur avatar piyush-kurur commented on July 28, 2024

On Fri, Aug 09, 2013 at 12:17:40AM -0700, satvikc wrote:

A high-level design for memory locking is given below. I am just mentioning types for brevity.

Maybe we should try a simpler approach first. I think we should look
at Memory and gadgets together as they are closly related.

Regards

ppk

from raaz.

satvikc avatar satvikc commented on July 28, 2024

I have a few questions

  • How to malloc with the given alignment? There are functions available in Foreign.ForeignPtr to allocate a ForeignPtr but it says nowhere about alignment.
  • How to read data directly from the given handle to the given buffer? We would not want to first read say using ByteString and then store in the given address for security reasons. We would also want the handle to be unbuffered.

There is some code available at

https://github.com/satvikc/raaz/blob/x-memory/raaz-primitives/Raaz/Util/SecureMemory.hs

Right now I am just using list instead of a tree for simplicity. We can change that later once we get this working.

from raaz.

piyush-kurur avatar piyush-kurur commented on July 28, 2024

On Mon, Aug 12, 2013 at 09:58:40PM -0700, satvikc wrote:

I have a few questions

  • How to malloc with the given alignment? There are functions
    available in Foreign.ForeignPtr to allocate a ForeignPtr but it
    says nowhere about alignment.
I think the alignment is taken careof by
mallocForeignPtr. However, be careful: In the case of secure
memory pool, we should be aligning against page boundary instead
of word boundary.
  • How to read data directly from the given handle to the given
    buffer? We would not want to first read say using ByteString and
    then store in the given address for security reasons. We would
    also want the handle to be unbuffered.
You can reuse the function that you wrote for Ptr with the help of
the function withForeignPtr.

Regards

ppk

from raaz.

satvikc avatar satvikc commented on July 28, 2024

Yeah, mallocForeignPtr aligns at alignment of the datatype and not the page boundary.

from raaz.

satvikc avatar satvikc commented on July 28, 2024

I have a way of doing that by defining the Storable instance for Pool, but peek and poke will be undefined in that case as malloc will only be using the alignment and sizeOf functions from that.

from raaz.

piyush-kurur avatar piyush-kurur commented on July 28, 2024

On Mon, Aug 12, 2013 at 10:59:41PM -0700, satvikc wrote:

I have a way of doing that by defining the Storable instance for
Pool, but peek and poke will be undefined in that case as malloc
will only be using the alignment and sizeOf functions from that.

I donot like this option see if there is some other way. For Ptrs
there is the functions allocBytesAligned

from raaz.

satvikc avatar satvikc commented on July 28, 2024

But that has type `Int -> Int -> (Ptr a -> IO b) -> IO b). We want to
allocate a pointer which is aligned and return it. There is no malloc
equivalent for that, even for Ptrs.

On Tue, Aug 13, 2013 at 11:49 AM, Piyush P Kurur
[email protected]:

On Mon, Aug 12, 2013 at 10:59:41PM -0700, satvikc wrote:

I have a way of doing that by defining the Storable instance for
Pool, but peek and poke will be undefined in that case as malloc
will only be using the alignment and sizeOf functions from that.

I donot like this option see if there is some other way. For Ptrs
there is the functions allocBytesAligned


Reply to this email directly or view it on GitHubhttps://github.com/piyush-kurur/raaz/issues/50#issuecomment-22545265
.


Satvik Chauhan
Fourth Year Under Graduate Student
Deptt. of Computer Science and Engineering
Indian Institute of Technology Kanpur
Kanpur-208016, INDIA
Email: [email protected] , [email protected]


from raaz.

satvikc avatar satvikc commented on July 28, 2024

I have written some code for memory locking. Can you have a look. Also I am not sure how to write testcases for those.

from raaz.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.