linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Po-Hao Su <supohaosu@gmail.com>
To: linux-mm@kvack.org
Subject: do_mmap Function Issue Report
Date: Wed, 28 Mar 2018 23:19:30 +0800	[thread overview]
Message-ID: <CAD5U=y8Q-9G+6n9bRs1BbirwhAJ5z0-CS7sG1q8ypqLaDyyHgQ@mail.gmail.com> (raw)


[-- 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);

             reply	other threads:[~2018-03-28 15:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-28 15:19 Po-Hao Su [this message]
2018-03-28 17:04 ` Matthew Wilcox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAD5U=y8Q-9G+6n9bRs1BbirwhAJ5z0-CS7sG1q8ypqLaDyyHgQ@mail.gmail.com' \
    --to=supohaosu@gmail.com \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox