Skip to content

fix: validate position in sys_pread64 and sys_pwrite64#238

Open
Marsman1996 wants to merge 1 commit intosyswonder:mainfrom
Marsman1996:issue_227
Open

fix: validate position in sys_pread64 and sys_pwrite64#238
Marsman1996 wants to merge 1 commit intosyswonder:mainfrom
Marsman1996:issue_227

Conversation

@Marsman1996
Copy link
Contributor

@Marsman1996 Marsman1996 commented Jan 23, 2026

Fix #227
Fix #228

Refer:
https://github.com/torvalds/linux/blob/c072629f05d7bca1148ab17690d7922a31423984/fs/read_write.c#L752-L756

ssize_t ksys_pread64(unsigned int fd, char __user *buf, size_t count,
		     loff_t pos)
{
	if (pos < 0)
		return -EINVAL;

https://github.com/torvalds/linux/blob/c072629f05d7bca1148ab17690d7922a31423984/fs/read_write.c#L782-L786

ssize_t ksys_pwrite64(unsigned int fd, const char __user *buf,
		      size_t count, loff_t pos)
{
	if (pos < 0)
		return -EINVAL;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Arithmetic overflow panic in axfs_ramfs::write_at when using large offsets Arithmetic overflow panic in pread with invalid offset (off_t)-1

1 participant