From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755380AbdCPQn3 (ORCPT ); Thu, 16 Mar 2017 12:43:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36376 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752438AbdCPQn1 (ORCPT ); Thu, 16 Mar 2017 12:43:27 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com BADB1437F76 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=oleg@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com BADB1437F76 Date: Thu, 16 Mar 2017 17:41:24 +0100 From: Oleg Nesterov To: Peter Zijlstra Cc: Dmitry Vyukov , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , LKML , Mathieu Desnoyers , syzkaller Subject: Re: perf: use-after-free in perf_release Message-ID: <20170316164124.GA29048@redhat.com> References: <20170314125508.GK3343@twins.programming.kicks-ass.net> <20170314140302.GA28146@redhat.com> <20170314140754.GG3328@twins.programming.kicks-ass.net> <20170314143010.GA30351@redhat.com> <20170314150241.GO5680@worktop> <20170314151910.GA31766@redhat.com> <20170314152625.GP5680@worktop> <20170314155949.GE32474@worktop> <20170315164302.GA17317@redhat.com> <20170316135735.5psknfxe7e73gnag@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170316135735.5psknfxe7e73gnag@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.5.18 (2008-05-17) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 16 Mar 2017 16:43:23 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/16, Peter Zijlstra wrote: > > On Wed, Mar 15, 2017 at 05:43:02PM +0100, Oleg Nesterov wrote: > > static inline int list_is_first(const struct list_head *list, > > const struct list_head *head) > > { > > return head->next == list; > > } > > > > won't be symmetrical with list_is_last() we already have. > > This is the one that makes sense to me though; that is, the current > list_is_last() doesn't make sense to me. > > I would expect: > > static inline int list_is_last(const struct list_head *list, > const struct list_head *head) > { > return head->prev == list > } Yes! > because @head is the list argument (yes, I know, horrible naming!). and perhaps it could have more users if we redefine it to dereference "head" which is likely more "stable", iow less likely can go away. But after the quick grep I came to conclusion it is not possible to audit the users it already has. Oleg.