create a vdso in linux [on hold]











up vote
1
down vote

favorite
1












I'm currently trying to implement my own VDSO. I have seen this tutorial which explains how to do this.



However, this tutorial is made for Linux 2.6.x and I would like to use it on Linux 4.8.x. But the architectural structure of vdso changed a lot since this version (e.g. vextern.h has been suppressed) and I don't know how to adapt it to get it working.



Do you know how I could adapt this tutorial for a recent kernel or where I can find enough resources about vdso to implement my own?



Also, do you know whether I can simply recreate the behavior of an arbitrary syscall as a VDSO? I know it is a very bad idea from a security perspective (and the performance gain is negligible)










share|improve this question









New contributor




Maxime B. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











put on hold as off-topic by Rui F Ribeiro, Jeff Schaller, RalfFriedl, G-Man, Archemar Nov 21 at 8:12


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Requests for learning materials (tutorials, how-tos etc.) are off topic. The only exception is questions about where to find official documentation (e.g. POSIX specifications). See the Help Center and our Community Meta for more information." – Rui F Ribeiro, RalfFriedl, Archemar

If this question can be reworded to fit the rules in the help center, please edit the question.













  • Thanks I learnt something new. However the phrase “the kernel is divided into two primary segments of memory: userland and kernel land.” is inept. This is as silly as saying that apples are divided into two groups: apples and oranges.
    – ctrl-alt-delor
    Nov 20 at 14:02















up vote
1
down vote

favorite
1












I'm currently trying to implement my own VDSO. I have seen this tutorial which explains how to do this.



However, this tutorial is made for Linux 2.6.x and I would like to use it on Linux 4.8.x. But the architectural structure of vdso changed a lot since this version (e.g. vextern.h has been suppressed) and I don't know how to adapt it to get it working.



Do you know how I could adapt this tutorial for a recent kernel or where I can find enough resources about vdso to implement my own?



Also, do you know whether I can simply recreate the behavior of an arbitrary syscall as a VDSO? I know it is a very bad idea from a security perspective (and the performance gain is negligible)










share|improve this question









New contributor




Maxime B. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











put on hold as off-topic by Rui F Ribeiro, Jeff Schaller, RalfFriedl, G-Man, Archemar Nov 21 at 8:12


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Requests for learning materials (tutorials, how-tos etc.) are off topic. The only exception is questions about where to find official documentation (e.g. POSIX specifications). See the Help Center and our Community Meta for more information." – Rui F Ribeiro, RalfFriedl, Archemar

If this question can be reworded to fit the rules in the help center, please edit the question.













  • Thanks I learnt something new. However the phrase “the kernel is divided into two primary segments of memory: userland and kernel land.” is inept. This is as silly as saying that apples are divided into two groups: apples and oranges.
    – ctrl-alt-delor
    Nov 20 at 14:02













up vote
1
down vote

favorite
1









up vote
1
down vote

favorite
1






1





I'm currently trying to implement my own VDSO. I have seen this tutorial which explains how to do this.



However, this tutorial is made for Linux 2.6.x and I would like to use it on Linux 4.8.x. But the architectural structure of vdso changed a lot since this version (e.g. vextern.h has been suppressed) and I don't know how to adapt it to get it working.



Do you know how I could adapt this tutorial for a recent kernel or where I can find enough resources about vdso to implement my own?



Also, do you know whether I can simply recreate the behavior of an arbitrary syscall as a VDSO? I know it is a very bad idea from a security perspective (and the performance gain is negligible)










share|improve this question









New contributor




Maxime B. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I'm currently trying to implement my own VDSO. I have seen this tutorial which explains how to do this.



However, this tutorial is made for Linux 2.6.x and I would like to use it on Linux 4.8.x. But the architectural structure of vdso changed a lot since this version (e.g. vextern.h has been suppressed) and I don't know how to adapt it to get it working.



Do you know how I could adapt this tutorial for a recent kernel or where I can find enough resources about vdso to implement my own?



Also, do you know whether I can simply recreate the behavior of an arbitrary syscall as a VDSO? I know it is a very bad idea from a security perspective (and the performance gain is negligible)







kernel linux-kernel compiling system-calls syscalls






share|improve this question









New contributor




Maxime B. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Maxime B. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited Nov 20 at 13:55









Rui F Ribeiro

38.2k1475125




38.2k1475125






New contributor




Maxime B. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Nov 20 at 12:35









Maxime B.

161




161




New contributor




Maxime B. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Maxime B. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Maxime B. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




put on hold as off-topic by Rui F Ribeiro, Jeff Schaller, RalfFriedl, G-Man, Archemar Nov 21 at 8:12


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Requests for learning materials (tutorials, how-tos etc.) are off topic. The only exception is questions about where to find official documentation (e.g. POSIX specifications). See the Help Center and our Community Meta for more information." – Rui F Ribeiro, RalfFriedl, Archemar

If this question can be reworded to fit the rules in the help center, please edit the question.




put on hold as off-topic by Rui F Ribeiro, Jeff Schaller, RalfFriedl, G-Man, Archemar Nov 21 at 8:12


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Requests for learning materials (tutorials, how-tos etc.) are off topic. The only exception is questions about where to find official documentation (e.g. POSIX specifications). See the Help Center and our Community Meta for more information." – Rui F Ribeiro, RalfFriedl, Archemar

If this question can be reworded to fit the rules in the help center, please edit the question.












  • Thanks I learnt something new. However the phrase “the kernel is divided into two primary segments of memory: userland and kernel land.” is inept. This is as silly as saying that apples are divided into two groups: apples and oranges.
    – ctrl-alt-delor
    Nov 20 at 14:02


















  • Thanks I learnt something new. However the phrase “the kernel is divided into two primary segments of memory: userland and kernel land.” is inept. This is as silly as saying that apples are divided into two groups: apples and oranges.
    – ctrl-alt-delor
    Nov 20 at 14:02
















Thanks I learnt something new. However the phrase “the kernel is divided into two primary segments of memory: userland and kernel land.” is inept. This is as silly as saying that apples are divided into two groups: apples and oranges.
– ctrl-alt-delor
Nov 20 at 14:02




Thanks I learnt something new. However the phrase “the kernel is divided into two primary segments of memory: userland and kernel land.” is inept. This is as silly as saying that apples are divided into two groups: apples and oranges.
– ctrl-alt-delor
Nov 20 at 14:02










1 Answer
1






active

oldest

votes

















up vote
1
down vote













I’m not sure there’s an updated tutorial in the same style, but the changes are limited:





  • arch/x86/vdso moved to arch/x86/entry/vdso;

  • variable declarations have been greatly simplified.


The latter means that you only need to declare your variable once, in arch/x86/include/asm/vvar.h, at a fixed offset, with the DECLARE_VVAR macro. To define it, use the DEFINE_VVAR macro; to access it, use the VVAR macro. The linked commit above has a number of examples (all the existing uses of shared variables).



You can’t recreate the behaviour of an arbitrary syscall in the vDSO, at least not without calling into the kernel in kernel mode. The vDSO is only really useful for calls which can be handled in user space; there aren’t many of those.






share|improve this answer




























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote













    I’m not sure there’s an updated tutorial in the same style, but the changes are limited:





    • arch/x86/vdso moved to arch/x86/entry/vdso;

    • variable declarations have been greatly simplified.


    The latter means that you only need to declare your variable once, in arch/x86/include/asm/vvar.h, at a fixed offset, with the DECLARE_VVAR macro. To define it, use the DEFINE_VVAR macro; to access it, use the VVAR macro. The linked commit above has a number of examples (all the existing uses of shared variables).



    You can’t recreate the behaviour of an arbitrary syscall in the vDSO, at least not without calling into the kernel in kernel mode. The vDSO is only really useful for calls which can be handled in user space; there aren’t many of those.






    share|improve this answer

























      up vote
      1
      down vote













      I’m not sure there’s an updated tutorial in the same style, but the changes are limited:





      • arch/x86/vdso moved to arch/x86/entry/vdso;

      • variable declarations have been greatly simplified.


      The latter means that you only need to declare your variable once, in arch/x86/include/asm/vvar.h, at a fixed offset, with the DECLARE_VVAR macro. To define it, use the DEFINE_VVAR macro; to access it, use the VVAR macro. The linked commit above has a number of examples (all the existing uses of shared variables).



      You can’t recreate the behaviour of an arbitrary syscall in the vDSO, at least not without calling into the kernel in kernel mode. The vDSO is only really useful for calls which can be handled in user space; there aren’t many of those.






      share|improve this answer























        up vote
        1
        down vote










        up vote
        1
        down vote









        I’m not sure there’s an updated tutorial in the same style, but the changes are limited:





        • arch/x86/vdso moved to arch/x86/entry/vdso;

        • variable declarations have been greatly simplified.


        The latter means that you only need to declare your variable once, in arch/x86/include/asm/vvar.h, at a fixed offset, with the DECLARE_VVAR macro. To define it, use the DEFINE_VVAR macro; to access it, use the VVAR macro. The linked commit above has a number of examples (all the existing uses of shared variables).



        You can’t recreate the behaviour of an arbitrary syscall in the vDSO, at least not without calling into the kernel in kernel mode. The vDSO is only really useful for calls which can be handled in user space; there aren’t many of those.






        share|improve this answer












        I’m not sure there’s an updated tutorial in the same style, but the changes are limited:





        • arch/x86/vdso moved to arch/x86/entry/vdso;

        • variable declarations have been greatly simplified.


        The latter means that you only need to declare your variable once, in arch/x86/include/asm/vvar.h, at a fixed offset, with the DECLARE_VVAR macro. To define it, use the DEFINE_VVAR macro; to access it, use the VVAR macro. The linked commit above has a number of examples (all the existing uses of shared variables).



        You can’t recreate the behaviour of an arbitrary syscall in the vDSO, at least not without calling into the kernel in kernel mode. The vDSO is only really useful for calls which can be handled in user space; there aren’t many of those.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 20 at 14:19









        Stephen Kitt

        158k23344420




        158k23344420















            Popular posts from this blog

            Morgemoulin

            Scott Moir

            Souastre