From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21823 invoked by alias); 24 Jan 2011 19:58:26 -0000 Received: (qmail 21760 invoked by uid 22791); 24 Jan 2011 19:58:26 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_20,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-fx0-f41.google.com (HELO mail-fx0-f41.google.com) (209.85.161.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 24 Jan 2011 19:58:19 +0000 Received: by fxm12 with SMTP id 12so4632512fxm.0 for ; Mon, 24 Jan 2011 11:58:16 -0800 (PST) Received: by 10.223.101.195 with SMTP id d3mr4713919fao.21.1295899096613; Mon, 24 Jan 2011 11:58:16 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.79.16 with HTTP; Mon, 24 Jan 2011 11:57:56 -0800 (PST) Reply-To: linasvepstas@gmail.com From: Linas Vepstas Date: Mon, 24 Jan 2011 21:05:00 -0000 Message-ID: Subject: [BUG] Generic syscalls -- chmod vs. fchmodat To: Chris Metcalf , Arnd Bergmann Cc: GLIBC Devel , linux-kernel@vger.kernel.org, libc-ports@sourceware.org Content-Type: text/plain; charset=UTF-8 Mailing-List: contact libc-ports-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: libc-ports-owner@sourceware.org X-SW-Source: 2011-01/txt/msg00013.txt.bz2 Chris, Arnd, all, Found a bug/incompatibility in the generic syscalls chmod implementation; not sure if this is a kernel bug or a glibc bug, or how to correctly resolve it. The new "generic chmod" implementation for glibc sends chmod to the kernel call sys_fchmodat with AT_FDCWD, instead of using the older "deprecated" chmod syscall. These two behave slightly differently: with the new implementation, the file "" (i.e. string of length zero) gets interpreted as . and so the syscall succeeds, setting perms on . The old syscall would return an errno=2 No such file or directory for this filename. My gut instinct is that this is a kernel bug, but am not so sure; perhaps this is "working as designed". I thought of submitting a patch to fs/namei.c to fix this, but then got lost in the details: there didn't seem to be any particularly good place to add this check. Meanwhile, a glibc test case (posix/tst-chmod.c) is failing as a result. Should we put a check for this funky non-filename into the glibc generic code, or into sys_chmodat? Recommendations? --linas