From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2998495AbdDZLsW (ORCPT ); Wed, 26 Apr 2017 07:48:22 -0400 Received: from mail.sigma-star.at ([95.130.255.111]:45996 "EHLO mail.sigma-star.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2998237AbdDZLsN (ORCPT ); Wed, 26 Apr 2017 07:48:13 -0400 Subject: Re: [PATCH] ubifs: Return -ENOKEY from rename if encryption keys are missing To: Eric Biggers , Richard Weinberger References: <1493070381-20075-1-git-send-email-richard@nod.at> <20170425175442.GB41477@google.com> Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, linux-fscrypt@vger.kernel.org, david@sigma-star.at From: David Oberhollenzer Message-ID: <1f759fee-337f-903a-0eb0-5b364cd35e6f@sigma-star.at> Date: Wed, 26 Apr 2017 13:48:10 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170425175442.GB41477@google.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/25/2017 07:54 PM, Eric Biggers wrote: > Did you test that this change actually does anything? Unlike ext4 and f2fs, > ubifs calls fscrypt_setup_filename() from its rename methods rather than through > a helper function ${FS}_find_entry(). Therefore it's able to pass in lookup=0, > which means that the key is required. So it should already be failing with > ENOKEY. You can verify this by running xfstests generic/419. Actually, running xfstests was how this cropped up in the first place. The UBIFS rename and xrename functions allready call fscrypt_setup_filename with lookup=0, however there are other tests before that call and moving them around causes generic/419 to fail at a different place where EPERM was expected. Therefore I concluded that the safest way to fix this might be to simply copy the way the checks are handled in ext4. With recent xfstests + UBIFS support patch, after applying this patch, generic/419 passes. David