From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/14788 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Reiner Herrmann Newsgroups: gmane.linux.lib.musl.general Subject: realpath after chroot Date: Tue, 8 Oct 2019 19:24:02 +0200 Message-ID: <20191008172402.GH8814@reiner-h.de> Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="pDMuYlNcjisHFiH4" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="235449"; mail-complaints-to="usenet@blaine.gmane.org" To: musl@lists.openwall.com Original-X-From: musl-return-14804-gllmg-musl=m.gmane.org@lists.openwall.com Tue Oct 08 19:24:22 2019 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.89) (envelope-from ) id 1iHtDh-000z51-TY for gllmg-musl@m.gmane.org; Tue, 08 Oct 2019 19:24:21 +0200 Original-Received: (qmail 13745 invoked by uid 550); 8 Oct 2019 17:24:16 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 13710 invoked from network); 8 Oct 2019 17:24:16 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=reiner-h.de; s=mail; t=1570555444; bh=ua/XvTVQKXSp+QBjfz+/C8sm37HmY8ZO1oosATMcflc=; h=Date:From:To:Subject:From; b=EovfiSkpv0XTG7qNioHrDQybrCVcWRtFJ8FxQDD2Cb/cmDtX7WV8yG+IOT2AqbzoF TSAawU7HlWYPhD5RZpkezIjtNZStEPCTBgDGwWPZmls7iKY2o4Ibt7BGb2o7nFovAk 7hpKuKKGJJa3kmZaJ/GRaA3qlbCT5hoe8HybNM8c= Content-Disposition: inline Xref: news.gmane.org gmane.linux.lib.musl.general:14788 Archived-At: --pDMuYlNcjisHFiH4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, I noticed that realpath is no longer working after chroot is called. With the example from below I get the following output with musl 1.1.23: # ./a.out / No such file or directory With glibc it is working as I would expect: # ./a.out / / #include #include #include #include #include #include int main() { char *p = realpath("/", NULL); if (!p) { printf("%s\n", strerror(errno)); } else { printf("%s\n", p); free(p); } if (chroot("/tmp") == -1) printf("chroot failed\n"); p = realpath("/", NULL); if (!p) { printf("%s\n", strerror(errno)); } else { printf("%s\n", p); free(p); } return 0; } Kind regards, Reiner --pDMuYlNcjisHFiH4 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE2Pb6feok2Q1urHM7zPBJKNsO6qcFAl2cxioACgkQzPBJKNsO 6qfpYw//e9zxTrARj+ZeAyYrGB0AL2Z3O0kzUZsfm5U2BEEKHpLnkS/U/rBs+/Qg uj+fc5UYd95OSbz6PII5fd5krScKppM/XXiflhJN2eYxr7DK35BS+7RmV3RRbZfB VRhnlH+DMQmHOaZA+URgNOo5nHwm+iSCd3t3atJy4bVJh2RiSnuQgWMV6scGi0OZ 1LzLvzO8l1Q3/jjn8dXX153XkrCqXyN+127sAUmy3M2wnQOBRj5FYaWXqMM87yQd aKNesloJQDZl/JYfjRfOCBdvsMCeHmG6aLNDEf2WvGFRMIVt1CU1OaCaw8xhINdK f+Q6eVuDUpzf8/uU+AQLNKZ1VNoeUJi8Nc0+z4ZINuRjaQno+8ti1bmNU3kMDAzf yTCDlRsSkwdHmBoKKCtDQi3oyicN6G1G/7TgW3Er31hN2ItGe5g3lVNq7dketZFh v/PCFVUB+XGWg5+p/OlJLdrk3dix18LCErHXY1EMZzhWsKNzPlG95zO2SOIkEff8 N+2HZU75bKjlEiFUit3MEbZ6RHqqNfSj3bolNNOxsymunwvRq2iyEECxVO/8SAdk uh030Q5gXyV7xG0i1StnDCLTkl2+iURVCQZV1VzdJRD60QhkngpPcFYhZ3wMNRRq 3nuzvO9VeAHxdDfds888LncomV64j3unDpYvrJtptLUAtiwtvfY= =pKlB -----END PGP SIGNATURE----- --pDMuYlNcjisHFiH4--