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


Groups > linux.debian.kernel > #84094

Bug#1082001: linux-image-6.1.0-25-amd64: TOMOYO LSM rejects execveat(AT_EMPTY_PATH) inside chroot

From Ben Hutchings <ben@decadent.org.uk>
Newsgroups linux.debian.bugs.dist, linux.debian.kernel
Subject Bug#1082001: linux-image-6.1.0-25-amd64: TOMOYO LSM rejects execveat(AT_EMPTY_PATH) inside chroot
Date 2024-09-24 01:40 +0200
Message-ID <Jq0OR-enF6-3@gated-at.bofh.it> (permalink)
References <JnD0l-cUcI-11@gated-at.bofh.it> <JnD0l-cUcI-11@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: tag -1 upstream

On Tue, 2024-09-17 at 01:45 +0200, Alfred Agrell wrote:
> Package: src:linux
> Version: 6.1.106-3
> Severity: normal
> X-Debbugs-Cc: blubban@gmail.com
> 
> Dear Maintainer,
> 
> Please run the following program (as root, so the chroot succeeds):
> 
> 
> #define _GNU_SOURCE
> #include <unistd.h>
> #include <fcntl.h>
> #include <stdio.h>
> 
> int main(int argc, char** argv)
> {
>         chdir("/lib/");
>         if (chroot("/lib/") != 0)
>                 perror("chroot (needs root)");
>         execveat(open("./x86_64-linux-gnu/ld-linux-x86-64.so.2", O_RDONLY), "", NULL, NULL, AT_EMPTY_PATH);
>         perror("execveat");
> }
[...]

When you pass an fd other than AT_FDCWD to execveat(), the fd and
filename are translated internally to a filename starting with
"/dev/fd/".  It's noted in the manual page that this affects the way
script interpreters are called.  Another consequence is that when
TOMOYO tries to look up that filename it finds that it does not exist.
I verified that if /dev and /proc are mounted in the chroot your test
program works.

This isn't a high priority for us, but if you report this upstream it
might be fixed.  You'll need to subscribe to the TOMOYO mailing list at
<https://lists.osdn.me/mailman/listinfo/tomoyo-users-en> and then send
your report there.

Ben.

-- 
Ben Hutchings
Knowledge is power.  France is bacon.

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


Thread

Bug#1082001: linux-image-6.1.0-25-amd64: TOMOYO LSM rejects execveat(AT_EMPTY_PATH) inside chroot Alfred Agrell <blubban@gmail.com> - 2024-09-17 11:50 +0200
  Processed: Re: Bug#1082001: linux-image-6.1.0-25-amd64: TOMOYO  LSM rejects execveat(AT_EMPTY_PATH) inside chroot "Debian Bug Tracking System" <owner@bugs.debian.org> - 2024-09-24 01:40 +0200
  Bug#1082001: linux-image-6.1.0-25-amd64: TOMOYO LSM rejects execveat(AT_EMPTY_PATH) inside chroot Ben Hutchings <ben@decadent.org.uk> - 2024-09-24 01:40 +0200
    Bug#1082001: linux-image-6.1.0-25-amd64: TOMOYO LSM rejects execveat(AT_EMPTY_PATH) inside chroot Salvatore Bonaccorso <carnil@debian.org> - 2024-09-25 23:00 +0200
  Processed: Re: Bug#1082001: linux-image-6.1.0-25-amd64: TOMOYO  LSM rejects execveat(AT_EMPTY_PATH) inside chroot "Debian Bug Tracking System" <owner@bugs.debian.org> - 2024-09-25 23:00 +0200

csiph-web