Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Cannot get I/O access to '/dev/mem'

Đang mở
#855 2 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@demoray đang làm issue này rồi.

Từ ngày 12/8/2026.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

Hello. My attempt to get I/O access to '/dev/mem' fails. May the details provided be somehow useful to investigate what prevents it.

$ hostnamectl | sed -n '8p;12p' | awk '$1=$1'
Operating System: Fedora Linux 44 (Workstation Edition)
Kernel: Linux 7.1.7-200.fc44.x86_64

Parameters the kernel was compiled with that are relevant for this report:

$ grep _STRICT_DEVMEM /boot/config-$(uname -r)
CONFIG_STRICT_DEVMEM=y
CONFIG_IO_STRICT_DEVMEM=y

I learned that the main kernel configuration option for controlling I/O access to '/dev/mem' is 'CONFIG_STRICT_DEVMEM'. Lacking knowledge to recompile the kernel, thus my alternative was to add the parameter/key 'strict-devmem=0' to my kernel cmdline:

$ cat /etc/kernel/cmdline
root=UUID=(...) ro rootflags=subvol=root rhgb quiet strict-devmem=0

Test

$ sudo dd if=/dev/mem of=/dev/null
dd: error reading '/dev/mem': Operation not permitted
2048+0 records in
2048+0 records out
1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.0943418 s, 11.1 MB/s

This program

$ file -b avml
ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), static-pie linked, BuildID[sha1]=669c613fbe2bc57310816a6071922ee2203ed86f, stripped
$ stat avml | sed -n '3,4p'
Device: 0,53	Inode: 831989      Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (1000/...)   Gid: (1000/...)

No permission correlated

$ ./avml acquire --source /dev/mem mem_dump
Error: error: unable to parse /proc/iomem
caused by:
    0: need CAP_SYS_ADMIN to read /proc/iomem

Expected!

$ sudo !!
sudo ./avml acquire --source /dev/mem mem_dump
Error: error: unable to read memory
caused by:
    0: unable to create memory snapshot from source: /dev/mem
    1: unable to create memory snapshot
    2: write block failed: 1048576..2483167231
    3: io error: unable to read memory page
    4: Operation not permitted (os error 1)

I cannot say whether the layout that is presented in 'cat /proc/iomem' represents what is readable within that limit. That seems to me out of topic though.

So, I thought I could expect that the operation would be at last permitted. Since it is not, it's still limited to the first megabyte, which is as expected on a recent Linux kernel. May I ask, do you happen to have a suggestion on this matter?

Ngôn ngữ chính
Rust
Star
1.1k
Fork
96
Merge trung bình
2 ngày 28 phút
Pull request đã merge (30 ngày)
10

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của microsoft/avml

Tất cả issue của microsoft/avml

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.