From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758621AbcJZLZ6 (ORCPT ); Wed, 26 Oct 2016 07:25:58 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:39616 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753142AbcJZLZt (ORCPT ); Wed, 26 Oct 2016 07:25:49 -0400 Date: Wed, 26 Oct 2016 13:22:29 +0200 (CEST) From: Thomas Gleixner To: Jiri Slaby cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH] futex: make FUTEX_OP_OPARG_SHIFT unsigned In-Reply-To: <20161024102127.28220-1-jslaby@suse.cz> Message-ID: References: <20161024102127.28220-1-jslaby@suse.cz> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 24 Oct 2016, Jiri Slaby wrote: > FUTEX_OP_OPARG_SHIFT is shifted left by 28 in futex_atomic_op_inuser and > other places. Since FUTEX_OP_OPARG_SHIFT is 8, we actually do (8 << 28). > But given both are ints, we perform operation with undefined behaviour > about which UBSAN reports: > UBSAN: Undefined behaviour in arch/x86/include/asm/futex.h:53:13 > shift exponent 776 is too large for 32-bit type 'int' shift exponent 776 ???? Thanks, tglx