SDK from custom image using Linux BSP 2.8.7

We have built a custom image that we are using on our custom board with no problems.
From this custom image we generate our on SDK that we are using to build our apps with no problem.

We have an application that run on this Linux image as a service with no problems at all.
But recently my team asked me the need to validate some address used by variables of this app.

I found that has a function named virt_addr_valid, and here has a sample of using this function.
But my team can not found this function in our custom SDK, and when try to compile the app using this function got erro sayng that this function can not be found.

May be we are missing to include some header file, or our SDK does not have built with some headers.

Can you help me with this problem or guid me to another solution to this address validation?

Colibri iMX6S 256MB V1.1A IT
Iris Carrier Board V1.1A
Linux BSP 2.1.8

Hello, @v.balestero

Thank you for contacting us!

First, I’d like to ask some questions in order to proceed with the support:

  • To confirm, which BSP are you using?

  • Which SDK version do you use? The standard or the extensible?

  • Could you provide me which recipes did you include on your custom image?

  • Could you describe me a bit more about your application? Thus, I can better understand your needs and the problem

Best regards,
Felipe Madureira

Hello, @felipe.tx

  • To confirm, which BSP are you using?
    We are using BSP 2.8.7.

  • Which SDK version do you use? The standard or the extensible?
    None of above, the SDK was generated from our custom image, using the command:
    bitbake console-tdx-image -c populate_sdk.

  • Could you provide me which recipes did you include on your custom image?
    The recipes included are: icu, stress, openssl logrotate rsync net-snmp net-snmp-server sqlite3 python3 nodejs nodejs-npm.

  • Could you describe me a bit more about your application?
    Our system has a command which dumps a range of memory specified by the user, but in order to avoid an exception of segmentation fault, we would like to check if all address in the range are valid.
    We have found the function virt_addr_valid() that is mentioned in the stackoverflow site and it is also used in an example at toradex git (here).
    But we trying to use it but when we try to compile our application the linker does not find it.

Below is our custom layer tree:

meta-smar-df63ng
├── conf
│   ├── layer.conf
│   └── machine
│       └── df63ng.conf
├── local.conf
├── recipes-connectivity
│   └── smar-webapi
│       ├── files
│       └── smar-webapi_1.0.4.bb
├── recipes-core
│   ├── base-files
│   │   ├── base-files
│   │   └── base-files_3.0.14.bbappend
│   ├── os-release
│   │   └── os-release.bbappend
│   └── systemd
│       ├── files
│       └── systemd_%.bbappend
├── recipes-devtools
│   └── nodejs
│       ├── nodejs
│       └── nodejs_11.15.0.bb
├── recipes-extended
│   └── smar-monitor
│       ├── files
│       └── smar-monitor_2.0.0.3.bb
├── recipes-images
│   └── images
│       ├── console-tdx-image.bb
│       ├── files
│       └── tdx-image-fstype.inc
├── recipes-kernel
│   └── linux
│       ├── linux-toradex-rt-4.9-2.3.x
│       └── linux-toradex-rt_4.9-2.3.x.bbappend
├── recipes-protocols
│   └── net-snmp
│       ├── files
│       ├── net-snmp
│       ├── net-snmp_5.8.bb
│       └── sources
└── recipes-support
    ├── icu
    └── stress
        ├── files
        └── stress_1.0.4.bb

Best regards,
Vilson Balestero

Hi @v.balestero,

Sorry for the delay. We are currently working on your issue. We will return to you as soon as possible.

Best regards,
André

Hi @v.balestero,

Since virt_addr_valid() is a kernel function which is used to verify kernel memory addresses, it is not part of the SDK because it is not expected/valid to be used in userspace.

Also, according to this first stackoverflow answer, it is probably not possible to have an userspace equivalent of such function.

In order to better support you, can you please explain why would the user need to acquire memory dumps? Which memory areas are these?

Best regards,
André

Thanks @andre_m.tx ,

The dumps is for our development team to debug only.
But, we found a way to dump or app memory addresses using /proc//map_files.

Best regards,
Vilson Balestero