[PATCH] Remove clobber_region() etc

Andrew Bartlett abartlet at samba.org
Tue Mar 22 00:37:12 MDT 2011

I'm back working on Samba again, and one thing that has come up working
with Tridge today is the clobber_region() code, which I added with
Martin Pool in 2003, in an attempt to find a pstrcpy() into an

These days this is one of the larger differences in behaviour that is
triggered by -D DEVELOPER, which we otherwise try and avoid because
differing behaviour makes reproducing customer issues more difficult. 

Back in 2003, the idea was that, we would write to the full pstring in
the hope that we would break something bad enough to notice if we were
doing so into a fstring.  Then, in the resulting panic, we would print
the location of the last clobber_region() into the logs.  We even marked
the area as being valgrind unclean if it was compiled with -DVALGRIND
and the right headers.  At some stage it became a -DDEVELOPER only thing
due to the performance hit. 

We don't have pstrings any more, so the underlying risk has changed.
Has anyone found any bugs using this code in the past few years?

As such I propose to remove the clobber_region() calls and the extra
functions arguments they required.  What do others think?

(The compile-time macros still work, and as they found a bug only today,
I'm not inclined to remove them.)

Andrew Bartlett
Andrew Bartlett                                http://samba.org/~abartlet/
Authentication Developer, Samba Team           http://samba.org
Samba Developer, Cisco Inc.

More information about the samba-technical mailing list