linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* do_mmap Function Issue Report
@ 2018-03-28 15:19 Po-Hao Su
  2018-03-28 17:04 ` Matthew Wilcox
  0 siblings, 1 reply; 2+ messages in thread
From: Po-Hao Su @ 2018-03-28 15:19 UTC (permalink / raw)
  To: linux-mm


[-- Attachment #1.1: Type: text/plain, Size: 1373 bytes --]

Dear Memory Management Maintainer,

I am Po-Hao Su, a graduate student from the Operating Systems and Embedded
Systems Lab at National Cheng Kung University in Taiwan.

I am writing in reference to report a bug in *do_mmap(...)* function.
Recently, I found that there seems a bug after *get_unmapped_area(...)
*function
is return.
*do_mmap(...) *function will check the *addr *parameter is aligned on a
page boundary or not after *get_unmapped_area(...)* function is return.
But it will return *addr *parameter, not an error(probably to *-EINVAL*)
while address not aligned on a page boundary.
Therefore, I think address not aligned on a page boundary should be an
error(*-EINVAL*).

I also discussed this issue with others when the meeting of my lab, others
views are consistent with me.
In view of this, I report the issue. Attached is the patch for this.

If this is a wrong report, I am sorry, and please show me why kernel do it,
if convenient. Thank you.
I look forward to hearing from you.

Best regards,

蘇柏豪, 研究生
作業系統與嵌入式系統實驗室,
國立成功大學資訊工程學系
Email: supohaosu@gmail.com

Po-Hao Su, Graduate Student
Operating Systems and Embedded Systems Lab,
Department of Computer Science and Information Engineering
National Cheng Kung University, Taiwan
Email: supohaosu@gmail.com

[-- Attachment #1.2: Type: text/html, Size: 1850 bytes --]

[-- Attachment #2: linux-4.15.13-patch-pohao --]
[-- Type: application/octet-stream, Size: 410 bytes --]

diff -Nru linux-4.15.13/mm/mmap.c linux-4.15.13-pohao/mm/mmap.c
--- linux-4.15.13/mm/mmap.c	2018-03-24 18:02:53.000000000 +0800
+++ linux-4.15.13-pohao/mm/mmap.c	2018-03-28 22:08:18.768089431 +0800
@@ -1363,7 +1363,7 @@
 	 */
 	addr = get_unmapped_area(file, addr, len, pgoff, flags);
 	if (offset_in_page(addr))
-		return addr;
+		return -EINVAL;
 
 	if (prot == PROT_EXEC) {
 		pkey = execute_only_pkey(mm);

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-03-28 17:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-28 15:19 do_mmap Function Issue Report Po-Hao Su
2018-03-28 17:04 ` Matthew Wilcox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox