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

            Bug ID: 456171
           Summary: [PATCH] FreeBSD: Don't record address errors when
                    accessing the 'kern.ps_strings' sysctl struct
           Product: valgrind
           Version: 3.20 GIT
          Platform: Other
                OS: FreeBSD
            Status: REPORTED
          Severity: minor
          Priority: NOR
         Component: memcheck
          Assignee: jsew...@acm.org
          Reporter: obi...@gmail.com
  Target Milestone: ---

Created attachment 150290
  --> https://bugs.kde.org/attachment.cgi?id=150290&action=edit
Quick patch

SUMMARY

This is necessary to prevent address errors coming from functions (from libc or
otherwise) trying to read/write to the 'ps_strings' structure ('sys/exec.h')
pointed to by the 'kern.ps_strings' sysctl. (Fixes setproctitle(3) &
setproctitle_fast(3).)

Done by always calling 'init_gIgnoredAddressRanges' when starting memcheck on
FreeBSD, which in turn adds the various ranges pointed to by the 'ps_strings'
struct.

There may be a much more elegant way of doing this, this is my first time
messing around in the Valgrind source!
Apologies also for the rather large diff; there were a lot of trailing
whitespaces in 'memcheck/mc_main.c' which my editor deleted.

STEPS TO REPRODUCE

Run Valgrind on FreeBSD on a program which calls setproctitle(3) or
setproctitle_fast(3).

OBSERVED RESULT

Many address errors.

EXPECTED RESULT

No address errors.

SOFTWARE/OS VERSIONS

FreeBSD 13.0-RELEASE-p4

ADDITIONAL INFORMATION

/

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

Reply via email to