Skip to content

Commit 4bd06fd

Browse files
committed
Sync with 2.22.5
* maint-2.22: Git 2.22.5 Git 2.21.4 Git 2.20.5 Git 2.19.6 Git 2.18.5 Git 2.17.6 unpack_trees(): start with a fresh lstat cache run-command: invalidate lstat cache after a command finished checkout: fix bug that makes checkout follow symlinks in leading path
2 parents f2771ef + c753e2a commit 4bd06fd

15 files changed

+235
-4
lines changed

Documentation/RelNotes/2.17.6.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Git v2.17.6 Release Notes
2+
=========================
3+
4+
This release addresses the security issues CVE-2021-21300.
5+
6+
Fixes since v2.17.5
7+
-------------------
8+
9+
* CVE-2021-21300:
10+
On case-insensitive file systems with support for symbolic links,
11+
if Git is configured globally to apply delay-capable clean/smudge
12+
filters (such as Git LFS), Git could be fooled into running
13+
remote code during a clone.
14+
15+
Credit for finding and fixing this vulnerability goes to Matheus
16+
Tavares, helped by Johannes Schindelin.

Documentation/RelNotes/2.18.5.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Git v2.18.5 Release Notes
2+
=========================
3+
4+
This release merges up the fixes that appear in v2.17.6 to address
5+
the security issue CVE-2021-21300; see the release notes for that
6+
version for details.

Documentation/RelNotes/2.19.6.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Git v2.19.6 Release Notes
2+
=========================
3+
4+
This release merges up the fixes that appear in v2.17.6 and
5+
v2.18.5 to address the security issue CVE-2021-21300; see the
6+
release notes for these versions for details.

Documentation/RelNotes/2.20.5.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Git v2.20.5 Release Notes
2+
=========================
3+
4+
This release merges up the fixes that appear in v2.17.6, v2.18.5
5+
and v2.19.6 to address the security issue CVE-2021-21300; see
6+
the release notes for these versions for details.

Documentation/RelNotes/2.21.4.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Git v2.21.4 Release Notes
2+
=========================
3+
4+
This release merges up the fixes that appear in v2.17.6, v2.18.5,
5+
v2.19.6 and v2.20.5 to address the security issue CVE-2021-21300;
6+
see the release notes for these versions for details.

Documentation/RelNotes/2.22.5.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Git v2.22.5 Release Notes
2+
=========================
3+
4+
This release merges up the fixes that appear in v2.17.6,
5+
v2.18.5, v2.19.6, v2.20.5 and v2.21.4 to address the security
6+
issue CVE-2021-21300; see the release notes for these versions
7+
for details.

cache.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1631,6 +1631,7 @@ int has_symlink_leading_path(const char *name, int len);
16311631
int threaded_has_symlink_leading_path(struct cache_def *, const char *, int);
16321632
int check_leading_path(const char *name, int len);
16331633
int has_dirs_only_path(const char *name, int len, int prefix_len);
1634+
void invalidate_lstat_cache(void);
16341635
void schedule_dir_for_removal(const char *name, int len);
16351636
void remove_scheduled_dirs(void);
16361637

compat/mingw.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,8 @@ int mingw_rmdir(const char *pathname)
340340
ask_yes_no_if_possible("Deletion of directory '%s' failed. "
341341
"Should I try again?", pathname))
342342
ret = _wrmdir(wpathname);
343+
if (!ret)
344+
invalidate_lstat_cache();
343345
return ret;
344346
}
345347

git-compat-util.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,11 @@ static inline int noop_core_config(const char *var, const char *value, void *cb)
364364
#define platform_core_config noop_core_config
365365
#endif
366366

367+
int lstat_cache_aware_rmdir(const char *path);
368+
#if !defined(__MINGW32__) && !defined(_MSC_VER)
369+
#define rmdir lstat_cache_aware_rmdir
370+
#endif
371+
367372
#ifndef has_dos_drive_prefix
368373
static inline int git_has_dos_drive_prefix(const char *path)
369374
{

run-command.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,7 @@ int finish_command(struct child_process *cmd)
989989
int ret = wait_or_whine(cmd->pid, cmd->argv[0], 0);
990990
trace2_child_exit(cmd, ret);
991991
child_process_clear(cmd);
992+
invalidate_lstat_cache();
992993
return ret;
993994
}
994995

@@ -1289,13 +1290,19 @@ int start_async(struct async *async)
12891290
int finish_async(struct async *async)
12901291
{
12911292
#ifdef NO_PTHREADS
1292-
return wait_or_whine(async->pid, "child process", 0);
1293+
int ret = wait_or_whine(async->pid, "child process", 0);
1294+
1295+
invalidate_lstat_cache();
1296+
1297+
return ret;
12931298
#else
12941299
void *ret = (void *)(intptr_t)(-1);
12951300

12961301
if (pthread_join(async->tid, &ret))
12971302
error("pthread_join failed");
1303+
invalidate_lstat_cache();
12981304
return (int)(intptr_t)ret;
1305+
12991306
#endif
13001307
}
13011308

0 commit comments

Comments
 (0)