patch-1.3.71 linux/arch/sparc/kernel/sys_sparc.c
Next file: linux/arch/sparc/kernel/sys_sunos.c
Previous file: linux/arch/sparc/kernel/sys_bsd.c
Back to the patch index
Back to the overall index
- Lines: 45
- Date:
Mon Mar 4 08:49:56 1996
- Orig file:
v1.3.70/linux/arch/sparc/kernel/sys_sparc.c
- Orig date:
Sat Nov 25 19:04:37 1995
diff -u --recursive --new-file v1.3.70/linux/arch/sparc/kernel/sys_sparc.c linux/arch/sparc/kernel/sys_sparc.c
@@ -1,4 +1,4 @@
-/* $Id: sys_sparc.c,v 1.6 1995/11/25 00:58:34 davem Exp $
+/* $Id: sys_sparc.c,v 1.7 1996/03/01 07:15:58 davem Exp $
* linux/arch/sparc/kernel/sys_sparc.c
*
* This file contains various random system calls that
@@ -42,6 +42,38 @@
regs->u_regs[UREG_I1] = fd[1];
}
}
+
+/* Note most sanity checking already done in sclow.S code. */
+asmlinkage int quick_sys_write(unsigned int fd, char *buf, unsigned int count)
+{
+ struct file *file = current->files->fd[fd];
+ struct inode *inode = file->f_inode;
+ int error;
+
+ error = verify_area(VERIFY_READ, buf, count);
+ if(error)
+ return error;
+ /*
+ * If data has been written to the file, remove the setuid and
+ * the setgid bits. We do it anyway otherwise there is an
+ * extremely exploitable race - does your OS get it right |->
+ *
+ * Set ATTR_FORCE so it will always be changed.
+ */
+ if (!suser() && (inode->i_mode & (S_ISUID | S_ISGID))) {
+ struct iattr newattrs;
+ newattrs.ia_mode = inode->i_mode & ~(S_ISUID | S_ISGID);
+ newattrs.ia_valid = ATTR_CTIME | ATTR_MODE | ATTR_FORCE;
+ notify_change(inode, &newattrs);
+ }
+
+ down(&inode->i_sem);
+ error = file->f_op->write(inode,file,buf,count);
+ up(&inode->i_sem);
+ return error;
+}
+
+/* XXX do we need this crap? XXX */
/*
* sys_ipc() is the de-multiplexer for the SysV IPC calls..
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov
with Sam's (original) version of this