From: Greg Kroah-Hartman Date: Thu, 29 Aug 2024 13:55:51 +0000 (+0200) Subject: fix up binfmt patch X-Git-Tag: v6.1.107~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7c74d74e6e8413ef89c4a785566736f83a1d03d8;p=thirdparty%2Fkernel%2Fstable-queue.git fix up binfmt patch --- diff --git a/queue-4.19/binfmt_misc-cleanup-on-filesystem-umount.patch b/queue-4.19/binfmt_misc-cleanup-on-filesystem-umount.patch index 4efb838ad05..c249b6ecb86 100644 --- a/queue-4.19/binfmt_misc-cleanup-on-filesystem-umount.patch +++ b/queue-4.19/binfmt_misc-cleanup-on-filesystem-umount.patch @@ -85,27 +85,6 @@ Acked-by: Serge Hallyn Signed-off-by: Christian Brauner Signed-off-by: Christian Brauner Signed-off-by: Kees Cook ---- -/* v2 */ -- Christian Brauner : - - Add more comments that explain what's going on. - - Rename functions while changing them to better reflect what they are - doing to make the code easier to understand. - - In the first version when a specific binary type handler was removed - either through a write to the entry's file or all binary type - handlers were removed by a write to the binfmt_misc mount's status - file all cleanup work happened during inode eviction. - That includes removal of the relevant entries from entry list. While - that works fine I disliked that model after thinking about it for a - bit. Because it means that there was a window were someone has - already removed a or all binary handlers but they could still be - safely reached from load_misc_binary() when it has managed to take - the read_lock() on the entries list while inode eviction was already - happening. Again, that perfectly benign but it's cleaner to remove - the binary handler from the list immediately meaning that ones the - write to then entry's file or the binfmt_misc status file returns - the binary type cannot be executed anymore. That gives stronger - guarantees to the user. Signed-off-by: Sasha Levin --- fs/binfmt_misc.c | 216 ++++++++++++++++++++++++++++++++++++----------- diff --git a/queue-5.10/binfmt_misc-cleanup-on-filesystem-umount.patch b/queue-5.10/binfmt_misc-cleanup-on-filesystem-umount.patch index 57e21ce10a3..1858e7270c8 100644 --- a/queue-5.10/binfmt_misc-cleanup-on-filesystem-umount.patch +++ b/queue-5.10/binfmt_misc-cleanup-on-filesystem-umount.patch @@ -85,27 +85,6 @@ Acked-by: Serge Hallyn Signed-off-by: Christian Brauner Signed-off-by: Christian Brauner Signed-off-by: Kees Cook ---- -/* v2 */ -- Christian Brauner : - - Add more comments that explain what's going on. - - Rename functions while changing them to better reflect what they are - doing to make the code easier to understand. - - In the first version when a specific binary type handler was removed - either through a write to the entry's file or all binary type - handlers were removed by a write to the binfmt_misc mount's status - file all cleanup work happened during inode eviction. - That includes removal of the relevant entries from entry list. While - that works fine I disliked that model after thinking about it for a - bit. Because it means that there was a window were someone has - already removed a or all binary handlers but they could still be - safely reached from load_misc_binary() when it has managed to take - the read_lock() on the entries list while inode eviction was already - happening. Again, that perfectly benign but it's cleaner to remove - the binary handler from the list immediately meaning that ones the - write to then entry's file or the binfmt_misc status file returns - the binary type cannot be executed anymore. That gives stronger - guarantees to the user. Signed-off-by: Sasha Levin --- fs/binfmt_misc.c | 216 ++++++++++++++++++++++++++++++++++++----------- diff --git a/queue-5.15/binfmt_misc-cleanup-on-filesystem-umount.patch b/queue-5.15/binfmt_misc-cleanup-on-filesystem-umount.patch index e78f3687e5b..65f5ae46a1e 100644 --- a/queue-5.15/binfmt_misc-cleanup-on-filesystem-umount.patch +++ b/queue-5.15/binfmt_misc-cleanup-on-filesystem-umount.patch @@ -85,27 +85,6 @@ Acked-by: Serge Hallyn Signed-off-by: Christian Brauner Signed-off-by: Christian Brauner Signed-off-by: Kees Cook ---- -/* v2 */ -- Christian Brauner : - - Add more comments that explain what's going on. - - Rename functions while changing them to better reflect what they are - doing to make the code easier to understand. - - In the first version when a specific binary type handler was removed - either through a write to the entry's file or all binary type - handlers were removed by a write to the binfmt_misc mount's status - file all cleanup work happened during inode eviction. - That includes removal of the relevant entries from entry list. While - that works fine I disliked that model after thinking about it for a - bit. Because it means that there was a window were someone has - already removed a or all binary handlers but they could still be - safely reached from load_misc_binary() when it has managed to take - the read_lock() on the entries list while inode eviction was already - happening. Again, that perfectly benign but it's cleaner to remove - the binary handler from the list immediately meaning that ones the - write to then entry's file or the binfmt_misc status file returns - the binary type cannot be executed anymore. That gives stronger - guarantees to the user. Signed-off-by: Sasha Levin --- fs/binfmt_misc.c | 216 ++++++++++++++++++++++++++++++++++++----------- diff --git a/queue-5.4/binfmt_misc-cleanup-on-filesystem-umount.patch b/queue-5.4/binfmt_misc-cleanup-on-filesystem-umount.patch index 26e1a410c86..4c5e2c1dd03 100644 --- a/queue-5.4/binfmt_misc-cleanup-on-filesystem-umount.patch +++ b/queue-5.4/binfmt_misc-cleanup-on-filesystem-umount.patch @@ -85,27 +85,6 @@ Acked-by: Serge Hallyn Signed-off-by: Christian Brauner Signed-off-by: Christian Brauner Signed-off-by: Kees Cook ---- -/* v2 */ -- Christian Brauner : - - Add more comments that explain what's going on. - - Rename functions while changing them to better reflect what they are - doing to make the code easier to understand. - - In the first version when a specific binary type handler was removed - either through a write to the entry's file or all binary type - handlers were removed by a write to the binfmt_misc mount's status - file all cleanup work happened during inode eviction. - That includes removal of the relevant entries from entry list. While - that works fine I disliked that model after thinking about it for a - bit. Because it means that there was a window were someone has - already removed a or all binary handlers but they could still be - safely reached from load_misc_binary() when it has managed to take - the read_lock() on the entries list while inode eviction was already - happening. Again, that perfectly benign but it's cleaner to remove - the binary handler from the list immediately meaning that ones the - write to then entry's file or the binfmt_misc status file returns - the binary type cannot be executed anymore. That gives stronger - guarantees to the user. Signed-off-by: Sasha Levin --- fs/binfmt_misc.c | 216 ++++++++++++++++++++++++++++++++++++----------- diff --git a/queue-6.1/binfmt_misc-cleanup-on-filesystem-umount.patch b/queue-6.1/binfmt_misc-cleanup-on-filesystem-umount.patch index ad75623b54b..35c0625b9d8 100644 --- a/queue-6.1/binfmt_misc-cleanup-on-filesystem-umount.patch +++ b/queue-6.1/binfmt_misc-cleanup-on-filesystem-umount.patch @@ -85,27 +85,6 @@ Acked-by: Serge Hallyn Signed-off-by: Christian Brauner Signed-off-by: Christian Brauner Signed-off-by: Kees Cook ---- -/* v2 */ -- Christian Brauner : - - Add more comments that explain what's going on. - - Rename functions while changing them to better reflect what they are - doing to make the code easier to understand. - - In the first version when a specific binary type handler was removed - either through a write to the entry's file or all binary type - handlers were removed by a write to the binfmt_misc mount's status - file all cleanup work happened during inode eviction. - That includes removal of the relevant entries from entry list. While - that works fine I disliked that model after thinking about it for a - bit. Because it means that there was a window were someone has - already removed a or all binary handlers but they could still be - safely reached from load_misc_binary() when it has managed to take - the read_lock() on the entries list while inode eviction was already - happening. Again, that perfectly benign but it's cleaner to remove - the binary handler from the list immediately meaning that ones the - write to then entry's file or the binfmt_misc status file returns - the binary type cannot be executed anymore. That gives stronger - guarantees to the user. Signed-off-by: Sasha Levin --- fs/binfmt_misc.c | 216 ++++++++++++++++++++++++++++++++++++----------- diff --git a/queue-6.6/binfmt_misc-cleanup-on-filesystem-umount.patch b/queue-6.6/binfmt_misc-cleanup-on-filesystem-umount.patch index d455f98d47d..a89f85bfa0c 100644 --- a/queue-6.6/binfmt_misc-cleanup-on-filesystem-umount.patch +++ b/queue-6.6/binfmt_misc-cleanup-on-filesystem-umount.patch @@ -85,27 +85,6 @@ Acked-by: Serge Hallyn Signed-off-by: Christian Brauner Signed-off-by: Christian Brauner Signed-off-by: Kees Cook ---- -/* v2 */ -- Christian Brauner : - - Add more comments that explain what's going on. - - Rename functions while changing them to better reflect what they are - doing to make the code easier to understand. - - In the first version when a specific binary type handler was removed - either through a write to the entry's file or all binary type - handlers were removed by a write to the binfmt_misc mount's status - file all cleanup work happened during inode eviction. - That includes removal of the relevant entries from entry list. While - that works fine I disliked that model after thinking about it for a - bit. Because it means that there was a window were someone has - already removed a or all binary handlers but they could still be - safely reached from load_misc_binary() when it has managed to take - the read_lock() on the entries list while inode eviction was already - happening. Again, that perfectly benign but it's cleaner to remove - the binary handler from the list immediately meaning that ones the - write to then entry's file or the binfmt_misc status file returns - the binary type cannot be executed anymore. That gives stronger - guarantees to the user. Signed-off-by: Sasha Levin --- fs/binfmt_misc.c | 216 ++++++++++++++++++++++++++++++++++++-----------