From mboxrd@z Thu Jan 1 00:00:00 1970 From: venkatram867@gmail.com (Ram Tummala) Date: Mon, 23 Jul 2012 23:08:16 +0530 Subject: How can I change cr0 register in redhat system In-Reply-To: References: <219833562776487968@unknownmsgid> Message-ID: <4202243508956292452@unknownmsgid> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org On Jul 23, 2012, at 7:08 PM, Fan Yang wrote: 2012/7/23 Ram Tummala > On Jul 23, 2012, at 9:32 AM, Fan Yang wrote: > > > hi all: > > when I change the cr0 register I get a "Segmentation fault (core > dumped)". > > my code is : > > > > > > .data > > .text > > .global _start > > _start: > > movl %eax, %cr0 > > > > this code can work well in ubuntu system when I use root to run > it. So what can I do to work it in redhat system? > > Changing a control register is a privileged operation. You can't do it > from the user space. You can only do it from ring 0. > > Venkatram Tummala > > > > thanks > > > > _______________________________________________ > > Kernelnewbies mailing list > > Kernelnewbies at kernelnewbies.org > > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > > > May be I can work it by adding a new syscall in the kernel, right? Yes you can add a syscall in the kernel or can use procfs or sysfs but you should fully understand the consequences. The code will never be accepted by the kernel community. Exporting such functionality to the user space is recipe for disaster. It would open up a simple DOS attack and that is just a start. Hardware Control registers are just not supposed to be handled by the user space. Venkatram Tummala -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120723/455da509/attachment.html