Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2739642rwb; Fri, 2 Dec 2022 14:26:35 -0800 (PST) X-Google-Smtp-Source: AA0mqf6lmMGrcFkB0X/bJ02tnV3M5t+H5pQ04EMRRl+z1W8phxSznfrZeT9XFdkmWbuUiZVspm1B X-Received: by 2002:a05:6402:150:b0:468:fdc3:6b44 with SMTP id s16-20020a056402015000b00468fdc36b44mr48582841edu.388.1670019995169; Fri, 02 Dec 2022 14:26:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670019995; cv=none; d=google.com; s=arc-20160816; b=bww3szso12iuCdYdQ8g/cUGxnrDZxf3STf7JLpu+nTMWseQRf6gDhH5Oe1lQ+iGAd/ +7K1LUpjGTfN1AQszK96sTmUwUdLnGob20h0pUwKj8q7cr4q+yRtjyEEC+0gg83kJ4Q7 mwPJmD3bfyP5ZEehS/SW/sRcoOlTrmpGD2e68PzRdV2dF9meRTcCetlD6D+fNB1Av+CY KeVqSxGVnQjEzjb4uqzRToqiD4TMBYHIakLHmsaieqp7fMybhmhHZ8bPKJ2fk2aw4d+J Gwxhqp5GXD5xOQ5mXuFP0jUB/z33z3WaI3FbXDo3nWzmY6xm2FUDq5AmVBPienfvMdGI N+9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8yjeqd6Koufe4qTZvRhQnhZFfJ1y5qbmqZ7QZG+tZQU=; b=QyJtwqIwxwiJQe+cHgsJdKzvuhi/o1aSWeI0/bCwMnF42ANDCal/2y9i4Sbmv2oY2/ TSzCA+satC4euohnUGdeJ6whhu+CHJabR5oFAkIrWsRAp10w7/oaD4T/XEBxu4uuOqvj W6cy4NvqoqLtrqwFrhIPMY/yYOzNDlOnGo2LwhSzG1XVU3zvigKpD+DA+2EX4WM/Hre/ tEEfgR03KnbcEjKX8S5d8SIQZDmi6AJGOemlirGoqIitZk8Jc3KZ4zrnkrM4O1PbbuZ/ TPetNAHSf4nr/I5r9dKOJCoLdpM6u5wG5fx/3Ix9+PS7GgVLbFhtB/E5Yi3Y6XrL+nWs RksA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ivPcOYRK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id be25-20020a0564021a3900b0046ae9e1bacesi7033843edb.604.2022.12.02.14.26.15; Fri, 02 Dec 2022 14:26:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ivPcOYRK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234309AbiLBV6g (ORCPT + 82 others); Fri, 2 Dec 2022 16:58:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233561AbiLBV6e (ORCPT ); Fri, 2 Dec 2022 16:58:34 -0500 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0F2AF4EB7 for ; Fri, 2 Dec 2022 13:58:33 -0800 (PST) Received: by mail-pf1-x42b.google.com with SMTP id k79so6101861pfd.7 for ; Fri, 02 Dec 2022 13:58:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8yjeqd6Koufe4qTZvRhQnhZFfJ1y5qbmqZ7QZG+tZQU=; b=ivPcOYRK1NdgChB66zDMvb7VWcDjKkliBxnnUq6YWmj8wckt4Pb4FG87vPB66UKOgv xv8mVe6PnQdADgDRE7YQHIBvedXy5bpLa0HSdOjOTNBBq/YgT3mkO8CvA8tmf/cpUVkZ gHNVQu0qhiaEhbzzG/+nBGT3f+FgCcjAVhXGA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8yjeqd6Koufe4qTZvRhQnhZFfJ1y5qbmqZ7QZG+tZQU=; b=hzJKgCPPZjEAqIZrzP2vZsqqop+euD+MumQB/vYApj3IOc9rPT+4FhUrq/r35qlvVS l4013RjdmR8XN4U59Ez7N4sF+hHZJGLJXYlb/prcVW4bkCovFlebgZPA263mBP/dnO0d GQPzELXKlGjoSJ2UYKroBiyoiKurcBG3uhwnMO8Sja1LfDy0cyZDUpoglnfD+rmuF3LL GrZBjxGiwDwcvuy291bj7+HqKdRqS1nNPciwiELG1lA2xqZWQNvIuXdVHyIHBaNkwIyH FN7bAuJ8PgfTNxNSmDnPnoFwpOiqe2FVKabt+OMfdPzQaeUjLENNLru7kXpUhaueMJd0 5gUA== X-Gm-Message-State: ANoB5pkfKxMJkxMALkhfD6r14FyXhuT+StVgwfrpJbzOZ8GHCHrjIAUD LXTh1HoX0fgXhSSQT6RAzsVRDA== X-Received: by 2002:aa7:8d8f:0:b0:56b:b112:4a16 with SMTP id i15-20020aa78d8f000000b0056bb1124a16mr77220595pfr.66.1670018313432; Fri, 02 Dec 2022 13:58:33 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id 32-20020a17090a09a300b00212735c8898sm7026718pjo.30.2022.12.02.13.58.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 13:58:32 -0800 (PST) From: Kees Cook To: ebiederm@xmission.com, liushixin2@huawei.com, Al Viro Cc: Kees Cook , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] binfmt_misc: fix shift-out-of-bounds in check_special_flags Date: Fri, 2 Dec 2022 13:58:29 -0800 Message-Id: <167001830861.1882545.11740816202645494659.b4-ty@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221102025123.1117184-1-liushixin2@huawei.com> References: <20221102025123.1117184-1-liushixin2@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2 Nov 2022 10:51:23 +0800, Liu Shixin wrote: > UBSAN reported a shift-out-of-bounds warning: > > left shift of 1 by 31 places cannot be represented in type 'int' > Call Trace: > > __dump_stack lib/dump_stack.c:88 [inline] > dump_stack_lvl+0x8d/0xcf lib/dump_stack.c:106 > ubsan_epilogue+0xa/0x44 lib/ubsan.c:151 > __ubsan_handle_shift_out_of_bounds+0x1e7/0x208 lib/ubsan.c:322 > check_special_flags fs/binfmt_misc.c:241 [inline] > create_entry fs/binfmt_misc.c:456 [inline] > bm_register_write+0x9d3/0xa20 fs/binfmt_misc.c:654 > vfs_write+0x11e/0x580 fs/read_write.c:582 > ksys_write+0xcf/0x120 fs/read_write.c:637 > do_syscall_x64 arch/x86/entry/common.c:50 [inline] > do_syscall_64+0x34/0x80 arch/x86/entry/common.c:80 > entry_SYSCALL_64_after_hwframe+0x63/0xcd > RIP: 0033:0x4194e1 > > [...] Applied to for-next/execve, thanks! [1/1] binfmt_misc: fix shift-out-of-bounds in check_special_flags https://git.kernel.org/kees/c/6a46bf558803 -- Kees Cook