Re: Problem in accessing executable files
On Tue, Feb 08, 2005 at 07:14:27PM -0500, Vineet Joglekar wrote: > > Hi all, > > > > 1 more interesting observation regarding my executable file problem. > > > > If I copy an executable say "prac" from ext2 fs to my encrypted fs as prac1, > prac1 doesnt run on the encrypted fs. but, if I make another copy, from prac1 > to normal ext2 fs, as prac2, then the prac2 executes properly on normal file > system. that means my encryption, decryption functions are getting executed > properly while using that executable as normal file to read and write, but > something else is happening when I try to execute it. I am failing to > understand what am I missing. 1) 6 or 7 newlines 2) mmap() - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Problem in accessing executable files
Hi all, 1 more interesting observation regarding my executable file problem. If I copy an executable say "prac" from ext2 fs to my encrypted fs as prac1, prac1 doesnt run on the encrypted fs. but, if I make another copy, from prac1 to normal ext2 fs, as prac2, then the prac2 executes properly on normal file system. that means my encryption, decryption functions are getting executed properly while using that executable as normal file to read and write, but something else is happening when I try to execute it. I am failing to understand what am I missing. Vineet --- On Sun 02/06, Vineet Joglekar < [EMAIL PROTECTED] > wrote: From: Vineet Joglekar [mailto: [EMAIL PROTECTED] To: [EMAIL PROTECTED], linux-kernel@vger.kernel.org Cc: linux-c-programming@vger.kernel.org Date: Sun, 6 Feb 2005 17:41:01 -0500 (EST) Subject: Re: Problem in accessing executable files Hi John,Thanks for suggesting the single / few bytes encryption test. I tried doing that, but in vain. Maybe I am going wrong somewhere else.I will briefly tell the functions I have written and the sequence if I am doing any mistake in the logic, please let me know.In file.c I have added the info about the functions my_generic_file_read and my_generic_file_write in ext2_file_operations.For decrypting, the sequence is:my_generic_file_read ---> my_do_generic_file_read ---> my_file_read_actor ---> my_decrypt_dataI have not made any changes in my_generic_file_read and my_do_generic_file_read. In the function my_file_read_actor, I copy the page to my buffer (1 page - allocated at the time of mounting) I decrypt that buffer and pass it to the __copy_to_user() function.for encrypting, the sequence is:my_generic_file_write ---> my_encrypt_dataIn function my_generic_file_write, between functions __copy_from_user() and commit_write(), I am calling my_encrypt_data() by passing address of the page that is passed to __copy_from_user()My encrypt / decrypt routine is very basic at this time - just xoring every byte of the page as:*to = *to ^ 0xff; *to++;If I change my encrypt/decrypt routines to encrypt / decrypt just first or last byte of the page, then I get a different error saying the file is not executable - when I try to execute it. I thought there might be a problem with executable header, but I guess when I encrypt last byte of the page, header should have been bypassed.Is it something like, for executables, the data is refered in some other functions - that is, before do_generic_file_read geting called?Thanks and regards,Vineet --- On Tue 02/01, John T. Williams < [EMAIL PROTECTED] > wrote:From: John T. Williams [mailto: [EMAIL PROTECTED]To: [EMAIL PROTECTED], linux-kernel@vger.kernel.org Cc: linux-c-programming@vger.kernel.orgDate: Tue, 1 Feb 2005 10:37:30 -0500Subject: Re: Problem in accessing executable filesThis is just a thought.Text files are better able to handle small faults. ie an extra space orcharacters or even an unreadable piece of data might not cause the file tobecome unreadable by most text editors. Binary files aren't as flexible.Every bit could be an instruction to the processor and might cause a segfault.Just to test the theory, I would start by making the encrypt decryptfunction only effect the first byte. If doing this doesn't cause a segfault, I would recheck my decrypt encrypt algorithm to make sure it doesn'tpad or expand at any point. maybe use them on a regular file and the anmd5sum on the file before and after, just to make extra sure.- Original Message - From: "Vineet Joglekar" <[EMAIL PROTECTED]>To: Cc: Sent: Tuesday, February 01, 2005 8:58 AMSubject: Problem in accessing executable files>> Hi all,>> I am trying to add some cryptographic functionality to ext2 file systemfor my masters project. I am working with kernel 2.4.21>> since the routines do_generic_file_read and do_generic_file_write are usedin reading and writing, I am decrypting and encrypting the data in the resp.functions. This is working fine for regular data files. If I try to copy /execute executable files, I am getting segmentation fault. In kernelmessages, I see same functions (read and write) getting called for theexecutables also. If I comment encrypt/decrypt functions, its working fine.>> Now since it is working for regular text files, I suppose there is not aproblem in my encrypt/decrypt routines, then what might be going wrong?>> Thanks and regards,>> Vineet>> ___> Join Excite! - http://www.excite.com> The most personalized portal on the Web!> -> To unsubscribe from this list: send the line "unsubscribelinux-c-programming" in> the body of a message to [EMAIL PROTECTED]> More majordomo info at http://vger.kernel.org/majordomo-info.html___Join Excite! -
Re: Problem in accessing executable files
Hi all, 1 more interesting observation regarding my executable file problem. If I copy an executable say prac from ext2 fs to my encrypted fs as prac1, prac1 doesnt run on the encrypted fs. but, if I make another copy, from prac1 to normal ext2 fs, as prac2, then the prac2 executes properly on normal file system. that means my encryption, decryption functions are getting executed properly while using that executable as normal file to read and write, but something else is happening when I try to execute it. I am failing to understand what am I missing. Vineet --- On Sun 02/06, Vineet Joglekar [EMAIL PROTECTED] wrote: From: Vineet Joglekar [mailto: [EMAIL PROTECTED] To: [EMAIL PROTECTED], linux-kernel@vger.kernel.org Cc: linux-c-programming@vger.kernel.org Date: Sun, 6 Feb 2005 17:41:01 -0500 (EST) Subject: Re: Problem in accessing executable files brHi John,brbrThanks for suggesting the single / few bytes encryption test. I tried doing that, but in vain. Maybe I am going wrong somewhere else.brbrI will briefly tell the functions I have written and the sequence if I am doing any mistake in the logic, please let me know.brIn file.c I have added the info about the functions my_generic_file_read and my_generic_file_write in ext2_file_operations.brbrFor decrypting, the sequence is:brmy_generic_file_read --- my_do_generic_file_read --- my_file_read_actor --- my_decrypt_databrbrI have not made any changes in my_generic_file_read and my_do_generic_file_read. In the function my_file_read_actor, I copy the page to my buffer (1 page - allocated at the time of mounting) I decrypt that buffer and pass it to the __copy_to_user() function.brbrfor encrypting, the sequence is:brmy_generic_file_write --- my_encrypt_databrbrIn function my_generic_file_write, between functions __copy_from_user() and commit_write(), I am calling my_encrypt_data() by passing address of the page that is passed to __copy_from_user()brbrMy encrypt / decrypt routine is very basic at this time - just xoring every byte of the page as:br*to = *to ^ 0xff; *to++;brbrIf I change my encrypt/decrypt routines to encrypt / decrypt just first or last byte of the page, then I get a different error saying the file is not executable - when I try to execute it. I thought there might be a problem with executable header, but I guess when I encrypt last byte of the page, header should have been bypassed.brbrIs it something like, for executables, the data is refered in some other functions - that is, before do_generic_file_read geting called?brbrThanks and regards,brbrVineetbrbr --- On Tue 02/01, John T. Williams [EMAIL PROTECTED] wrote:brFrom: John T. Williams [mailto: [EMAIL PROTECTED]brTo: [EMAIL PROTECTED], linux-kernel@vger.kernel.orgbr Cc: linux-c-programming@vger.kernel.orgbrDate: Tue, 1 Feb 2005 10:37:30 -0500brSubject: Re: Problem in accessing executable filesbrbrThis is just a thought.brbrText files are better able to handle small faults. ie an extra space orbrcharacters or even an unreadable piece of data might not cause the file tobrbecome unreadable by most text editors. Binary files aren't as flexible.brEvery bit could be an instruction to the processor and might cause a segbrfault.brbrJust to test the theory, I would start by making the encrypt decryptbrfunction only effect the first byte. If doing this doesn't cause a segbrfault, I would recheck my decrypt encrypt algorithm to make sure it doesn'tbrpad or expand at any point. maybe use them on a regular file and the anbrmd5sum on the file before and after, just to make extra sure.brbrbr- Original Message - brFrom: Vineet Joglekar [EMAIL PROTECTED]brTo: linux-kernel@vger.kernel.orgbrCc: linux-c-programming@vger.kernel.orgbrSent: Tuesday, February 01, 2005 8:58 AMbrSubject: Problem in accessing executable filesbrbrbrbr Hi all,brbr I am trying to add some cryptographic functionality to ext2 file systembrfor my masters project. I am working with kernel 2.4.21brbr since the routines do_generic_file_read and do_generic_file_write are usedbrin reading and writing, I am decrypting and encrypting the data in the resp.brfunctions. This is working fine for regular data files. If I try to copy /brexecute executable files, I am getting segmentation fault. In kernelbrmessages, I see same functions (read and write) getting called for thebrexecutables also. If I comment encrypt/decrypt functions, its working fine.brbr Now since it is working for regular text files, I suppose there is not abrproblem in my encrypt/decrypt routines, then what might be going wrong?brbr Thanks and regards,brbr Vineetbrbr ___br Join Excite! - http://www.excite.combr The most personalized portal on the Web!br -br To unsubscribe from this list: send the line unsubscribebrlinux-c-programming inbr the body of a message to [EMAIL PROTECTED]br More majordomo info at http://vger.kernel.org
Re: Problem in accessing executable files
On Tue, Feb 08, 2005 at 07:14:27PM -0500, Vineet Joglekar wrote: Hi all, 1 more interesting observation regarding my executable file problem. If I copy an executable say prac from ext2 fs to my encrypted fs as prac1, prac1 doesnt run on the encrypted fs. but, if I make another copy, from prac1 to normal ext2 fs, as prac2, then the prac2 executes properly on normal file system. that means my encryption, decryption functions are getting executed properly while using that executable as normal file to read and write, but something else is happening when I try to execute it. I am failing to understand what am I missing. 1) 6 or 7 newlines 2) mmap() - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Problem in accessing executable files
Hi John, Thanks for suggesting the single / few bytes encryption test. I tried doing that, but in vain. Maybe I am going wrong somewhere else. I will briefly tell the functions I have written and the sequence if I am doing any mistake in the logic, please let me know. In file.c I have added the info about the functions my_generic_file_read and my_generic_file_write in ext2_file_operations. For decrypting, the sequence is: my_generic_file_read ---> my_do_generic_file_read ---> my_file_read_actor ---> my_decrypt_data I have not made any changes in my_generic_file_read and my_do_generic_file_read. In the function my_file_read_actor, I copy the page to my buffer (1 page - allocated at the time of mounting) I decrypt that buffer and pass it to the __copy_to_user() function. for encrypting, the sequence is: my_generic_file_write ---> my_encrypt_data In function my_generic_file_write, between functions __copy_from_user() and commit_write(), I am calling my_encrypt_data() by passing address of the page that is passed to __copy_from_user() My encrypt / decrypt routine is very basic at this time - just xoring every byte of the page as: *to = *to ^ 0xff; *to++; If I change my encrypt/decrypt routines to encrypt / decrypt just first or last byte of the page, then I get a different error saying the file is not executable - when I try to execute it. I thought there might be a problem with executable header, but I guess when I encrypt last byte of the page, header should have been bypassed. Is it something like, for executables, the data is refered in some other functions - that is, before do_generic_file_read geting called? Thanks and regards, Vineet --- On Tue 02/01, John T. Williams < [EMAIL PROTECTED] > wrote: From: John T. Williams [mailto: [EMAIL PROTECTED] To: [EMAIL PROTECTED], linux-kernel@vger.kernel.org Cc: linux-c-programming@vger.kernel.org Date: Tue, 1 Feb 2005 10:37:30 -0500 Subject: Re: Problem in accessing executable files This is just a thought.Text files are better able to handle small faults. ie an extra space orcharacters or even an unreadable piece of data might not cause the file tobecome unreadable by most text editors. Binary files aren't as flexible.Every bit could be an instruction to the processor and might cause a segfault.Just to test the theory, I would start by making the encrypt decryptfunction only effect the first byte. If doing this doesn't cause a segfault, I would recheck my decrypt encrypt algorithm to make sure it doesn'tpad or expand at any point. maybe use them on a regular file and the anmd5sum on the file before and after, just to make extra sure.- Original Message - From: "Vineet Joglekar" <[EMAIL PROTECTED]>To: Cc: Sent: Tuesday, February 01, 2005 8:58 AMSubject: Problem in accessing executable files>> Hi all,>> I am trying to add some cryptographic functionality to ext2 file systemfor my masters project. I am working with kernel 2.4.21>> since the routines do_generic_file_read and do_generic_file_write are usedin reading and writing, I am decrypting and encrypting the data in the resp.functions. This is working fine for regular data files. If I try to copy /execute executable files, I am getting segmentation fault. In kernelmessages, I see same functions (read and write) getting called for theexecutables also. If I comment encrypt/decrypt functions, its working fine.>> Now since it is working for regular text files, I suppose there is not aproblem in my encrypt/decrypt routines, then what might be going wrong?>> Thanks and regards,>> Vineet>> ___> Join Excite! - http://www.excite.com> The most personalized portal on the Web!> -> To unsubscribe from this list: send the line "unsubscribelinux-c-programming" in> the body of a message to [EMAIL PROTECTED]> More majordomo info at http://vger.kernel.org/majordomo-info.html ___ Join Excite! - http://www.excite.com The most personalized portal on the Web! - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Problem in accessing executable files
Hi John, Thanks for suggesting the single / few bytes encryption test. I tried doing that, but in vain. Maybe I am going wrong somewhere else. I will briefly tell the functions I have written and the sequence if I am doing any mistake in the logic, please let me know. In file.c I have added the info about the functions my_generic_file_read and my_generic_file_write in ext2_file_operations. For decrypting, the sequence is: my_generic_file_read --- my_do_generic_file_read --- my_file_read_actor --- my_decrypt_data I have not made any changes in my_generic_file_read and my_do_generic_file_read. In the function my_file_read_actor, I copy the page to my buffer (1 page - allocated at the time of mounting) I decrypt that buffer and pass it to the __copy_to_user() function. for encrypting, the sequence is: my_generic_file_write --- my_encrypt_data In function my_generic_file_write, between functions __copy_from_user() and commit_write(), I am calling my_encrypt_data() by passing address of the page that is passed to __copy_from_user() My encrypt / decrypt routine is very basic at this time - just xoring every byte of the page as: *to = *to ^ 0xff; *to++; If I change my encrypt/decrypt routines to encrypt / decrypt just first or last byte of the page, then I get a different error saying the file is not executable - when I try to execute it. I thought there might be a problem with executable header, but I guess when I encrypt last byte of the page, header should have been bypassed. Is it something like, for executables, the data is refered in some other functions - that is, before do_generic_file_read geting called? Thanks and regards, Vineet --- On Tue 02/01, John T. Williams [EMAIL PROTECTED] wrote: From: John T. Williams [mailto: [EMAIL PROTECTED] To: [EMAIL PROTECTED], linux-kernel@vger.kernel.org Cc: linux-c-programming@vger.kernel.org Date: Tue, 1 Feb 2005 10:37:30 -0500 Subject: Re: Problem in accessing executable files This is just a thought.brbrText files are better able to handle small faults. ie an extra space orbrcharacters or even an unreadable piece of data might not cause the file tobrbecome unreadable by most text editors. Binary files aren't as flexible.brEvery bit could be an instruction to the processor and might cause a segbrfault.brbrJust to test the theory, I would start by making the encrypt decryptbrfunction only effect the first byte. If doing this doesn't cause a segbrfault, I would recheck my decrypt encrypt algorithm to make sure it doesn'tbrpad or expand at any point. maybe use them on a regular file and the anbrmd5sum on the file before and after, just to make extra sure.brbrbr- Original Message - brFrom: Vineet Joglekar [EMAIL PROTECTED]brTo: linux-kernel@vger.kernel.orgbrCc: linux-c-programming@vger.kernel.orgbrSent: Tuesday, February 01, 2005 8:58 AMbrSubject: Problem in accessing executable filesbrbrbrbr Hi all,brbr I am trying to add some cryptographic functionality to ext2 file systembrfor my masters project. I am working with kernel 2.4.21brbr since the routines do_generic_file_read and do_generic_file_write are usedbrin reading and writing, I am decrypting and encrypting the data in the resp.brfunctions. This is working fine for regular data files. If I try to copy /brexecute executable files, I am getting segmentation fault. In kernelbrmessages, I see same functions (read and write) getting called for thebrexecutables also. If I comment encrypt/decrypt functions, its working fine.brbr Now since it is working for regular text files, I suppose there is not abrproblem in my encrypt/decrypt routines, then what might be going wrong?brbr Thanks and regards,brbr Vineetbrbr ___br Join Excite! - http://www.excite.combr The most personalized portal on the Web!br -br To unsubscribe from this list: send the line unsubscribebrlinux-c-programming inbr the body of a message to [EMAIL PROTECTED]br More majordomo info at http://vger.kernel.org/majordomo-info.htmlbrbrbr ___ Join Excite! - http://www.excite.com The most personalized portal on the Web! - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Problem in accessing executable files
This is just a thought. Text files are better able to handle small faults. ie an extra space or characters or even an unreadable piece of data might not cause the file to become unreadable by most text editors. Binary files aren't as flexible. Every bit could be an instruction to the processor and might cause a seg fault. Just to test the theory, I would start by making the encrypt decrypt function only effect the first byte. If doing this doesn't cause a seg fault, I would recheck my decrypt encrypt algorithm to make sure it doesn't pad or expand at any point. maybe use them on a regular file and the an md5sum on the file before and after, just to make extra sure. - Original Message - From: "Vineet Joglekar" <[EMAIL PROTECTED]> To: Cc: Sent: Tuesday, February 01, 2005 8:58 AM Subject: Problem in accessing executable files > > Hi all, > > I am trying to add some cryptographic functionality to ext2 file system for my masters project. I am working with kernel 2.4.21 > > since the routines do_generic_file_read and do_generic_file_write are used in reading and writing, I am decrypting and encrypting the data in the resp. functions. This is working fine for regular data files. If I try to copy / execute executable files, I am getting segmentation fault. In kernel messages, I see same functions (read and write) getting called for the executables also. If I comment encrypt/decrypt functions, its working fine. > > Now since it is working for regular text files, I suppose there is not a problem in my encrypt/decrypt routines, then what might be going wrong? > > Thanks and regards, > > Vineet > > ___ > Join Excite! - http://www.excite.com > The most personalized portal on the Web! > - > To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in > the body of a message to [EMAIL PROTECTED] > More majordomo info at http://vger.kernel.org/majordomo-info.html - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Problem in accessing executable files
Hi all, I am trying to add some cryptographic functionality to ext2 file system for my masters project. I am working with kernel 2.4.21 since the routines do_generic_file_read and do_generic_file_write are used in reading and writing, I am decrypting and encrypting the data in the resp. functions. This is working fine for regular data files. If I try to copy / execute executable files, I am getting segmentation fault. In kernel messages, I see same functions (read and write) getting called for the executables also. If I comment encrypt/decrypt functions, its working fine. Now since it is working for regular text files, I suppose there is not a problem in my encrypt/decrypt routines, then what might be going wrong? Thanks and regards, Vineet ___ Join Excite! - http://www.excite.com The most personalized portal on the Web! - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Problem in accessing executable files
Hi all, I am trying to add some cryptographic functionality to ext2 file system for my masters project. I am working with kernel 2.4.21 since the routines do_generic_file_read and do_generic_file_write are used in reading and writing, I am decrypting and encrypting the data in the resp. functions. This is working fine for regular data files. If I try to copy / execute executable files, I am getting segmentation fault. In kernel messages, I see same functions (read and write) getting called for the executables also. If I comment encrypt/decrypt functions, its working fine. Now since it is working for regular text files, I suppose there is not a problem in my encrypt/decrypt routines, then what might be going wrong? Thanks and regards, Vineet ___ Join Excite! - http://www.excite.com The most personalized portal on the Web! - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Problem in accessing executable files
This is just a thought. Text files are better able to handle small faults. ie an extra space or characters or even an unreadable piece of data might not cause the file to become unreadable by most text editors. Binary files aren't as flexible. Every bit could be an instruction to the processor and might cause a seg fault. Just to test the theory, I would start by making the encrypt decrypt function only effect the first byte. If doing this doesn't cause a seg fault, I would recheck my decrypt encrypt algorithm to make sure it doesn't pad or expand at any point. maybe use them on a regular file and the an md5sum on the file before and after, just to make extra sure. - Original Message - From: Vineet Joglekar [EMAIL PROTECTED] To: linux-kernel@vger.kernel.org Cc: linux-c-programming@vger.kernel.org Sent: Tuesday, February 01, 2005 8:58 AM Subject: Problem in accessing executable files Hi all, I am trying to add some cryptographic functionality to ext2 file system for my masters project. I am working with kernel 2.4.21 since the routines do_generic_file_read and do_generic_file_write are used in reading and writing, I am decrypting and encrypting the data in the resp. functions. This is working fine for regular data files. If I try to copy / execute executable files, I am getting segmentation fault. In kernel messages, I see same functions (read and write) getting called for the executables also. If I comment encrypt/decrypt functions, its working fine. Now since it is working for regular text files, I suppose there is not a problem in my encrypt/decrypt routines, then what might be going wrong? Thanks and regards, Vineet ___ Join Excite! - http://www.excite.com The most personalized portal on the Web! - To unsubscribe from this list: send the line unsubscribe linux-c-programming in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/