Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kmod/toa: fix is_ro_addr() #662

Merged
merged 1 commit into from
Nov 2, 2020
Merged

Conversation

yongjianchn
Copy link
Contributor

#484 by @goecho was trying to fix crash problem on some kernel versions. The new function is_ro_addr() is used to check the address is ro or rw.

but the condition seems weired:

if (pte->pte &~ _PAGE_RW) {
  ro_enable = 1;
}

pte->pte &~ _PAGE_RW means there are some other flags being set, no matter RW flags is set or not.

@ywc689
Copy link
Collaborator

ywc689 commented Sep 22, 2020

It seems good to me. But I wonder why a lot of others also do as this? Did you test your patch? Did it work OK?

https://stackoverflow.com/questions/2103315/linux-kernel-system-call-hooking-example
https://lwn.net/Articles/584198/

@ywc689 ywc689 added the pr/to-confirm-needs consider whether the feature of pr is needed label Sep 22, 2020
@yongjianchn
Copy link
Contributor Author

With #484 , I got crash on linux-4.9 (build by myself).
Then I found the wrong if condition, which "thinks" the related addrs is RO, and it did the set_rw() and set_ro(),then seconds later, my kernel crashed.
Actually, the addrs is RW, I changed the if condition (like this pull request), everything works fine.

I also test the latest CentOS 7, which also works fine.

@yongjianchn yongjianchn force-pushed the fix_toa_is_ro_addr branch 2 times, most recently from 28ad26b to 4f58554 Compare September 24, 2020 02:59
@yongjianchn yongjianchn changed the base branch from master to devel September 24, 2020 03:18
@yongjianchn
Copy link
Contributor Author

I changed base branch from master to devel.

Test on:

  • the latest CentOS 7 (kernel-3.10.0-1127.el7.x86_64)
  • the latest CentOS 8 (kernel-4.18.0-193.19.1.el8_2.x86_64)

@ywc689 ywc689 added pr/to-test-codes Compile and test the patch of pr to verify if it works. pr/codes-reviewed-ok code review passed and no problem found pr/codes-tested-ok compile ok and specified tests passed pr/accepted the pr passed all review stages and await to be merged and removed pr/to-confirm-needs consider whether the feature of pr is needed pr/to-test-codes Compile and test the patch of pr to verify if it works. labels Oct 29, 2020
@ywc689 ywc689 merged commit f9c2348 into iqiyi:devel Nov 2, 2020
ytwang0320 pushed a commit to ytwang0320/dpvs that referenced this pull request Dec 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr/accepted the pr passed all review stages and await to be merged pr/codes-reviewed-ok code review passed and no problem found pr/codes-tested-ok compile ok and specified tests passed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants