Coder Social home page Coder Social logo

frodo's People

Contributors

agnivade avatar borancar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

frodo's Issues

incorrect passing of Go pointers to C code

The golang doc says

C code may store Go pointers in C memory, subject to the rule above: it must stop storing the Go pointer when the C function returns.

however in this line

frodo/frodo.c

Line 105 in 55a39bb

fi->iovecs[0].iov_base = data;
you store the pointer from the golang buffer in a struct that is passed to io_uring systerm calls which will access the data buffer long after the push_write_request function returns.

int push_write_request(int file_fd, void *data, off_t file_sz) {
    struct file_info *fi = malloc(sizeof(*fi) + (sizeof(struct iovec) * 1));
...
    fi->iovecs[0].iov_base = data;
...
    io_uring_sqe_set_data(sqe, fi);
    return 0;
}

while this may work in some cases where the gc doesnt run till the file is written to, it is very possible that the gc runs after this call to push_write_request and relocates the data buffer to a whole different address. in fact for the zeroBytes buffer case

frodo/frodo.go

Line 173 in 55a39bb

zeroBytes := []byte("")
the gc may completely destroy slice since there are no references to it past the push_write_request call

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.