[PATCH]forbid ptrace changes psr.ri to 3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



PSR.ri bits 3 are reserved, change to 3 will break kernel.

The patch ignore such change, if you thought access_urea should return
an error in the case, please let me know.

Signed-off-by: Shaohua Li <shaohua.li@xxxxxxxxx>

--- a/arch/ia64/kernel/ptrace.c	2007-08-27 05:48:49.000000000 +0800
+++ b/arch/ia64/kernel/ptrace.c	2007-08-27 05:57:42.000000000 +0800
@@ -951,10 +951,14 @@ access_uarea (struct task_struct *child,
 			return 0;
 
 		      case PT_CR_IPSR:
-			if (write_access)
-				pt->cr_ipsr = ((*data & IPSR_MASK)
+			if (write_access) {
+				unsigned long tmp = *data;
+				/* psr.ri bits 11 are reserved, ingore the change */
+				if ((tmp & IA64_PSR_RI) == IA64_PSR_RI)
+					tmp &= ~IA64_PSR_RI;
+				pt->cr_ipsr = ((tmp & IPSR_MASK)
 					       | (pt->cr_ipsr & ~IPSR_MASK));
-			else
+			} else
 				*data = (pt->cr_ipsr & IPSR_MASK);
 			return 0;
 
-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Sparc Linux]     [DCCP]     [Linux ARM]     [Yosemite News]     [Linux SCSI]     [Linux x86_64]     [Linux for Ham Radio]

  Powered by Linux