Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug error when multiple categories added in file_paths #8312

Open
sreeroop opened this issue Apr 19, 2024 · 6 comments
Open

Debug error when multiple categories added in file_paths #8312

sreeroop opened this issue Apr 19, 2024 · 6 comments

Comments

@sreeroop
Copy link

Bug report

What operating system and version are you using?

Windows 11 22H2 (It's a VM)

What version of osquery are you using?

5.12.1 ( I got the same error in 5.8.2 as well )

What steps did you take to reproduce the issue?

Cloned the repo. Then build & install the code (debug package) using Visual Studio 2019 and copied the install directory to VM's 'Program Files' directory.

Used the following config

{
  "file_paths": {
    "downloads": [
      "C:\\Users\\user\\Downloads",
      "C:\\Users\\user\\Downloads\\*"
    ],
    "Documents": [
      "C:\\Users\\user\\Documents",
      "C:\\Users\\user\\Documents\\*"
    ]
  },
  "exclude_paths": {
    "downloads": [
      "C:\\Users\\user\\Downloads\\Hello"
    ]
  },
  "file_accesses": [
    "downloads"
  ]
}

then ran osqueryd --flagfile flag-path --config_path config-path --verbose

What did you expect to see?

Expected the osquery to work without any error.

What did you see instead?

Got the following error from rapidjson

Assertion failed: false, file C:\Users\sreeroop\Desktop\work\osquery\libraries\cmake\source\rapidjson\src\include\rapidjson/document.h, line 1169

Note : Getting this error only if I pass multiple categories in config. If I just give one category it won't throw this error. And the config is a valid json.

@sreeroop
Copy link
Author

Build the osquery with configurationType as Release and this works without any error. That concludes that there is no issue in config.

@Smjert Smjert added the bug label Apr 26, 2024
@Smjert
Copy link
Member

Smjert commented Apr 26, 2024

@Smjert
Copy link
Member

Smjert commented Apr 26, 2024

@sreeroop I'm not able to trigger that assert here (I'm testing on macOS but it shouldn't matter).

Would you be able to attach a debugger to osquery and get a stack trace for that assert?

I'm a bit puzzled because if that's the assert, it seems like it's using the [] operator to get an element that doesn't exist, but in the code of the file_paths parsing there's only one use that I can see, and that looks fine, and especially it's not dependent on the format of the "file_paths" key.

@sreeroop
Copy link
Author

@Smjert

I'm surprised that it's not occurring in your system. I have tried 2 different osquery versions and got it from both of them.

Anyways
I've attached the osquery process to VS debugger.

Attaching the SS below. Since I'm a beginner I don't have a clear picture what this means.(I hope attaching picture is okay.)

SS1.jpg

SS2.jpg

Can you please check these and let know, if this has what you are looking for?

If it's not there, please tell me how to get these.

PS: I've search for .pdb file. But couldn't find one.

TIA

@Smjert
Copy link
Member

Smjert commented Apr 26, 2024

It's also strange that you don't have a PDB file, or symbols in the stack trace if you did a debug build. You did display the right thing (the call stack), but I'm confused on why it's all addresses and not function names.
Can you give the CMake configuration parameters you used?

Also if you could just copy the whole content as text of the call stack tab at the bottom, it would be helpful in case we only get addresses.

@sreeroop
Copy link
Author

cmake config

{
  "configurations": [
    {
      "name": "x64-Debug",
      "generator": "Ninja",
      "configurationType": "Debug",
      "inheritEnvironments": [ "msvc_x64_x64" ],
      "buildRoot": "${projectDir}\\out\\build\\${name}",
      "installRoot": "${projectDir}\\out\\install\\${name}",
      "cmakeCommandArgs": "",
      "cmakeExecutable": "C:\\Program Files\\CMake\\bin\\cmake.exe",
      "buildCommandArgs": "",
      "ctestCommandArgs": ""
    }
  ]
}

call stack

>   osqueryd.exe!00007ff680bbf0a5() Unknown
    osqueryd.exe!00007ff680bbf243() Unknown
    osqueryd.exe!00007ff680b690ed() Unknown
    osqueryd.exe!00007ff680b60c25() Unknown
    osqueryd.exe!00007ff680b604a7() Unknown
    osqueryd.exe!00007ff680b5e578() Unknown
    osqueryd.exe!00007ff680b60f1f() Unknown
    osqueryd.exe!00007ff67e45ba2d() Unknown
    osqueryd.exe!00007ff67e45ba97() Unknown
    osqueryd.exe!00007ff67e45f601() Unknown
    osqueryd.exe!00007ff67e57a67f() Unknown
    osqueryd.exe!00007ff67e57e561() Unknown
    osqueryd.exe!00007ff67e57bcd1() Unknown
    osqueryd.exe!00007ff67e57ace6() Unknown
    osqueryd.exe!00007ff67e6af175() Unknown
    osqueryd.exe!00007ff67e698d9f() Unknown
    osqueryd.exe!00007ff67e5798e1() Unknown
    osqueryd.exe!00007ff6805bf5e1() Unknown
    osqueryd.exe!00007ff67e6ca2a2() Unknown
    osqueryd.exe!00007ff67e6d65d8() Unknown
    osqueryd.exe!00007ff67f20bec8() Unknown
    osqueryd.exe!00007ff680bfeab6() Unknown
    osqueryd.exe!00007ff680bfe5ae() Unknown
    osqueryd.exe!00007ff680bfd4f8() Unknown
    osqueryd.exe!00007ff680ad16a9() Unknown
    osqueryd.exe!00007ff680ad15fe() Unknown
    osqueryd.exe!00007ff680ad14be() Unknown
    osqueryd.exe!00007ff680ad171e() Unknown
    kernel32.dll!BaseThreadInitThunk()  Unknown
    ntdll.dll!00007ffe2da4aa58()    Unknown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants