Le Sat, May 27, 2023 at 11:56:16PM +0700, Robert Elz a écrit : > I'm dual-posting this to tech-kern and tech-userlevel, as while it is > a userlevel issue, it could have kernel implications. Please respect > the Reply-To and send replies only to tech-userlevel > > You may have noticed that a recent change (mine) to the pathadj() > function (which converts an abritrary path name to its canonical form). > That function is not permitted to fail, but could. Now instead of > failing, and returning (potential) nonsense, it exits if it cannot > do what it is required to do (usually it can). In practice this > affects nothing real. > > However, it affects some uses of rump - which sets up a "block device" > in a way that its name cannot be canonicalised. It was relying upon > the way that pathadj() happens to work (based upon how realpath(3) works) > to make things function - pathadj() was issuing an error message, which > some rump using ATF tests were simply ignoring (deliberately). > > Yesterday, I was trying to find a way to make this all work - unsuccessfully. >
Since pathadj() was just sugar, calling realpath(3) (without really testing the return) and emitting some messages, in a special case can you simply "flatten" the thing i.e. replace the call to pathadj() by a call to realpath(3)? And then, there should be a code similar to what is done in src/sbin/mount/mount.c: if canonical_path is NULL, try what the user passed: 219,224 /* * Create a canonical version of the device or mount path * passed to us. It's ok for this to fail. It's also ok * for the result to be exactly the same as the original. */ canonical_path = realpath(*argv, canonical_path_buf); 227,238 /* * Try looking up the canonical path first, * then try exactly what the user entered. */ if ((canonical_path == NULL || (mntbuf = getmntpt(canonical_path)) == NULL) && (mntbuf = getmntpt(*argv)) == NULL) { out: errx(EXIT_FAILURE, "Unknown special file or file system `%s'", *argv); } >From a superficial knowledge, it seems to me that, eventually, the __mount50() syscall has to be called with a canonical path, since the syscall does no acrobatics with the path (and shall not be passed garbage). FWIW -- Thierry Laronde <tlaronde +AT+ polynum +dot+ com> http://www.kergis.com/ http://kertex.kergis.com/ Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C