Since evicting inodes triggers writes to the backing file, which uses
the mi_owner field from the mount_info struct, make sure inodes are
evicted before we free the mount_info data
Test: incfs_test
Bug: 270117845
Change-Id: I673b2e0e04b5adc3998caf6f22443598a30338af
Signed-off-by: Paul Lawrence <paullawrence@google.com>
(cherry picked from commit 7899985277527b29c47929a6d6a89c5c89b406ad)
(cherry picked from commit faf3626b8e34df3dfff3a99e6582a9abd24410ce)
Signed-off-by: Lee Jones <joneslee@google.com>
Syzbot recently found a number of issues related to incremental-fs
(see bug numbers below). All have to do with the fact that incr-fs
allows mounts of the same source and target multiple times.
This is a design decision and the user space component "Data Loader"
expects this to work for app re-install use case.
The mounting depth needs to be controlled, however, and only allowed
to be two levels deep. In case of more than two mount attempts the
driver needs to return an error.
In case of the issues listed below the common pattern is that the
reproducer calls:
mount("./file0", "./file0", "incremental-fs", 0, NULL)
many times and then invokes a file operation like chmod, setxattr,
or open on the ./file0. This causes a recursive call for all the
mounted instances, which eventually causes a stack overflow and
a kernel crash:
BUG: stack guard page was hit at ffffc90000c0fff8
kernel stack overflow (double-fault): 0000 [#1] PREEMPT SMP KASAN
This change also cleans up the mount error path to properly clean
allocated resources and call deactivate_locked_super(), which
causes the incfs_kill_sb() to be called, where the sb is freed.
Bug: 211066171
Bug: 213140206
Bug: 213215835
Bug: 211914587
Bug: 211213635
Bug: 213137376
Bug: 211161296
Signed-off-by: Tadeusz Struk <tadeusz.struk@linaro.org>
Change-Id: I08d9b545a2715423296bf4beb67bdbbed78d1be1
This reverts commit 4ab5bac1598e3ed91a6267f6cada336467312112 and
2da7ed1f781983a2bc818f1d6f7cc9f2fa3ff1d2.
This is to fix the incrementalinstall test.
Can now install the same apk twice, and repeated installs are stable.
Bug: 217661925
Bug: 219731048
Signed-off-by: Tadeusz Struk <tadeusz.struk@linaro.org>
Change-Id: I77f038b296041b329060ff9350e4c9711f5ed91d
Cleanup incremental-fs left overs on umount, otherwise incr-fs will
complain as below:
BUG: Dentry {i=47a,n=.incomplete} still in use [unmount of incremental-fs]
This requires vfs_rmdir() of the special index dir.
Since set_anon_super() was used in incfs_mount_fs() the incfs_kill_sb()
should use kill_anon_super() instead of generic_shutdown_super()
otherwise it will leak the pseudo dev_t that set_anon_super() allocates.
Bug: 211066171
Signed-off-by: Tadeusz Struk <tadeusz.struk@linaro.org>
Change-Id: I7ea54db63513fc130e1997cbf79121015ee12405
Syzbot recently found a number of issues related to incremental-fs
(see bug numbers below). All have to do with the fact that incr-fs
allows mounts of the same source and target multiple times.
The correct behavior for a file system is to allow only one such
mount, and then every subsequent attempt should fail with a -EBUSY
error code. In case of the issues listed below the common pattern
is that the reproducer calls:
mount("./file0", "./file0", "incremental-fs", 0, NULL)
many times and then invokes a file operation like chmod, setxattr,
or open on the ./file0. This causes a recursive call for all the
mounted instances, which eventually causes a stack overflow and
a kernel crash:
BUG: stack guard page was hit at ffffc90000c0fff8
kernel stack overflow (double-fault): 0000 [#1] PREEMPT SMP KASAN
The reason why many mounts with the same source and target are
possible is because the incfs_mount_fs() as it is allocates a new
super_block for every call, regardless of whether a given mount already
exists or not. This happens every time the sget() function is called
with a test param equal to NULL.
The correct behavior for an FS mount implementation is to call
appropriate mount vfs call for it's type, i.e. mount_bdev() for
a block device backed FS, mount_single() for a pseudo file system,
like sysfs that is mounted in a single, well know location, or
mount_nodev() for other special purpose FS like overlayfs.
In case of incremental-fs the open coded mount logic doesn't check
for abusive mount attempts such as overlays.
To fix this issue the logic needs to be changed to pass a proper
test function to sget() call, which then checks if a super_block
for a mount instance has already been allocated and also allows
the VFS to properly verify invalid mount attempts.
Bug: 211066171
Bug: 213140206
Bug: 213215835
Bug: 211914587
Bug: 211213635
Bug: 213137376
Bug: 211161296
Signed-off-by: Tadeusz Struk <tadeusz.struk@linaro.org>
Change-Id: I66cfc3f1b5aaffb32b0845b2dad3ff26fe952e27
Use same selinux scheme as incfs v2
Fix memory leak
Bug: 174692664
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I6058ddad9d43ba01b2eabd7d3c576f2cc9b42292
This reverts commit 0201fbedeb871293b5109786f4de6c3fe01746d6.
Set incfs back to rvc shipping incfs
Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: Ic2e3a91943f67601fff3c2b8696cc11bb7069b04
This reverts commit d124911d0832c9d4a42979ad4f68eebe100db30a.
Set incfs back to rvc shipping incfs
Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: Ifa9b4afee5b143879d734576764967ffb7a15e77
This reverts commit 9540a2c0de66fc55825601db8b3101a087840cca.
Set incfs back to rvc shipping incfs
Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I6b9c5fa2f21c718ab1330e441ab66b17c1907225
This reverts commit e7ee942c0366c9e4657465c760f532c300061d20.
Set incfs back to rvc shipping incfs
Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I78092cc580b196da60c1a194e3fc94037d0c91d9
This reverts commit 21885f49ae23b37ee05a73da7f36177700595ee7.
Set incfs back to rvc shipping incfs
Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I70c212c3b9d3a77429714e12f5020f7bded4a6bc
This reverts commit 3d538dbc4ce562e0467974cd64ebe4fee3eced8a.
Set incfs back to rvc shipping incfs
Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I22f538f270e379da9abf56508f19d69c54c1c5c2
This reverts commit d78af37eedd05b8f3df7eaa894c0e8596f0cc8a5.
Set incfs back to rvc shipping incfs
Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: Ib50924896007f6983728b354a540b5a02fa34d0f
This reverts commit 4e57cc3b29c0eb85e64c9d40a3cbae814f566b4c.
Set incfs back to rvc shipping incfs
Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: Id7a517f5c3f7ec3a6abb8662bc73b0258995da6a
This reverts commit 99c5990637408834c265d58be8452a397cdc558c.
Set incfs back to rvc shipping incfs
Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I4905262b7a27ce516a193e911f0880d7f129b008
This reverts commit ea3a54ef5d4ef1cdabccbd091fa9bfe40d02d2a3.
Set incfs back to rvc shipping incfs
Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I933e13f999c0a0cfc02d54c3aa83b6fd122d2ce2
This reverts commit 664b74271565af7a3c885bba2fdbabd1a2f3e2ea.
Set incfs back to rvc shipping incfs
Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: If4c1cee82cae6863f47db091c3f387cbe80d0859
This reverts commit 0f577422348f6c355f9bda405f960f8140d4fcdf.
Set incfs back to rvc shipping incfs
Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I64dc06b7f763986892f201057d79e69fd7d2810d
This reverts commit 891e6dcc7fec37457b6a55a5f17d5dbf217ae438.
Set incfs back to rvc shipping incfs
Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: If7140b7eff55212d1ad6e52c86e68b1aa1b66499
This reverts commit 1476dc3bbf2eb5036ebc06a1fe0a9f800dd20d3e.
Set incfs back to rvc shipping incfs
Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: If8954d7666ac3624ea5cef79f963d4a636243eab
This reverts commit a1b5df484d5e312319924ed3a0396a7831d73dde.
Set incfs back to rvc shipping incfs
Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I4f77e491e7d80d7c184bf5c53dc4468a42fb07fe
This reverts commit 334f721e51aca57be32e1ef94ae5e8842c5a5284.
Set incfs back to rvc shipping incfs
Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I4d3fa77c3a667abcadc73ee5f190ec1bda408087
This reverts commit 362007bd63e358ef2d46ac234167bd46eaf36066.
Set incfs back to rvc shipping incfs
Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: Id7c7e23df9b524112f84754dd06324e5e91eb09d
This reverts commit 94eb31aaa51e23bca64d1fa1248082b22feffb9f.
Set incfs back to rvc shipping incfs
Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I1d8762d05b1cbf76edff08a91df1772a7476d3b9
This reverts commit 51c82e61db0e43f4c4e63c9a23aa0649bf17db5e.
Set incfs back to rvc shipping incfs
Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: Ieebe0424c0ad6b365f5f655cc1ba9d91c0453760
This reverts commit a527a98b1763b03cc9726d4fda70186ae2d7e294.
Set incfs back to rvc shipping incfs
Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I5252a89dd25b4820205bfdc6881ffeba40080df7
This reverts commit 65652f5a199b74abedda381bcde98405ba326fae.
Set incfs back to rvc shipping incfs
Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I6c485eae362279982d43be6bd3e696ef1f42bcdb
This reverts commit 17efe505a4c3df88d3e13051f421d27d7178d47f.
Set incfs back to rvc shipping incfs
Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: Ic968e106dedb1e355a2779deee1fef788e5230fd
This reverts commit ebdb37cbb1711123bf88dce1c57b9cdf566fca9c.
Set incfs back to rvc shipping incfs
Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: If26171aa33a0041c1322250465afb7a001121c27
This reverts commit 1d85ac54f5911dfef2188601d0e1496d01b0fe62.
Set incfs back to rvc shipping incfs
Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I43458fd22a095c569e66eec5b26bf6a98ee4d835
This reverts commit 4d29b3169cd62534df44c4e793d6a88dbba678ba.
Set incfs back to rvc shipping incfs
Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I8a0c415a00afb3300ebaa6420919338497563b75
This reverts commit c47f87811d216421b20919fbccc031454890c878.
Set incfs back to rvc shipping incfs
Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I04938be6101466e3998372bd574e036f0e2e95e2
This reverts commit 9523a669ca4a59e164af6c42ca2a709637050373.
Set incfs back to rvc shipping incfs
Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: Ib0a5127350bd88a9352c054e4b7215ffd7196dbf
This reverts commit f5e74ee2c465231bcb8c8b582d3c0d86116af47c.
Set incfs back to rvc shipping incfs
Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I3001e4ea6e4d570b8ba970e3c876a4d512653ea2
This reverts commit b08e0c0b32f76b11196ac3ede93e4a72df6c8625.
Set incfs back to rvc shipping incfs
Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: Ie2ef8940218e8fd440dfba22a8b690b0ec6f5945
This reverts commit b38636bf5933cdfc7490ed5bb0cec3893a646bab.
Set incfs back to rvc shipping incfs
Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I4a157323e62592fe73cf329d253a485ea5e51175
This reverts commit f527acab63fd1327c85a27c5be3be4d6222ff053.
Set incfs back to rvc shipping incfs
Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I14395c36f8bdcdffc20ff7b6cff2a377e5a45848
This reverts commit 8278cda5d9767db20d87f2d97e135534c43b07ae.
Set incfs back to rvc shipping incfs
Bug: 178509184
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: Ib62275b2041c92842b6392e7974495897b973e2f
Bug: 174692664
Test: incfs_test passes, incremental installs work with ag/13082306
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: Ib1c924bbaff759f58f7d83bad8e23d7224ba7ed9
Roll report_uid feature flag into v2 feature flag
Bug: 174478527
Test: Feature flag present on boot
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I41ee9715904560004e25cc83a5ccc1eb1bdd2b1f
This commit fixes the error:
fs/incfs/pseudo_files.c:1165:17: error: incompatible types when assigning to
type ‘struct timespec’ from type ‘struct timespec64’
Fixes: 664b74271565 ("ANDROID: Incremental fs: Separate pseudo-file code")
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I0cf24954787c42d475a66ffe0646c47a307bcc26
Rmove bc_mutex used to protect metadata chain, now that is only
read at file open time
Remove certain unused mount options
Bug: 172482559
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: Id70e5a5d08e5de79f391e19ea97e356f39a3ed51
report_uid was not being initialized, leading to random behavior
Bug: 172480517
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: Ib121136d6f570f99e9060bdde9aa43ff2995514e
Found by sparse:
fs/incfs/format.c:416:21: warning: incorrect type in assignment (different base types)
fs/incfs/format.c:416:21: expected restricted __le32 [assigned] [usertype] fh_flags
fs/incfs/format.c:416:21: got int
fs/incfs/pseudo_files.c:925:25: warning: incorrect type in argument 4 (different base types)
fs/incfs/pseudo_files.c:925:25: expected unsigned long long [usertype] size
fs/incfs/pseudo_files.c:925:25: got restricted __le64 [addressable] [assigned] [usertype] size_attr_value
fs/incfs/pseudo_files.c:925:42: warning: incorrect type in argument 5 (different base types)
fs/incfs/pseudo_files.c:925:42: expected unsigned long long [usertype] offset
fs/incfs/pseudo_files.c:925:42: got restricted __le64 [usertype]
fs/incfs/pseudo_files.c:1111:24: warning: incorrect type in return expression (different base types)
fs/incfs/pseudo_files.c:1111:24: expected restricted __poll_t
fs/incfs/pseudo_files.c:1111:24: got int
Bug: 169258814
Fixes: Sparse errors introduced by 3f4938108a7ad, 8334d69e65f60 and cb776f45766a6
Test: incfs_test passes, sparse shows no errors
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I48596e9521069fc77bf38c345a568529d61c77dc