모듈프로그램에서 동적 메모리 할당에 대해서..

jongsuknim의 이미지

책에는 더이상 메모리를 할당할수 없을 때 NULL을 리턴한다고 되어있던데..
kmalloc에서 GFP_ATOMIC 할때나
vmalloc에서 계속해서 메모리를 할당받으면
null을 리턴하지 않고 세그먼트에러를 내고 계속 실행 상태로 있는거 같습니다.
즉 rmmod로 하면 사용중이라고 하면서 제거가 되지 않습니다.
그리고 dmesg로 나온 에러는
1531 = C4574BF8
1532 = C4575BF8
1533 = C4576BF8
1534 = C4577BF8
1535 = C718CBF8
Unable to handle kernel paging request at virtual address d7253000
printing eip:
d7251035
*pde = 0e1da067
*pte = 00000000
Oops: 0002 [#4]
PREEMPT DEBUG_PAGEALLOC
Modules linked in: test3 test2 test1 test
CPU: 0
EIP: 0060:[<d7251035>] Not tainted VLI
EFLAGS: 00210286 (2.6.10)
EIP is at init_module+0x35/0xa0 [test3]
eax: c718dbf8 ebx: 00000600 ecx: 00000000 edx: 00001000
esi: cab32000 edi: 00000000 ebp: cab33f9c esp: cab33f88
ds: 007b es: 007b ss: 0068
Process insmod (pid: 3625, threadinfo=cab32000 task=ce98db10)
Stack: cffefa80 00000020 c718cbf8 d7251600 cab32000 cab33fbc c012e500 c042f504
00000001 d7251600 b7fab008 b7fc5640 bffff9fd cab32000 c0102669 b7fab008
0001a638 0804b050 b7fc5640 bffff9fd bffff868 00000080 0000007b 0000007b
Call Trace:
[<c0102c1f>] show_stack+0x7f/0xa0
[<c0102dc7>] show_registers+0x157/0x1d0
[<c0102fe3>] die+0xf3/0x190
[<c011050d>] do_page_fault+0x2bd/0x698
[<c0102867>] error_code+0x2b/0x30
[<c012e500>] sys_init_module+0x200/0x230
[<c0102669>] sysenter_past_esp+0x52/0x75
Code: c7 44 24 04 00 18 25 d7 c7 04 24 b8 10 25 d7 e8 a2 4e ec e8 89 f6 c7 44 24 04 20 00 00 00 a1 20 a0 35 c0 89 04 24 e8 4b bb ee e8 <89> 04 9d 00 18 25 d7 85 c0 74 46 89 5c 24 04 43 89 44 24 08 c7

이렇습니다.
왜 NULL을 리턴하지 않나요?
그리고 또한가지는 여기서 사용하는 메모리공간도 가상공간인데..
직접 물리공간을 리턴하지는 않는것인지?
그리고 stack등의 지역변수가 사용하는 메모리공간도 가상공간인지 궁금합니다.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.