Git Product home page Git Product logo

Comments (9)

daishengdong avatar daishengdong commented on July 26, 2024

感谢反馈,立刻修复!

from tencentos-tiny.

tluio avatar tluio commented on July 26, 2024

感谢反馈,立刻修复!

不客气!

from tencentos-tiny.

daishengdong avatar daishengdong commented on July 26, 2024

“因为在tos_task_create第100行的宏定义TOS_OBJ_TEST_RC中调用了knl_object_verify这个函数,这个函数使用了tos_task_create第一个参数task的成员task->knl_obj.type”

这个问题,因为task是用户传入的一片内存,这里没法确保用户对这片内存是否做了清零动作。实际上对于任意一个接口,都无法确保用户传入的内存到底内部是什么情况。

所以才设计了OBJ_VERIFY这一组宏,用魔术字校验的方式来校验用户是否传入正确参数。

如果用户确实传入了一个非法地址,且此地址上某一偏移处的内容恰好又是魔术字,就会刚好骗过这里的校验逻辑。但这种情况是不可避免的,同时也是低概率的。

而且对于task_create来说逻辑更为复位一些,因为此前有遇到有重复创建一个task的情况,就是说在task已经是一个合法的task情况下,再被创建一遍。因此这里又不能简单的对入参进行memset清零动作。

from tencentos-tiny.

tluio avatar tluio commented on July 26, 2024

我感觉上面的一些函数是内核提供的函数,这里面申请的内存并不是用户控制的,应该可以初始化后再调用tos_task_create函数吧

from tencentos-tiny.

daishengdong avatar daishengdong commented on July 26, 2024

task_create的入参task是用户传入的,不是内核维护的。

from tencentos-tiny.

tluio avatar tluio commented on July 26, 2024

抱歉,我还是不太理解,上面列举的一些函数是tencentos-tiny源码里的,这些函数申请完内存之后,调用了task_create函数,把申请的内存传给task_create了,为什么不在这些源码里初始化后再调用task_create呢?如果用户直接调用task_create的话,确实是不可避免的。

from tencentos-tiny.

daishengdong avatar daishengdong commented on July 26, 2024

你列举的情况确实是由内核维护的,我描述的是更为一般的情况。

from tencentos-tiny.

tluio avatar tluio commented on July 26, 2024

嗯嗯,明白了,非常感谢您的回复!

from tencentos-tiny.

daishengdong avatar daishengdong commented on July 26, 2024

客气,谢谢您的反馈。

from tencentos-tiny.

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.