Find what program accessed a kernel module











up vote
2
down vote

favorite












How do I access a list of users/programs that accessed a certain module?



I run:



lsmod | grep ^uvcvideo


This returns this line when no application is using my video camera:



uvcvideo               86016  0


Well, I have something running that when "0" at the end of the line turns to anything but 0 (in practice this is usually 1) it sends me a notification that my camera is in use.



I want to know if there is a log of programs that turned that 0 to a 1, or which modules are accessed when/how.










share|improve this question









New contributor




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
























    up vote
    2
    down vote

    favorite












    How do I access a list of users/programs that accessed a certain module?



    I run:



    lsmod | grep ^uvcvideo


    This returns this line when no application is using my video camera:



    uvcvideo               86016  0


    Well, I have something running that when "0" at the end of the line turns to anything but 0 (in practice this is usually 1) it sends me a notification that my camera is in use.



    I want to know if there is a log of programs that turned that 0 to a 1, or which modules are accessed when/how.










    share|improve this question









    New contributor




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






















      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      How do I access a list of users/programs that accessed a certain module?



      I run:



      lsmod | grep ^uvcvideo


      This returns this line when no application is using my video camera:



      uvcvideo               86016  0


      Well, I have something running that when "0" at the end of the line turns to anything but 0 (in practice this is usually 1) it sends me a notification that my camera is in use.



      I want to know if there is a log of programs that turned that 0 to a 1, or which modules are accessed when/how.










      share|improve this question









      New contributor




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











      How do I access a list of users/programs that accessed a certain module?



      I run:



      lsmod | grep ^uvcvideo


      This returns this line when no application is using my video camera:



      uvcvideo               86016  0


      Well, I have something running that when "0" at the end of the line turns to anything but 0 (in practice this is usually 1) it sends me a notification that my camera is in use.



      I want to know if there is a log of programs that turned that 0 to a 1, or which modules are accessed when/how.







      logs kernel-modules video syslog






      share|improve this question









      New contributor




      David Kamer 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




      David Kamer 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 21 at 4:40





















      New contributor




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









      asked Nov 21 at 4:10









      David Kamer

      1144




      1144




      New contributor




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





      New contributor





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






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






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote













          Usually, there is no log file for this. There are tools you can use to make one though!



          The kernel has a built-in tracepoint for the try_module_get() function. That's the function that increases the reference count of a module. This tracepoint is in the module subsystem and is called module_get.



          https://stackoverflow.com/questions/448999/is-there-a-way-to-figure-out-what-is-using-a-linux-kernel-module/449856 (long read).



          To get you started, you can try perf trace -a --no-syscalls -e module:module_get -e module:module_put. This shows the program name, but it does not show the PID.






          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "106"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });






            David Kamer is a new contributor. Be nice, and check out our Code of Conduct.










             

            draft saved


            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f483118%2ffind-what-program-accessed-a-kernel-module%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            1
            down vote













            Usually, there is no log file for this. There are tools you can use to make one though!



            The kernel has a built-in tracepoint for the try_module_get() function. That's the function that increases the reference count of a module. This tracepoint is in the module subsystem and is called module_get.



            https://stackoverflow.com/questions/448999/is-there-a-way-to-figure-out-what-is-using-a-linux-kernel-module/449856 (long read).



            To get you started, you can try perf trace -a --no-syscalls -e module:module_get -e module:module_put. This shows the program name, but it does not show the PID.






            share|improve this answer



























              up vote
              1
              down vote













              Usually, there is no log file for this. There are tools you can use to make one though!



              The kernel has a built-in tracepoint for the try_module_get() function. That's the function that increases the reference count of a module. This tracepoint is in the module subsystem and is called module_get.



              https://stackoverflow.com/questions/448999/is-there-a-way-to-figure-out-what-is-using-a-linux-kernel-module/449856 (long read).



              To get you started, you can try perf trace -a --no-syscalls -e module:module_get -e module:module_put. This shows the program name, but it does not show the PID.






              share|improve this answer

























                up vote
                1
                down vote










                up vote
                1
                down vote









                Usually, there is no log file for this. There are tools you can use to make one though!



                The kernel has a built-in tracepoint for the try_module_get() function. That's the function that increases the reference count of a module. This tracepoint is in the module subsystem and is called module_get.



                https://stackoverflow.com/questions/448999/is-there-a-way-to-figure-out-what-is-using-a-linux-kernel-module/449856 (long read).



                To get you started, you can try perf trace -a --no-syscalls -e module:module_get -e module:module_put. This shows the program name, but it does not show the PID.






                share|improve this answer














                Usually, there is no log file for this. There are tools you can use to make one though!



                The kernel has a built-in tracepoint for the try_module_get() function. That's the function that increases the reference count of a module. This tracepoint is in the module subsystem and is called module_get.



                https://stackoverflow.com/questions/448999/is-there-a-way-to-figure-out-what-is-using-a-linux-kernel-module/449856 (long read).



                To get you started, you can try perf trace -a --no-syscalls -e module:module_get -e module:module_put. This shows the program name, but it does not show the PID.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 21 at 11:50

























                answered Nov 21 at 11:39









                sourcejedi

                22k43396




                22k43396






















                    David Kamer is a new contributor. Be nice, and check out our Code of Conduct.










                     

                    draft saved


                    draft discarded


















                    David Kamer is a new contributor. Be nice, and check out our Code of Conduct.













                    David Kamer is a new contributor. Be nice, and check out our Code of Conduct.












                    David Kamer is a new contributor. Be nice, and check out our Code of Conduct.















                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f483118%2ffind-what-program-accessed-a-kernel-module%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Morgemoulin

                    Scott Moir

                    Souastre