Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753236AbdLDENO (ORCPT ); Sun, 3 Dec 2017 23:13:14 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:36304 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752785AbdLDENM (ORCPT ); Sun, 3 Dec 2017 23:13:12 -0500 X-Greylist: delayed 12040 seconds by postgrey-1.27 at vger.kernel.org; Sun, 03 Dec 2017 23:13:11 EST Date: Mon, 4 Dec 2017 11:51:55 +1100 (AEDT) From: James Morris X-X-Sender: james.l.morris@localhost To: Tetsuo Handa cc: bot+015afdb01dbf2abb6a6bfdd5430b72e5503fca6d@syzkaller.appspotmail.com, linux-security-module@vger.kernel.org, selinux@tycho.nsa.gov, syzkaller-bugs@googlegroups.com, danielj@mellanox.com, dledford@redhat.com, eparis@parisplace.org, junil0814.lee@lge.com, kyeongdon.kim@lge.com, linux-kernel@vger.kernel.org, mka@chromium.org, paul@paul-moore.com, sds@tycho.nsa.gov, serge@hallyn.com Subject: Re: KASAN: slab-out-of-bounds Read in strcmp In-Reply-To: <201712032227.JCH90603.HQOOtVFMJOFLSF@I-love.SAKURA.ne.jp> Message-ID: References: <001a113f711a721c58055f052200@google.com> <089e08259d282c063e055f4bddbd@google.com> <97d6bab0-d278-9945-5d82-a0a76b8b78c5@I-love.SAKURA.ne.jp> <201712032227.JCH90603.HQOOtVFMJOFLSF@I-love.SAKURA.ne.jp> User-Agent: Alpine 2.20 (LFD 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8734 signatures=668637 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1712040010 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 582 Lines: 21 On Sun, 3 Dec 2017, Tetsuo Handa wrote: > Tetsuo Handa wrote: > > which will allow strcmp() to trigger out of bound read when "size" is > > larger than strlen(initial_sid_to_string[i]). > > Oops. "smaller" than. > > > > > Thus, I guess the simplest fix is to use strncmp() instead of strcmp(). > > Can somebody test below patch? (My CentOS 7 environment does not support > enabling SELinux in linux.git . Userspace tool is too old to support?) You mean enabling KASAN? Yep, you need gcc 4.9.2 or better. Recent Fedora has it. -- James Morris