From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1042004AbdDUSe7 (ORCPT ); Fri, 21 Apr 2017 14:34:59 -0400 Received: from mail-oi0-f68.google.com ([209.85.218.68]:33077 "EHLO mail-oi0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1041794AbdDUSex (ORCPT ); Fri, 21 Apr 2017 14:34:53 -0400 Date: Fri, 21 Apr 2017 11:34:45 -0700 From: Eric Biggers To: David Howells Cc: keyrings@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Eric Biggers Subject: Re: [PATCH 2/5] KEYS: user_defined: sanitize key payloads Message-ID: <20170421183445.GB12755@gmail.com> References: <20170421083037.12746-3-ebiggers3@gmail.com> <20170421083037.12746-1-ebiggers3@gmail.com> <20091.1492783037@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20091.1492783037@warthog.procyon.org.uk> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 21, 2017 at 02:57:17PM +0100, David Howells wrote: > Eric Biggers wrote: > > > - kfree_rcu(zap, rcu); > > + call_rcu(&zap->rcu, user_free_payload_rcu); > > Add kzfree_rcu()? > > David We could, but it's not trivial because the way kfree_rcu() works is to store the offset of the rcu_head as the callback function, then have a special case in RCU reclaim that recognizes "function pointers" with value < 4096 and call kfree() rather than the function. To support kzfree_rcu() we'd need to reserve another 4096 bytes of the address space (maybe at the end?), then check for the special kzfree value on every RCU reclaim. Or equivalently it could be a flag. It's possible, but it may be best to just use a custom callback for now. Then if it can be shown later that there are a lot of users who would like a "kzfree_rcu()", it can be added. - Eric