From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S941602AbcJSOU0 (ORCPT ); Wed, 19 Oct 2016 10:20:26 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:42114 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S938647AbcJSOUX (ORCPT ); Wed, 19 Oct 2016 10:20:23 -0400 Date: Wed, 19 Oct 2016 15:20:15 +0100 From: Al Viro To: Leon Yu Cc: Andrew Morton , Kees Cook , Oleg Nesterov , Michal Hocko , John Stultz , Mateusz Guzik , Janis Danisevskis , linux-kernel@vger.kernel.org Subject: Re: [PATCH] proc: fix NULL dereference when reading /proc//auxv Message-ID: <20161019142015.GG19539@ZenIV.linux.org.uk> References: <1476885580-7612-1-git-send-email-chianglungyu@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1476885580-7612-1-git-send-email-chianglungyu@gmail.com> User-Agent: Mutt/1.7.0 (2016-08-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 19, 2016 at 09:59:40PM +0800, Leon Yu wrote: > Reading auxv of any kernel thread results in NULL pointer dereferencing in > auxv_read() where mm can be NULL or even error code. Fix that by testing mm > with IS_ERR_OR_NULL() helper. This is also the original behavior changed by > recent commit c5317167854e ("proc: switch auxv to use of __mem_open()"). What the... How can it be ERR_PTR(...) after it has passed __mem_open()? I agree that we ought to check for NULL mm (the only question is whether it's best done by failing open() or by treating the file as empty), but this IS_ERR_OR_NULL() is pure cargo-cult, AFAICS.