From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751681AbdJZGfG (ORCPT ); Thu, 26 Oct 2017 02:35:06 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:42112 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751984AbdJZGfD (ORCPT ); Thu, 26 Oct 2017 02:35:03 -0400 Date: Thu, 26 Oct 2017 08:34:49 +0200 From: Martin Schwidefsky To: Elena Reshetova Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, heiko.carstens@de.ibm.com, jwi@linux.vnet.ibm.com, ubraun@linux.vnet.ibm.com, peterz@infradead.org, keescook@chromium.org Subject: Re: [PATCH 1/3] [S390] vmur: convert urdev.ref_count from atomic_t to refcount_t In-Reply-To: <1508485670-24070-2-git-send-email-elena.reshetova@intel.com> References: <1508485670-24070-1-git-send-email-elena.reshetova@intel.com> <1508485670-24070-2-git-send-email-elena.reshetova@intel.com> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 17102606-0040-0000-0000-000003E6FC60 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17102606-0041-0000-0000-000025E96EDA Message-Id: <20171026083449.57ccb533@mschwideX1> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-10-26_01:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710260092 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 20 Oct 2017 10:47:48 +0300 Elena Reshetova wrote: > atomic_t variables are currently used to implement reference > counters with the following properties: > - counter is initialized to 1 using atomic_set() > - a resource is freed upon counter reaching zero > - once counter reaches zero, its further > increments aren't allowed > - counter schema uses basic atomic operations > (set, inc, inc_not_zero, dec_and_test, etc.) > > Such atomic variables should be converted to a newly provided > refcount_t type and API that prevents accidental counter overflows > and underflows. This is important since overflows and underflows > can lead to use-after-free situation and be exploitable. > > The variable urdev.ref_count is used as pure reference counter. > Convert it to refcount_t and fix up the operations. > > Suggested-by: Kees Cook > Reviewed-by: David Windsor > Reviewed-by: Hans Liljestrand > Signed-off-by: Elena Reshetova Added to s390/linux:features for the next merge window. Thanks. -- blue skies, Martin. "Reality continues to ruin my life." - Calvin.