Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966931AbcKLUU5 (ORCPT ); Sat, 12 Nov 2016 15:20:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45310 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966752AbcKLUU4 (ORCPT ); Sat, 12 Nov 2016 15:20:56 -0500 Date: Sat, 12 Nov 2016 15:20:54 -0500 (EST) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Ondrej Kozina , Mike Snitzer , Alexey Dobriyan cc: dm-devel@redhat.com, linux-kernel@vger.kernel.org Subject: dm-crypt accepts '+' in the key Message-ID: User-Agent: Alpine 2.02 (LRH 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Sat, 12 Nov 2016 20:20:55 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 586 Lines: 15 Hi dm-crypt uses the function kstrtou8 to decode the encryption key. kstrtou8 calls kstrtoull and kstrtoull skips the first character if it is '+'. Consequently, it is possible to load keys with '+' in it. For example, this is possible: dmsetup create cr --table "0 131072 crypt aes-cbc-essiv:sha256 +0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0+0 0 /dev/debian/tmptest 0" Should this be fixed in dm-crypt or in kstrtou8? A fix in kstrtou8 could be more appropriate, but we don't know how many other kernel parts depend on this "skip plus" behavior... Mikulas