History

[PATCH] LSM: add missing hook to do_compat_readv_writev()

This patch addresses a flaw in LSM, where there is no mediation of readv() and writev() in for 32-bit compatible apps using a 64-bit kernel. This bug was discovered and fixed initially in the native readv/writev code [1], but was not fixed in the compat code. Thanks to Al for spotting this one. [1] http://lwn.net/Articles/154282/

James Morris committed 20 years ago

Commit e7edf9c1 parent a090d911 file · +4 −0Browse files

Unified · Split

fs/compat.c+4−0
@@ -1217,6 +1217,10 @@ static ssize_t compat_do_readv_writev(int type, struct file *file, · 1216 unmodified lines
12171217 if (ret < 0)
12181218 goto out;
12191219
1220+ ret = security_file_permission(file, type == READ ? MAY_READ:MAY_WRITE);
1221+ if (ret)
1222+ goto out;
1223+
12201224 fnv = NULL;
12211225 if (type == READ) {
12221226 fn = file->f_op->read;