Locating kernel properties in Linux via C driver - c

so I'm doing research for my thesis but I've run into an issue. I'm using a driver my mentor has given me to analyze memory and extract features from a running process. The driver is written in C and I'm running it in Ubuntu 16.04 and the error I'm having is when I compile. My current kernel version is 4.10.0-42-generic.
The following are the three lines are giving an error because they are not found.
(*task->active_mm).page_table_lock.rlock.raw_lock.tickets.head
(*task->active_mm).shared_vm
task->alloc_lock.rlock.raw_lock.tickets.head
For the first, the error starts on tickets I think. For the second shared_vm isn't found and for the last tickets is also where the error begins. My understanding is that the properties are no found.
I've been going through the kernel source files via https://elixir.free-electrons.com/linux/latest/source/kernel in the hopes of locating these properties but if anyone knows where they are or can help me locate them that would be very helpful. I'm new to all this so again any help is really appreciated.
Edit: The specific errors are: has no member named 'tickets', has no member named shared_vm, and has no member named 'tickets' for each respective line of code. Unfortunately I can't share any more code due to my professors request. Screenshot of when I try to 'make'

Related

No source available for xx_func() at 0xyy_address

I have been trying to develop and run core-mark benchmark on the EVB. I have added bunch of different source files provided by EEMBC and a static library too. All in accordance to the guidelines provided. Compilation is fine.
However, when I try to run the actual benchmark command - mcoremark-(#iterations), I am getting a hard fault.
I am not really sure why that is happening - but when I check the thread - it says "No source available for xx_func() at yy_address"
IDE that I am using - Eclipse
Could you please help me understand what might be happening here?
If you need more details, please let me know.
Thank you.
I am not really sure where to start in terms of debugging. I did check the symbol path of the library file provided and that seems to be in order.

F0520005:Could not open source file "r_bsp_config.h"

i'm working with renesas MCU RX65N, i want to make a serial connection with other board and also display an HMI i designed on Appwizard, i followed the steps they offer on their manuals but won't work either. Then found more information about how to solve it, and the code works by itself, but when i try to merge both programs just keeps giving me errors (problems that doesn't appear on individual projects), this is the error i got now, and don't know what to do because apparently it is included for my project but won't open no matter what i try, anyone knows how to solve it or what to do?
It sounds like when you include the file in one project, it works, but when you include it in another project, it doesn't? It sounds like there is a configuration difference between your projects. Try creating a new file in a project, then just put #include "r_bsp_config.h" in it, or however you wrote it (it may need to be #include <r_bsp_config.h>). See if you get the same error (you will probably get an error, something about missing main(), but the question is whether you get the same error). If you don't, cut and paste the code from the problematic project in, and also make sure the project configuration is adjusted to match, and see if it works now. If you do get the same error, then see if you can copy the project configuration from the working project to the new project, and see if you get the error this time.

How does a Client (Written in C) listens to a request on Linux OS?

I am a beginner and I want to understand some basics of Client-Server applications written in C (I understand web based server-client applications written in Java, PHP ,etc).
To be more specific, I am talking about ZABBIX which is a client-server tool (Zabbix_server is a server and zabbix_agentd is a client, both written in C).
Zabbix_server asks zabbix_agentd for data and zabbix_agents responds accordingly.
I have imported zabbix codes on Eclipse and have tried to debug to understand codes. A complete execution of zabbix_agentd on Eclipse just launched the daemon successfully and created a child process. But when I check the log, I find that different functions are being called which had not come in the way while debugging. It means, these functions are called by some process, may be inetd, etc. (correct me if i am wrong). I tried to find inetd on RHEL 6.4 OS, but it was no where found (using "service inetd status", "find").
So, how those functions are being called? Can anyone please give me ideas about that?
Please suggest me how to use those calling requests to further debug my client application.
One thing I have noticed while debugging Eclipse is that, I get below error after calling fork():
No source available for "fork() at 0x36ca0acbc0"
I couldn't understand the impact of the above error as the daemon keeps on working after this error also.
I browsed through similar error different people getting and found that their binaries were not linked to sources. However, my binaries are linked to sources also. I mean, expanding the binary of zabbix_agentd shows several *.h and *.c files.
As this error terminates the debugger immediately but the line of code at this occurrence is the last line of the source file also. So, I cannot say if I need to take care for this error.
Is this error the reason why I am not able to view other functions being called?
Please let me know if more information is required.
Thanks in advance.
Regards,
Rohit

"stack.cpp not found" prevents debug in VS 2013 express

I'm a rookie at C in general and VS 2013 also. I am trying to use some C code provided by a vendor in VS 2013 express. It compiles and runs without problem using the command line compiler but I would like to use the IDE.
I started a new project, C++ for console app, and I have pasted the code into the IDE and saved it as xyy.c so that it builds successfully. I thought it would be nice to have it in a GUI, so I duplicated the effort with a Win32 app project. It also builds.
The program's job is to connect to a PCI card that has Plx chip as an interface and program an FPGA. The Win32 program succeeds, even though I can't see any of the info printed by the program. The console program fails and I think it is because it fails to find the driver for the Plx chip. I thought I would get a clue by single stepping through the Win32 program to see which driver was supposed to be found.
However, after the first pass through a while loop, I get a pop up that says "Source Not Found" and "stack.cpp not found". Google wasn't any help to me.
I be grateful for any suggestions.
You might have "Enable .NET Framework source stepping" enabled (see http://msdn.microsoft.com/en-us/library/cc667410.aspx). So when you are at Stack... and trying to step into, it will actually try, but you don't have the sources for that. There is also a new experience for using the .NET framework reference source that was announced recently: http://blogs.msdn.com/b/dotnet/archive/2014/02/24/a-new-look-for-net-reference-source.aspx
I faced the same problem. I advise at the moment of receiving the information "stack.cpp not found" to look at the stack trace and check if there is something like this: "RTC".
If there is, you need to change the flag along the path (for example, set the Default or a more convenient configuration for you):
Project Properties -> C/C++ -> Code Generation -> Basic Runtime Checks
More details: https://learn.microsoft.com/en-us/cpp/build/reference/rtc-run-time-error-checks?view=msvc-160

SNMPd: Cannot open /proc/bus/pci

I cross-compiled NET-SNMP 5.7.1 from sources to a PowerPC using ELDK-3.1.
When I try to load the snmpd daemon in my embedded board, I see the message:
# snmpd -f -Lo
pcilib: Cannot open /proc/bus/pci
pcilib: Cannot find any working access method.
Of course my PPC board has no PCI, and I wonder why is netsnmp looking for it.
In more than one place I see this same message (sourceforge, mail-archive, google-groups), but ir has no answer at all. Another variant, with a little but unhelpful responses at (archlinuxarm).
Can anybody please help me?
I'm assuming you're on a Linux target.
Net-SNMP's changelog lists "[PATCH 3057093]: allow linux to use libpci for creating useful ifDescr strings".
The configure script will search for an available libpci, and, having found one, will define
HAVE_PCI_LOOKUP_NAME and HAVE_PCI_PCI_H. To disable this code: after configuring, you can change those defines in include/net-snmp/net-snmp-config.h, then rebuild. The affected code is in agent/mibgroup/if-mib/data_access/interface_linux.c.
There's also a patch in this bug report: http://sourceforge.net/p/net-snmp/bugs/2449/
I resolved the issue using the stock snmpd that comes with the Raspbian.
In /etc/snmp/snmpd.conf file I isolated the issue to the following line
agentAddress udp:161,udp6:[::1]:161
Instead of listening on all interfaces, if I specify the the ip address of the eth0 interface i.e.:
agentAddress udp:10.0.1.5:161,udp6:[::1]:161
Then snmpd starts fine.
My speculation is that the stock snmpd tries to enumerate all possible interfaces including the pci ones.

Resources