Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.kernel > #91412

Bug#1128397: linux-image-6.18.10+deb14-amd64: open(/proc/$pid/maps) is empty after $pid exec()s, unless you read a partial line from the fd before, in which case it has the rest of the line only

From наб <nabijaczleweli@nabijaczleweli.xyz>
Newsgroups linux.debian.bugs.dist, linux.debian.kernel
Subject Bug#1128397: linux-image-6.18.10+deb14-amd64: open(/proc/$pid/maps) is empty after $pid exec()s, unless you read a partial line from the fd before, in which case it has the rest of the line only
Date 2026-02-25 23:40 +0100
Message-ID <MsvHX-3jBg-1@gated-at.bofh.it> (permalink)
References <Mq7Ts-1IKJ-7@gated-at.bofh.it> <MssK5-3hDt-3@gated-at.bofh.it> <Mq7Ts-1IKJ-7@gated-at.bofh.it> <MssK5-3hDt-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Cross-posted to 2 groups.

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Control: tags -1 - moreinfo

I'll be honest with you, I don't really know.

Locking in the memory map on read() instead of on open() seems at least
as bad if not worse.

For read -> exec -> read, the second read yielding the partial
"b3000 r--p 00000000 00:8a 816985                     /home/nabijaczleweli/uwu/otp/a.out\n"
isn't pretty, but the alternative is that you get your line truncated
for no reason if your buffer falls mid-line,
which does now sound worse than keeping that as-is.

Of course, the seek behaviour seems obviously wrong as well:
  lseek(0, 200, SET) reads empty,
  lseek(0, 220, SET) reads the first line skip 20 characters,
  lseek(0, 201, SET) reads the first line skip 1 character,
  lseek(0, 110, SET) reads the first line skip 10 characters:
  (yes, the hundred digit seems meaningless here? 6.1.0-35-amd64)
  int main() {
  	close(0);
  	open("/proc/self/maps", 0);
  	lseek(0, (long)110, 0);
  	execlp("cat", "cat", (void *)0);
  }
but that seems tangential.

Best,

Back to linux.debian.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Bug#1128397: linux-image-6.18.10+deb14-amd64: open(/proc/$pid/maps) is empty after $pid exec()s, unless you read a partial line from the fd before, in which case it has the rest of the line only Ben Hutchings <ben@decadent.org.uk> - 2026-02-25 20:30 +0100
  Bug#1128397: linux-image-6.18.10+deb14-amd64: open(/proc/$pid/maps) is empty after $pid exec()s, unless you read a partial line from the fd before, in which case it has the rest of the line only наб <nabijaczleweli@nabijaczleweli.xyz> - 2026-02-25 23:40 +0100

csiph-web