Giter Club home page Giter Club logo

Comments (6)

qmonnet avatar qmonnet commented on August 15, 2024 1

Thanks a lot!
Patchwork: https://patchwork.kernel.org/project/netdevbpf/patch/[email protected]/
ML archives: https://lore.kernel.org/all/[email protected]/t/#u

from bpftool.

qmonnet avatar qmonnet commented on August 15, 2024

Thanks for the report!

The raw bytes look right (this is the initial state of the array) but the formatted output is wrong.

Interesting, I wonder what could be the cause. If you have a chance to build locally and run with GDB on your setup, it would be interesting to see what value is passed to jsonw_bool() in btf_dumper_int() (here). Otherwise I'll try to reproduce on my side, but I don't have a 32-bit setup at hand right now.

from bpftool.

atapie avatar atapie commented on August 15, 2024

Thanks for the pointer! I ran it under gdb and the value passed to jsonw_bool is true. I think the problem is the caller:

	case BTF_INT_BOOL:
		jsonw_bool(jw, *(int *)data);
		break;

The struct layout is:

a: 4 byte
b: 4 byte
c: 2 byte
d: 1 byte
padding: 1 byte

data is a pointer to d so casting to int * and dereference it will read outside the struct boundary right?

from bpftool.

qmonnet avatar qmonnet commented on August 15, 2024

Right, your analysis sounds correct. Have you tried replacing int * with bool *? If it fixes the issue, would you like to submit a patch to the mailing list? I can send one otherwise.

from bpftool.

atapie avatar atapie commented on August 15, 2024

Making it bool * fixes the issue. I submitted a patch to [email protected] since the change is straightforward but not sure yet how to link it to this issue though.

from bpftool.

qmonnet avatar qmonnet commented on August 15, 2024

Fixed in https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=7184aef9c0f7a81db8fd18d183ee42481d89bf35, well done. I'll pull it here at the next sync.

from bpftool.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.