Apply the LCONVPATH() to the (old) linux_stat() and linux_lstat() syscalls.
Without it, code has two problems: - behaviour of the old and new [l]stat are different with regard of the /compat/linux - directly accessing the userspace data from the kernel asks for the panics. Reported and tested by: Peter Holm Reviewed by: rdivacky MFC after: 3 days
This commit is contained in:
parent
e7627b2c62
commit
15b78ac5d1
@ -263,12 +263,17 @@ int
|
|||||||
linux_stat(struct thread *td, struct linux_stat_args *args)
|
linux_stat(struct thread *td, struct linux_stat_args *args)
|
||||||
{
|
{
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
|
char *path;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
|
LCONVPATHEXIST(td, args->path, &path);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (ldebug(stat))
|
if (ldebug(stat))
|
||||||
printf(ARGS(stat, "%s, *"), args->path);
|
printf(ARGS(stat, "%s, *"), args->path);
|
||||||
#endif
|
#endif
|
||||||
error = kern_stat(td, args->path, UIO_SYSSPACE, &buf);
|
error = kern_stat(td, path, UIO_SYSSPACE, &buf);
|
||||||
|
LFREEPATH(path);
|
||||||
if (error)
|
if (error)
|
||||||
return (error);
|
return (error);
|
||||||
translate_path_major_minor(td, args->path, &buf);
|
translate_path_major_minor(td, args->path, &buf);
|
||||||
@ -279,13 +284,17 @@ int
|
|||||||
linux_lstat(struct thread *td, struct linux_lstat_args *args)
|
linux_lstat(struct thread *td, struct linux_lstat_args *args)
|
||||||
{
|
{
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
|
char *path;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
|
LCONVPATHEXIST(td, args->path, &path);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (ldebug(lstat))
|
if (ldebug(lstat))
|
||||||
printf(ARGS(lstat, "%s, *"), args->path);
|
printf(ARGS(lstat, "%s, *"), args->path);
|
||||||
#endif
|
#endif
|
||||||
error = kern_lstat(td, args->path, UIO_SYSSPACE, &buf);
|
error = kern_lstat(td, args->path, UIO_SYSSPACE, &buf);
|
||||||
|
LFREEPATH(path);
|
||||||
if (error)
|
if (error)
|
||||||
return (error);
|
return (error);
|
||||||
translate_path_major_minor(td, args->path, &buf);
|
translate_path_major_minor(td, args->path, &buf);
|
||||||
|
Loading…
Reference in New Issue
Block a user