From patchwork Sat Apr 7 05:14:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Theodore Ts'o X-Patchwork-Id: 895891 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=mit.edu Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=thunk.org header.i=@thunk.org header.b="Gj9/waEM"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40J4W30d2mz9s3L for ; Sat, 7 Apr 2018 15:14:38 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750945AbeDGFOf (ORCPT ); Sat, 7 Apr 2018 01:14:35 -0400 Received: from imap.thunk.org ([74.207.234.97]:42474 "EHLO imap.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750807AbeDGFOe (ORCPT ); Sat, 7 Apr 2018 01:14:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=thunk.org; s=ef5046eb; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=uL9aMIkDFboFoUj7eTS/7c0364OHjrd5OIL8int1LQY=; b=Gj9/waEM6bt7X9NWaKPQVxKU49 5Dlm49J02THL6Z2npTzG5szBV/uOS2GXBFfGR9rk9VAanIqvV9lyqwUp4X03P3NiA8iM0r1X1UeqQ RpsnFZt0HdiVu9goDdb+ABQCyLNySYN/gopfh2En2xBoE+aVxMZxhQzG2A2ZulLFmSoA=; Received: from root (helo=callcc.thunk.org) by imap.thunk.org with local-esmtp (Exim 4.89) (envelope-from ) id 1f4gBM-0007RU-PX; Sat, 07 Apr 2018 05:14:32 +0000 Received: by callcc.thunk.org (Postfix, from userid 15806) id B52427A0155; Sat, 7 Apr 2018 01:14:31 -0400 (EDT) From: Theodore Ts'o To: Ext4 Developers List Cc: Wen Xu , Theodore Ts'o Subject: [PATCH 2/2] tests: add new test f_ea_inode_self_ref Date: Sat, 7 Apr 2018 01:14:27 -0400 Message-Id: <20180407051427.14883-2-tytso@mit.edu> X-Mailer: git-send-email 2.16.1.72.g5be1f00a9a In-Reply-To: <20180407051427.14883-1-tytso@mit.edu> References: <20180407051427.14883-1-tytso@mit.edu> X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: tytso@thunk.org X-SA-Exim-Scanned: No (on imap.thunk.org); SAEximRunCond expanded to false Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Make sure we can handle a maliciously created file system containing an inode containing an extended attribute whose e_value_inum points back at itself. Signed-off-by: Theodore Ts'o --- tests/f_ea_inode_self_ref/expect.1 | 17 +++++++++++++++++ tests/f_ea_inode_self_ref/expect.2 | 7 +++++++ tests/f_ea_inode_self_ref/image.gz | Bin 0 -> 661 bytes tests/f_ea_inode_self_ref/name | 1 + 4 files changed, 25 insertions(+) create mode 100644 tests/f_ea_inode_self_ref/expect.1 create mode 100644 tests/f_ea_inode_self_ref/expect.2 create mode 100644 tests/f_ea_inode_self_ref/image.gz create mode 100644 tests/f_ea_inode_self_ref/name diff --git a/tests/f_ea_inode_self_ref/expect.1 b/tests/f_ea_inode_self_ref/expect.1 new file mode 100644 index 000000000..f94c04d96 --- /dev/null +++ b/tests/f_ea_inode_self_ref/expect.1 @@ -0,0 +1,17 @@ +Pass 1: Checking inodes, blocks, and sizes +Inode 16 has INLINE_DATA_FL flag but extended attribute not found. Truncate? yes + +Extended attribute in inode 16 has a hash (553648128) which is invalid +Clear? yes + +Pass 2: Checking directory structure +Pass 3: Checking directory connectivity +Pass 4: Checking reference counts +Pass 5: Checking group summary information +Block bitmap differences: -20 +Fix? yes + + +test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** +test_filesys: 16/16 files (0.0% non-contiguous), 21/100 blocks +Exit status is 1 diff --git a/tests/f_ea_inode_self_ref/expect.2 b/tests/f_ea_inode_self_ref/expect.2 new file mode 100644 index 000000000..939806156 --- /dev/null +++ b/tests/f_ea_inode_self_ref/expect.2 @@ -0,0 +1,7 @@ +Pass 1: Checking inodes, blocks, and sizes +Pass 2: Checking directory structure +Pass 3: Checking directory connectivity +Pass 4: Checking reference counts +Pass 5: Checking group summary information +test_filesys: 16/16 files (0.0% non-contiguous), 21/100 blocks +Exit status is 0 diff --git a/tests/f_ea_inode_self_ref/image.gz b/tests/f_ea_inode_self_ref/image.gz new file mode 100644 index 0000000000000000000000000000000000000000..3cc733b55280d31527a6704d8632bf062994ba20 GIT binary patch literal 661 zc-oWi=3sc>d?Jd8`RyHFZ;?b9h7aj!riZq#v8lMC!@;!C`~=^`5r%+yK9C^JI|seZ)X;om4}8zU2gsR_k(@@?=}BtCjLAB zM$bl=>B72S$y1U`j?K{7ruvn)?b@RK5q~Rk3$dET#$K3w>k0QLE-hLlvvtyrCePv3*pO2p}d+v~`>bm~x zRbR5cYIM%)4#O9h7PC%ClIb@Lx>7$Yey)S{im>Yc_n7NL8p|df+x4E)(`wfJ-b*)^s9Ku8;{Vi3QGc0p4~5qS{BQWhe#L&lKgO^8E9xEoGQW}s3o$T6O%l9tVV{$S zefs$oryhkwtXpUQa`lhQ1(!CYTFn1<=D*SYZLg!#J_{a|uDP-6t=B$%_LX}MzixjO zKJ8U`*^-?{=9k%hxf=U#_51%@n2*o0D?k0a^6;(D&0deQcG+7`-}1!P?)K_)6@Syt zfBPltf4^qV_u~?u4$CtjgDqS3bsk+A^(OtEzOZ8bzZ=i~EKR!b>|xEVuezBMYiF?Z z>n^UGy3<1P^@|%de^q_?rR-jP*|x_#^1t!6(EpR$4(9%vKW{?s%Dj7r?%b-ec((Rv z6@U2r|Np;~Z~dd5bT4X4^1q2Qwu`Y({GW0ry8GB4=fBkx>m61yGf)CHaMv@uchUL9 IFoBT)08^(uS^xk5 literal 0 Hc-jL100001 diff --git a/tests/f_ea_inode_self_ref/name b/tests/f_ea_inode_self_ref/name new file mode 100644 index 000000000..4e68da818 --- /dev/null +++ b/tests/f_ea_inode_self_ref/name @@ -0,0 +1 @@ +corrupted, self-referential ea_in_inode