| Summary: | kvm_close tries to munmap NULL memory | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | Ashish SHUKLA <ashish> | ||||||
| Component: | bin | Assignee: | Ashish SHUKLA <ashish> | ||||||
| Status: | Closed FIXED | ||||||||
| Severity: | Affects Only Me | CC: | markj, yonas.yanfa | ||||||
| Priority: | --- | ||||||||
| Version: | 13.1-RELEASE | ||||||||
| Hardware: | Any | ||||||||
| OS: | Any | ||||||||
| Attachments: |
|
||||||||
|
Description
Ashish SHUKLA
2022-08-30 08:20:25 UTC
Thanks for working on this, Ashish. I hope this patch gets committed soon. This seems ok to me. I would check sparse_map == NULL instead of checking pt_sparse_size != 0. The reason is that the assignment to pt_sparse_size might be moved earlier by some future change, and then the code will be wrong again. Created attachment 237251 [details]
Fix v2
Thanks for the review. I've incorporated your suggestion, and updated the patch.
(In reply to Ashish SHUKLA from comment #3) Looks good. Feel free to commit with "Reviewed by: markj". A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=e6901a29bc4345f12e9c85426cc2be81045020a6 commit e6901a29bc4345f12e9c85426cc2be81045020a6 Author: Ashish SHUKLA <ashish@FreeBSD.org> AuthorDate: 2022-08-30 08:18:51 +0000 Commit: Ashish SHUKLA <ashish@FreeBSD.org> CommitDate: 2022-10-16 16:49:16 +0000 kvm_close(3): Check kd->sparse_map != NULL before munmap PR: 266113 Reviewed by: markj lib/libkvm/kvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (In reply to Mark Johnston from comment #4) Committed, thanks for reviewing it. Do I need to do anything for it to be merged to releng/13.1, or stable/13 branch(es) ? Thanks! Bump. (In reply to Ashish SHUKLA from comment #6) It will not get merged to the releng/13.1 branch, since the bug is not severe enough to warrant an erratum notice. To merge to stable/13, follow the steps here: https://docs.freebsd.org/en/articles/committers-guide/#_summary I'm happy to do the MFC as well, just let me know. A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=c3af4c1ee8791f4e1bddd4df648c8d5cfdc62b2e commit c3af4c1ee8791f4e1bddd4df648c8d5cfdc62b2e Author: Ashish SHUKLA <ashish@FreeBSD.org> AuthorDate: 2022-08-30 08:18:51 +0000 Commit: Ashish SHUKLA <ashish@FreeBSD.org> CommitDate: 2022-10-26 03:23:24 +0000 kvm_close(3): Check kd->sparse_map != NULL before munmap PR: 266113 Reviewed by: markj (cherry picked from commit e6901a29bc4345f12e9c85426cc2be81045020a6) lib/libkvm/kvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (In reply to Mark Johnston from comment #8) Hi Mark, Thanks for the guidance. I've performed the MFC to stable/13. If nothing else is needed here, is it okay to close this PR ? Thanks! (In reply to Ashish SHUKLA from comment #10) Yep, thanks for the patch! |