From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: Revert "accel/amdxdna: Support read-only user-pointer BO mappings"
Date: Mon, 25 May 2026 19:46:43 +1000 [thread overview]
Message-ID: <review-patch1-20260521162930.1451042-1-lizhi.hou@amd.com> (raw)
In-Reply-To: <20260521162930.1451042-1-lizhi.hou@amd.com>
Patch Review
**Commit message issues:**
The message "The read-only feature requires further consideration" is insufficiently detailed for a revert. It should explain the specific problems. The original `readonly_va_entry()` function had at least two notable issues:
1. **Race condition / TOCTOU:** The function checks VMA flags (`vm_flags & VM_WRITE`) under `mmap_read_lock`, but by the time `pin_user_pages_fast()` is called (which does its own VMA lookup internally), the VMA could have changed — it could have been split, unmapped, or had its permissions changed via `mprotect()`. This is a classic time-of-check-to-time-of-use race. The `pin_user_pages_fast` GUP path already handles write permission checking internally when `FOLL_WRITE` is (or isn't) passed, so duplicating that logic at a different point in time is fragile.
2. **Spanning multiple VMAs:** The check `vma->vm_end - va_ent->vaddr < va_ent->len` assumes the entire range is covered by a single VMA, but a user-pointer range could span multiple VMAs with different permissions. `find_vma()` only returns the first one. This means the read-only detection could be incorrect for multi-VMA ranges.
These would be good things to mention in the commit message.
**Code changes — correctness:**
The diff itself is a clean revert:
- Removes `readonly_va_entry()` entirely — correct.
- Removes `bool readonly = true;` declaration — correct.
- Removes the `readonly_va_entry()` call in the validation loop — correct.
- Changes `(readonly ? 0 : FOLL_WRITE) | FOLL_LONGTERM` to `FOLL_WRITE | FOLL_LONGTERM` — correct, always pins as writable.
- Changes `(readonly ? O_RDONLY : O_RDWR) | O_CLOEXEC` to `O_RDWR | O_CLOEXEC` — correct, always exports as read-write.
The post-revert state matches what existed before `f649e63d4a64` was applied.
**Minor nit:** The revert message doesn't include a `Cc: stable@` tag. If the original commit went into a released kernel and the TOCTOU race is considered a security-relevant bug, a stable backport annotation might be appropriate. But this is at the maintainer's discretion.
**Recommendation:** Request an improved commit message that explains the specific technical concerns motivating the revert (TOCTOU race, single-VMA assumption, or whatever the actual driver is). The code change itself is correct and can be accepted as-is once the message is improved.
---
Generated by Claude Code Patch Reviewer
prev parent reply other threads:[~2026-05-25 9:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-21 16:29 [PATCH V1] Revert "accel/amdxdna: Support read-only user-pointer BO mappings" Lizhi Hou
2026-05-22 7:29 ` Christian König
2026-05-25 9:46 ` Claude review: " Claude Code Review Bot
2026-05-25 9:46 ` Claude Code Review Bot [this message]
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=review-patch1-20260521162930.1451042-1-lizhi.hou@amd.com \
--to=claude-review@example.com \
--cc=dri-devel-reviews@example.com \
/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