Commit 39fd0cc
coredump: Use the vma snapshot in fill_files_note
commit 390031c upstream.
Matthew Wilcox reported that there is a missing mmap_lock in
file_files_note that could possibly lead to a user after free.
Solve this by using the existing vma snapshot for consistency
and to avoid the need to take the mmap_lock anywhere in the
coredump code except for dump_vma_snapshot.
Update the dump_vma_snapshot to capture vm_pgoff and vm_file
that are neeeded by fill_files_note.
Add free_vma_snapshot to free the captured values of vm_file.
Reported-by: Matthew Wilcox <willy@infradead.org>
Link: https://lkml.kernel.org/r/20220131153740.2396974-1-willy@infradead.org
Cc: stable@vger.kernel.org
Fixes: a07279c ("binfmt_elf, binfmt_elf_fdpic: use a VMA list snapshot")
Fixes: 2aa362c ("coredump: extend core dump note section to contain file names of mapped files")
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent cabd696 commit 39fd0cc
3 files changed
+35
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1618 | 1618 | | |
1619 | 1619 | | |
1620 | 1620 | | |
1621 | | - | |
| 1621 | + | |
1622 | 1622 | | |
1623 | | - | |
1624 | | - | |
1625 | 1623 | | |
1626 | 1624 | | |
1627 | 1625 | | |
1628 | 1626 | | |
| 1627 | + | |
1629 | 1628 | | |
1630 | 1629 | | |
1631 | | - | |
| 1630 | + | |
1632 | 1631 | | |
1633 | 1632 | | |
1634 | 1633 | | |
| |||
1650 | 1649 | | |
1651 | 1650 | | |
1652 | 1651 | | |
1653 | | - | |
| 1652 | + | |
| 1653 | + | |
1654 | 1654 | | |
1655 | 1655 | | |
1656 | 1656 | | |
1657 | | - | |
| 1657 | + | |
1658 | 1658 | | |
1659 | 1659 | | |
1660 | 1660 | | |
| |||
1674 | 1674 | | |
1675 | 1675 | | |
1676 | 1676 | | |
1677 | | - | |
1678 | | - | |
1679 | | - | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
1680 | 1680 | | |
1681 | 1681 | | |
1682 | 1682 | | |
| |||
1687 | 1687 | | |
1688 | 1688 | | |
1689 | 1689 | | |
1690 | | - | |
| 1690 | + | |
1691 | 1691 | | |
1692 | 1692 | | |
1693 | 1693 | | |
| |||
1886 | 1886 | | |
1887 | 1887 | | |
1888 | 1888 | | |
1889 | | - | |
| 1889 | + | |
1890 | 1890 | | |
1891 | 1891 | | |
1892 | 1892 | | |
| |||
2075 | 2075 | | |
2076 | 2076 | | |
2077 | 2077 | | |
2078 | | - | |
| 2078 | + | |
2079 | 2079 | | |
2080 | 2080 | | |
2081 | 2081 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
| |||
834 | 835 | | |
835 | 836 | | |
836 | 837 | | |
837 | | - | |
| 838 | + | |
838 | 839 | | |
839 | 840 | | |
840 | 841 | | |
| |||
1111 | 1112 | | |
1112 | 1113 | | |
1113 | 1114 | | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
1114 | 1129 | | |
1115 | 1130 | | |
1116 | 1131 | | |
| |||
1147 | 1162 | | |
1148 | 1163 | | |
1149 | 1164 | | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
1150 | 1170 | | |
1151 | 1171 | | |
1152 | 1172 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
| |||
0 commit comments