aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc64/kernel/sys_ppc32.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ppc64/kernel/sys_ppc32.c')
-rw-r--r--arch/ppc64/kernel/sys_ppc32.c70
1 files changed, 33 insertions, 37 deletions
diff --git a/arch/ppc64/kernel/sys_ppc32.c b/arch/ppc64/kernel/sys_ppc32.c
index 7cf7a9600025..9c8e317c598d 100644
--- a/arch/ppc64/kernel/sys_ppc32.c
+++ b/arch/ppc64/kernel/sys_ppc32.c
@@ -791,31 +791,6 @@ asmlinkage int sys32_pciconfig_iobase(u32 which, u32 in_bus, u32 in_devfn)
791} 791}
792 792
793 793
794asmlinkage int ppc64_newuname(struct new_utsname __user * name)
795{
796 int errno = sys_newuname(name);
797
798 if (current->personality == PER_LINUX32 && !errno) {
799 if(copy_to_user(name->machine, "ppc\0\0", 8)) {
800 errno = -EFAULT;
801 }
802 }
803 return errno;
804}
805
806asmlinkage int ppc64_personality(unsigned long personality)
807{
808 int ret;
809 if (current->personality == PER_LINUX32 && personality == PER_LINUX)
810 personality = PER_LINUX32;
811 ret = sys_personality(personality);
812 if (ret == PER_LINUX32)
813 ret = PER_LINUX;
814 return ret;
815}
816
817
818
819/* Note: it is necessary to treat mode as an unsigned int, 794/* Note: it is necessary to treat mode as an unsigned int,
820 * with the corresponding cast to a signed int to insure that the 795 * with the corresponding cast to a signed int to insure that the
821 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) 796 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
@@ -1158,26 +1133,47 @@ asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args)
1158} 1133}
1159#endif 1134#endif
1160 1135
1136asmlinkage int sys32_uname(struct old_utsname __user * name)
1137{
1138 int err = 0;
1139
1140 down_read(&uts_sem);
1141 if (copy_to_user(name, &system_utsname, sizeof(*name)))
1142 err = -EFAULT;
1143 up_read(&uts_sem);
1144 if (!err && personality(current->personality) == PER_LINUX32) {
1145 /* change "ppc64" to "ppc" */
1146 if (__put_user(0, name->machine + 3)
1147 || __put_user(0, name->machine + 4))
1148 err = -EFAULT;
1149 }
1150 return err;
1151}
1152
1161asmlinkage int sys32_olduname(struct oldold_utsname __user * name) 1153asmlinkage int sys32_olduname(struct oldold_utsname __user * name)
1162{ 1154{
1163 int error; 1155 int error;
1164 1156
1165 if (!name)
1166 return -EFAULT;
1167 if (!access_ok(VERIFY_WRITE,name,sizeof(struct oldold_utsname))) 1157 if (!access_ok(VERIFY_WRITE,name,sizeof(struct oldold_utsname)))
1168 return -EFAULT; 1158 return -EFAULT;
1169 1159
1170 down_read(&uts_sem); 1160 down_read(&uts_sem);
1171 error = __copy_to_user(&name->sysname,&system_utsname.sysname,__OLD_UTS_LEN); 1161 error = __copy_to_user(&name->sysname,&system_utsname.sysname,__OLD_UTS_LEN);
1172 error -= __put_user(0,name->sysname+__OLD_UTS_LEN); 1162 error |= __put_user(0,name->sysname+__OLD_UTS_LEN);
1173 error -= __copy_to_user(&name->nodename,&system_utsname.nodename,__OLD_UTS_LEN); 1163 error |= __copy_to_user(&name->nodename,&system_utsname.nodename,__OLD_UTS_LEN);
1174 error -= __put_user(0,name->nodename+__OLD_UTS_LEN); 1164 error |= __put_user(0,name->nodename+__OLD_UTS_LEN);
1175 error -= __copy_to_user(&name->release,&system_utsname.release,__OLD_UTS_LEN); 1165 error |= __copy_to_user(&name->release,&system_utsname.release,__OLD_UTS_LEN);
1176 error -= __put_user(0,name->release+__OLD_UTS_LEN); 1166 error |= __put_user(0,name->release+__OLD_UTS_LEN);
1177 error -= __copy_to_user(&name->version,&system_utsname.version,__OLD_UTS_LEN); 1167 error |= __copy_to_user(&name->version,&system_utsname.version,__OLD_UTS_LEN);
1178 error -= __put_user(0,name->version+__OLD_UTS_LEN); 1168 error |= __put_user(0,name->version+__OLD_UTS_LEN);
1179 error -= __copy_to_user(&name->machine,&system_utsname.machine,__OLD_UTS_LEN); 1169 error |= __copy_to_user(&name->machine,&system_utsname.machine,__OLD_UTS_LEN);
1180 error = __put_user(0,name->machine+__OLD_UTS_LEN); 1170 error |= __put_user(0,name->machine+__OLD_UTS_LEN);
1171 if (personality(current->personality) == PER_LINUX32) {
1172 /* change "ppc64" to "ppc" */
1173 error |= __put_user(0, name->machine + 3);
1174 error |= __put_user(0, name->machine + 4);
1175 }
1176
1181 up_read(&uts_sem); 1177 up_read(&uts_sem);
1182 1178
1183 error = error ? -EFAULT : 0; 1179 error = error ? -EFAULT : 0;