<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/fsmonitor.c, branch v2.24.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.24.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.24.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2019-10-12T01:16:11Z</updated>
<entry>
<title>fsmonitor: don't fill bitmap with entries to be removed</title>
<updated>2019-10-12T01:16:11Z</updated>
<author>
<name>William Baker</name>
<email>William.Baker@microsoft.com</email>
</author>
<published>2019-10-11T20:11:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3444ec2eb2be58c285d2bf04f39e6e9ea5eda9a2'/>
<id>urn:sha1:3444ec2eb2be58c285d2bf04f39e6e9ea5eda9a2</id>
<content type='text'>
While doing some testing with fsmonitor enabled I found
that git commands would segfault after staging and
unstaging an untracked file.  Looking at the crash it
appeared that fsmonitor_ewah_callback was attempting to
adjust bits beyond the bounds of the index cache.

Digging into how this could happen it became clear that
the fsmonitor extension must have been written with
more bits than there were entries in the index.  The
root cause ended up being that fill_fsmonitor_bitmap was
populating fsmonitor_dirty with bits for all entries in
the index, even those that had been marked for removal.

To solve this problem fill_fsmonitor_bitmap has been
updated to skip entries with the the CE_REMOVE flag set.
With this change the bits written for the fsmonitor
extension will be consistent with the index entries
written by do_write_index.  Additionally, BUG checks
have been added to detect if the number of bits in
fsmonitor_dirty should ever exceed the number of
entries in the index again.

Another option that was considered was moving the call
to fill_fsmonitor_bitmap closer to where the index is
written (and where the fsmonitor extension itself is
written).  However, that did not work as the
fsmonitor_dirty bitmap must be filled before the index
is split during writing.

Signed-off-by: William Baker &lt;William.Baker@microsoft.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'cb/fsmonitor-intfix'</title>
<updated>2019-07-09T22:25:38Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-07-09T22:25:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ceca45541d0046544cc95acb6b849c14637e0e3e'/>
<id>urn:sha1:ceca45541d0046544cc95acb6b849c14637e0e3e</id>
<content type='text'>
Variable type fix.

* cb/fsmonitor-intfix:
  fsmonitor: avoid signed integer overflow / infinite loop
</content>
</entry>
<entry>
<title>fsmonitor: avoid signed integer overflow / infinite loop</title>
<updated>2019-06-18T01:14:29Z</updated>
<author>
<name>Carlo Marcelo Arenas Belón</name>
<email>carenas@gmail.com</email>
</author>
<published>2019-06-15T16:11:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5d137fc2c7ba08455b2734c8e2ca9b9a284f3706'/>
<id>urn:sha1:5d137fc2c7ba08455b2734c8e2ca9b9a284f3706</id>
<content type='text'>
883e248b8a ("fsmonitor: teach git to optionally utilize a file system
monitor to speed up detecting new or changed files.", 2017-09-22) uses
an int in a loop that would wrap if index_state-&gt;cache_nr (unsigned)
is bigger than INT_MAX

Signed-off-by: Carlo Marcelo Arenas Belón &lt;carenas@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>fsmonitor: force a refresh after the index was discarded</title>
<updated>2019-05-08T03:03:48Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2019-05-07T11:10:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=398a3b0899dd8a440d4adbcbda38362e3f8359b1'/>
<id>urn:sha1:398a3b0899dd8a440d4adbcbda38362e3f8359b1</id>
<content type='text'>
With this change, the `index_state` struct becomes the new home for the
flag that says whether the fsmonitor hook has been run, i.e. it is now
per-index.

It also gets re-set when the index is discarded, fixing the bug
demonstrated by the "test_expect_failure" test added in the preceding
commit. In that case fsmonitor-enabled Git would miss updates under
certain circumstances, see that preceding commit for details.

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/snprintf-truncation'</title>
<updated>2018-05-30T12:51:28Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-05-30T12:51:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7c3d15fe3113cf48db60656eedd152c46f47bf6b'/>
<id>urn:sha1:7c3d15fe3113cf48db60656eedd152c46f47bf6b</id>
<content type='text'>
Avoid unchecked snprintf() to make future code auditing easier.

* jk/snprintf-truncation:
  fmt_with_err: add a comment that truncation is OK
  shorten_unambiguous_ref: use xsnprintf
  fsmonitor: use internal argv_array of struct child_process
  log_write_email_headers: use strbufs
  http: use strbufs instead of fixed buffers
</content>
</entry>
<entry>
<title>fsmonitor: use internal argv_array of struct child_process</title>
<updated>2018-05-21T00:58:56Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2018-05-19T08:27:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=735e4173b3feba0cc495bbb2dd85341b6378f628'/>
<id>urn:sha1:735e4173b3feba0cc495bbb2dd85341b6378f628</id>
<content type='text'>
Avoid magic array sizes and indexes by constructing the fsmonitor
command line using the embedded argv_array of the child_process.  The
resulting code is shorter and easier to extend.

Getting rid of the snprintf() calls is a bonus -- even though the
buffers were big enough here to avoid truncation -- as it makes auditing
the remaining callers easier.

Inspired-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Rene Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'bp/fsmonitor-prime-index'</title>
<updated>2018-04-25T04:29:04Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-04-25T04:29:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7a79d7e9fb187f17515053f616d3eca13c9c1585'/>
<id>urn:sha1:7a79d7e9fb187f17515053f616d3eca13c9c1585</id>
<content type='text'>
The index file is updated to record the fsmonitor section after a
full scan was made, to avoid wasting the effort that has already
spent.

* bp/fsmonitor-prime-index:
  fsmonitor: force index write after full scan
</content>
</entry>
<entry>
<title>Merge branch 'bp/fsmonitor-bufsize-fix'</title>
<updated>2018-04-25T04:29:03Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-04-25T04:29:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=beed7e22fdc81ba325c4bfaadf84d23f5c697d93'/>
<id>urn:sha1:beed7e22fdc81ba325c4bfaadf84d23f5c697d93</id>
<content type='text'>
Fix an unexploitable (because the oversized contents are not under
attacker's control) buffer overflow.

* bp/fsmonitor-bufsize-fix:
  fsmonitor: fix incorrect buffer size when printing version number
</content>
</entry>
<entry>
<title>fsmonitor: force index write after full scan</title>
<updated>2018-04-11T09:09:48Z</updated>
<author>
<name>Ben Peart</name>
<email>benpeart@microsoft.com</email>
</author>
<published>2018-04-10T18:14:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ca598d5f2ab988935a5b882b44122cbfa5fd99f5'/>
<id>urn:sha1:ca598d5f2ab988935a5b882b44122cbfa5fd99f5</id>
<content type='text'>
fsmonitor currently only flags the index as dirty if the extension is being
added or removed. This is a performance optimization that recognizes you can
stat() a lot of files in less time than it takes to write out an updated index.

This patch makes a small enhancement and flags the index dirty if we end up
having to stat() all files and scan the entire working directory.  The assumption
being that must be expensive or you would not have turned on the feature.

Signed-off-by: Ben Peart &lt;benpeart@microsoft.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>fsmonitor: fix incorrect buffer size when printing version number</title>
<updated>2018-04-11T06:28:34Z</updated>
<author>
<name>Ben Peart</name>
<email>Ben.Peart@microsoft.com</email>
</author>
<published>2018-04-10T18:43:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d8579accfaea398a157a3a8ad2ca6cac25f1b999'/>
<id>urn:sha1:d8579accfaea398a157a3a8ad2ca6cac25f1b999</id>
<content type='text'>
This is a trivial bug fix for passing the incorrect size to snprintf() when
outputting the version.  It should be passing the size of the destination buffer
rather than the size of the value being printed.

Signed-off-by: Ben Peart &lt;benpeart@microsoft.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
