Giter Club home page Giter Club logo

Comments (6)

afiskon avatar afiskon commented on May 17, 2024

@jserv respectfully, the problem with:

static char msg[BUF_LEN];

... in chardev.c still exists. As I understand, device_* can be called concurrently which will cause concurrent access to msg and memory corruption as result. Unless there is something I don't know about how Linux kernel modules work. In the latest case I believe it should be clarified in the text and in the comments to the code.

from lkmpg.

jserv avatar jserv commented on May 17, 2024

Reopen as per @afiskon requested. Under investigation.

from lkmpg.

YLowy avatar YLowy commented on May 17, 2024

I am testing the chardev.c on my machine and I think there is still some bug need to be fixed.

In my testing:
`[0] read 0 bytes.
[1] read 0 bytes.
[3] read 40 bytes. I already told you 1 times Hello world!

[2] read 40 bytes. I already told you 1 times Hello world!

[4] read 0 bytes.
[3] read 40 bytes. I already told you 1 times Hello world!

[0] read 0 bytes.
[1] read 40 bytes. I already told you 1 times Hello world!

[2] read 0 bytes.
[4] read 40 bytes. I already told you 1 times Hello world!
`
Sometime, the read function from user space will fail (can't get the message) because the "Offset" in the open file table is not correct.
They all use the same open file table entry so there will also have race condition if we update the offset before device_read() return the bytes_read.

from lkmpg.

jserv avatar jserv commented on May 17, 2024

I am testing the chardev.c on my machine and I think there is still some bug need to be fixed.

@YLowy, you should discussion in the thread of pull request #108 if you were referring to the offset specific changes.

from lkmpg.

YLowy avatar YLowy commented on May 17, 2024

Due to the offset which is hard to be managed, I think it is a good way to create a list for each reading tasks. The element of the list includes the task's PID and it's offset. So that the race condition in the open file table will not occur. Nevertheless, we still need to consider the list behavior when task close or lseek the device.

from lkmpg.

jserv avatar jserv commented on May 17, 2024

Close via #108

from lkmpg.

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.