e4defrag: avoid unsuccessful return in non-privileged user
PATCH 3/3 e4defrag: avoid unsuccessful return in non-privileged user
If non-privileged user does e4defrag, e4defrag returns 1 despite its success. This patch fixes this problem.
---
e4defrag.c | 1 + 1 file changed, 1 insertion(+)
misc/e4defrag.c +1 -0
@@ -2025,6 +2025,7 @@ int main(int argc, char *argv[])if (!(mode_flag &DETAIL ) && current_uid !=ROOT_UID ) {printf (" Done.\n" ); + success_flag =1 ;continue ; }
2009/9/30 Kazuya Mio <[email protected]>:
Quoted 13 lines
If non-privileged user does e4defrag, e4defrag returns 1 despite its success. This patch fixes this problem.
Signed-off-by Kazuya Mio <[email protected]>---
e4defrag.c | 1 +
1 file changed, 1 insertion(+)misc/e4defrag.c +0
-0@@ -2025,6 +2025,7 @@ int main(int argc, char *argv[])
Quoted 6 lines
if (!(mode_flag & DETAIL) &&
current_uid!=ROOT_UID) {printf(" Done.\n");
+success_flag= 1; continue;
}
I should know this, but this patch made me wonder about the underlying implementation of EXT4_IOC_MOVE_EXT.
After EXT4_IOC_MOVE_EXT is called, can userspace somehow modify the defragged file?
ie. If I only have readonly access to a file and I call EXT4_IOC_MOVE_EXT to replace some of the data blocks, is it possible now for me to write data to the donor_fd and thus modify the data in the original file?
Greg
Signature · 14 lines
Greg Freemyer Head of EDD Tape Extraction and Processing team Litigation Triage Solutions Specialist http://www.linkedin.com/in/gregfreemyer Preservation and Forensic processing of Exchange Repositories White Paper - <http://www.norcrossgroup.com/forms/whitepapers/tng_whitepaper_fpe.html> The Norcross Group The Intersection of Evidence & Technology http://www.norcrossgroup.com -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
2009/10/01 3:37, Greg Freemyer wrote::
Quoted 27 lines
2009/9/30 Kazuya Mio <[email protected]>:
Quoted 13 lines
If non-privileged user does e4defrag, e4defrag returns 1 despite its success. This patch fixes this problem.
Signed-off-by Kazuya Mio <[email protected]>---
e4defrag.c | 1 + 1 file changed, 1 insertion(+)misc/e4defrag.c +0
-0misc/e4defrag.c int main(int argc, char *argv[]) · line 2030
Quoted 6 lines
misc/e4defrag.c +1
-0@@ -2025,6 +2025,7 @@ int main(int argc, char *argv[])if (!(mode_flag &DETAIL ) && current_uid !=ROOT_UID ) {printf (" Done.\n" ); + success_flag =1 ;continue ; }I should know this, but this patch made me wonder about the underlying implementation of
EXT4_IOC_MOVE_EXT.After
EXT4_IOC_MOVE_EXTis called, can userspace somehow modify the defragged file?
Quoted 6 lines
ie. If I only have readonly access to a file and I call
EXT4_IOC_MOVE_EXTto replace some of the data blocks, is it possible now for me to write data to thedonor_fdand thus modify the data in the original file?Greg
Nope, EXT4_IOC_MOVE_EXT only changes original file blocks but its file data isn't changed.
If user has readonly access to original or donor file and is both two files owner, EXT4_IOC_MOVE_EXT succeeds. This means that the ioctl replaces data blocks and writes original file data into replaced blocks.
Regards,
Kazuya Mio