[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: test-openat-safer failure on older kernel
From: |
Jim Meyering |
Subject: |
Re: test-openat-safer failure on older kernel |
Date: |
Sat, 05 Sep 2009 17:29:04 +0200 |
Eric Blake wrote:
> On on older machine (2.6.16.29 kernel, glibc 3.4.6), when using /proc
> emulation, openat(fd,"",O_RDONLY) was accidentally succeeding in opening a
> copy of /proc/self/fd/n (ie. the directory pointed to by fd) instead of
> failing with ENOENT. Fixed as follows. Fortunately, in a quick audit, I
> didn't see any code path in fts or coreutils that seems like it would pass
> an empty argument to openat, which is why my test-openat-safer was the
> first thing to catch this in nearly 3 years of use.
>
> --
> Don't work too hard, make some time for fun as well!
>
> Eric Blake address@hidden
>>From c46ae39631773a7fdae7d171cc4ef0bf2123efff Mon Sep 17 00:00:00 2001
> From: Eric Blake <address@hidden>
> Date: Fri, 4 Sep 2009 21:22:21 -0600
> Subject: [PATCH] openat: fail with ENOENT on empty name
>
> * lib/openat-proc.c (openat_proc_name): Special-case the empty
> buffer.
>
> Signed-off-by: Eric Blake <address@hidden>
> ---
> ChangeLog | 4 ++++
> lib/openat-proc.c | 7 +++++++
> 2 files changed, 11 insertions(+), 0 deletions(-)
>
> diff --git a/ChangeLog b/ChangeLog
> index 193ec7f..ecbf16e 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,5 +1,9 @@
> 2009-09-04 Eric Blake <address@hidden>
>
> + openat: fail with ENOENT on empty name
> + * lib/openat-proc.c (openat_proc_name): Special-case the empty
> + buffer.
Good catch. Thanks.