https://bugs.kde.org/show_bug.cgi?id=388786

Quentin Monnet <quentin.monnet+...@netronome.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |quentin.monnet+kde@netronom
                   |                            |e.com

--- Comment #1 from Quentin Monnet <quentin.monnet+...@netronome.com> ---
Created attachment 112113
  --> https://bugs.kde.org/attachment.cgi?id=112113&action=edit
[PATCH valgrind 1/3] Linux: Get pre_check for ASCII string out of
PRE(sys_prctl)

Hi,

I am interested as well in getting support for the bpf() sytem call in
Valgrind, and would like to help getting this bug resolved.

I also have a series that implements support for the syscall. I do not want to
steal the spotlight from spacewanderlzx, it simply happens that I started to
develop it before that bug was created, got distracted, then finished it and
only realised that this bug existed after my patches were ready. Since my
version seems more complete to me, I thought I would post it anyway. I hope
this is not a problem, please tell me if that was inappropriate.

So this series is a set of three patches for supporting bpf() syscall on amd64
(as was the original patch). As far as I know, the syscall is not
platform-specific and it should be trivial to later extend it to other
architectures.

First patch is a minor refactoring of a snippet used to process and run
pre-checks for ASCII strings to read from the parameters of a system call. It
is extracted from PRE(sys_prctl) and moved to a static function, as it is
reused in a later patch with PRE(sys_bpf) wrapper.

The second patch is the main one, and adds the PRE() and POST() wrappers for
the bpf() system call. Since bpf() uses a set of subcommands, and process its
arguments in different ways depending on the selected subcommand, the wrappers
reflect this and add relevant pre- and post-checks for read and write
operations for each of the available subcommands.

To make review easier, validation and tracking for file descriptors are only
added in a third patch. It could be squashed with the previous patch, depending
on maintainers' preferences.

For me as well, this is the first attempt at adding support for a system call
to Valgrind, hence there is a number of implementation details I am unsure of.
Please see in particular the notes I appended to the commit log of the second
patch.

The patches compile and run. I tried to run valgrind on a program using bpf()
syscalls, and everything goes fine. Tracking the file descriptors works too.
However, I do not use valgrind so often and I do not know how to test the
wrappers in-depth. For example, how could I validate that I used the correct
sizes for pre- and post- read/write checks in the wrappers? On my simple tests,
Valgrind would show no output difference when I would change the sizes or even
remove some pre- or post-checks from the wrappers.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to