|
|
About ::
TODO ::
Blog ::
RSS ::
Old blog ::
Projects ::
GIT ::
Gallery ::
Notes
Tue, 24 Jun 2008
VM gotcha: forbidden double kmapping.
I've just known, that it is impossible to map the same page
twice: for example first time using kmap()/kunmap()
and second one via kmap_atomic()/kunmap_atomic().
Although mechanisms are a bit different in both mappings, it is
forbidden to do and system will panic like this:
IP: [] kmap_atomic_prot+0x1b/0xc5
*pdpt = 0000000031c79001 *pde = 0000000000000000
Oops: 0000 [#1] SMP
Pid: 6478, comm: pohmelfs-crypto Not tainted (2.6.25 #27)
EIP: 0060:[] EFLAGS: 00010202 CPU: 2
EIP is at kmap_atomic_prot+0x1b/0xc5
EAX: ebc7c000 EBX: 00000003 ECX: 00000000 EDX: 00000003
ESI: 00000fdc EDI: 00000163 EBP: 80000000 ESP: ebc7dee4
DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
Process pohmelfs-crypto (pid: 6478, ti=ebc7c000 task=f25040b0 task.ti=ebc7c000)
Stack: 00000000 00000003 00000fdc f7cf4078 00000fdc c0114144 00000163 80000000
c01991b1 ebc7df44 f70e3580 00000000 ebc7dfa8 ebc7df40 f70e3580 00000003
00000000 f7cf4000 f70e3580 f70ff8b0 f70ff880 f7096c00 c019a771 f70e3580
Call Trace:
[] kmap_atomic+0x11/0x14
[] update2+0x7c/0x13f
[] hmac_update+0x49/0x50
[] pohmelfs_crypto_thread_func+0x304/0x3e8 [pohmelfs]
[] hrtick_set+0x7a/0xd7
[] autoremove_wake_function+0x0/0x2b
[] pohmelfs_crypto_thread_func+0x0/0x3e8 [pohmelfs]
[] kthread+0x38/0x5f
[] kthread+0x0/0x5f
[] kernel_thread_helper+0x7/0x10
This happend for exacly above case, when page was first mapped via
kmap() in POHMELFS and then via
kmap_atomic() in HMAC crypto processing code.
I wonder what will happen if we ever try to send kmapped pages
over IPsec tunnel. Likely it will ooops too...
This can happen for example when pages are mapped in
tcp_sendpage() when calling sendfile()
over the interface, which does not support hardware checksumming
and scater-gather: mapped pages are pushed down the network stack
where they will be eventually encrypted/hashed in IPsec, which
will in turn call kmap_atomic().
So, if you will find obscure oops in kmap_atomic()
and friends, first check that calling stack did not map page
earlier.
/devel/other :: Link / Comments (0)
Please solve this captcha to be allowed to post (need to reload in a minute): 49 - 0
|