Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4205121pxb; Mon, 27 Sep 2021 11:35:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRjWbwSR04CEI69MznvHOnpCwCkJ+r9UJ7XEXEx2jpPhMESrXb0onadTM6zz9JiSSYHt77 X-Received: by 2002:a17:906:144e:: with SMTP id q14mr1682904ejc.19.1632767721938; Mon, 27 Sep 2021 11:35:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632767721; cv=none; d=google.com; s=arc-20160816; b=jh7taylAnS9sHoQDSob8wBBN9rgPbfSRk52tl4EXggR3Xby/OpkNFBgn9U2QMoFA8U X8ptJBalqcVPIQgvUj6D9fDY6363gvS/9lgNQeO/9lAc8882V+ho2Lmv/JMYboiI3hBG HJc1EBuAhks0RZLAjKdZy28eb/59Y99ZXHTw3E1UiDpNtx8vfDlOL+3jYYYiqJV9gwSK 1YGWYwK3g1ibojoAkjebxHKZSbPNZzZQ8wOtbhcoWfngcKZZ8Fv+1m/+FilAFkcThC6z f9lErIGuPC4kpwTun41kBJkWTRH7NtG4h/PS3PcKeTcQ9ij4dXEbAyTFzIYDAb18rkWi 7uTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=zBKO83J1C1DNn2R4raJlP58CTJ+u3r/ACscvA3njVnA=; b=GUik92n2X3vKvTWVuNUH2UpEYS1iS2tg49ZcRU/QUQXMa5MusWFnyx3YjfE4uvbbff SMohVJOTf/EGJOJAcU+3m9PnhR8QZFOU4TNQkNVMoejaAsBZv17dwsyI5wtV5dmeMAdh 0bVls8NSsZ7tfTYkGi21qD2+wOvKZ+wuUtTbl6lmYPVdz+FjZ8dY+iqwEHSAALH2X2FW WEzfQH3bQffUcR0ZA1gJOFw1k3rR+lNt/puNJYFPAb7vhBGzbVysFO9P8H6annl8B4qR wm5NdsiDJ6ndiVqjpiNOwtcKp8UYJ7IwR0o7FN/dDIWCaVUWOF1c9TEdII/TLfthzOPh ARIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=YbDQ5OpS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y15si18809801edj.517.2021.09.27.11.34.58; Mon, 27 Sep 2021 11:35:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=YbDQ5OpS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236263AbhI0SfC (ORCPT + 99 others); Mon, 27 Sep 2021 14:35:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236205AbhI0SfB (ORCPT ); Mon, 27 Sep 2021 14:35:01 -0400 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AE34C061575 for ; Mon, 27 Sep 2021 11:33:21 -0700 (PDT) Received: by mail-lf1-x135.google.com with SMTP id t10so81327859lfd.8 for ; Mon, 27 Sep 2021 11:33:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=zBKO83J1C1DNn2R4raJlP58CTJ+u3r/ACscvA3njVnA=; b=YbDQ5OpSuV6v9NSHnBKcDUKW4oeDmXF0NHBGuo3vHIF2Mp24W0VXIFsXRLwyniRIzR aDTXrs5dla+qbA47Mgcez8/uDJZ7dJZZiKprKSFRNEPDPSMmKJT6hPFTaxWvgqSBizR+ VAPbppHwvThw+fFO74IZ68YspiGMMjy+yalYc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=zBKO83J1C1DNn2R4raJlP58CTJ+u3r/ACscvA3njVnA=; b=yqQlZFgCt3XcEgCZajOzw1EDTPzygHSatvktv42/lHjyRYKQtg6rE/Vt2qWaZpvEIt MEwgVD9mrdXpK0LBatqVcqcTAssCw2vlmaSD1F2rxnPGym+necX4BLd9q5t3AI+FpBuM TUDSfb++lUBu48BghGniNPzMcynJBlkMiWqHxkotfRZfRhsHRnrOchE8U8FI5ghSzWmT nLkxeEoWO8Ib3ldM3vkKwZjNTgwRqvEcOtvXZ0Baz+Lw/THOJUPYluYWfbWbCjV3fJ9S Q+Qqm3OMYZYc1PxstL5mJ+6puhLNmoFQ/I37f1/7mEby6oPkXTYKoYOks9bcvoDmK64V i50A== X-Gm-Message-State: AOAM531ujikR/df4lRYpBc2g0UVqckDuabNLFwGCPCI4ssx39VZpeHzW R9sPuPV4SRWUgCTUUNaTS8S1uWBiI9z1nWVTpgU= X-Received: by 2002:a05:651c:1596:: with SMTP id h22mr1377403ljq.146.1632767599170; Mon, 27 Sep 2021 11:33:19 -0700 (PDT) Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com. [209.85.167.51]) by smtp.gmail.com with ESMTPSA id 9sm1674040lfp.129.2021.09.27.11.33.16 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Sep 2021 11:33:17 -0700 (PDT) Received: by mail-lf1-f51.google.com with SMTP id i4so81230098lfv.4 for ; Mon, 27 Sep 2021 11:33:16 -0700 (PDT) X-Received: by 2002:a2e:a7d0:: with SMTP id x16mr1309663ljp.494.1632767596702; Mon, 27 Sep 2021 11:33:16 -0700 (PDT) MIME-Version: 1.0 References: <20210927094123.576521-1-arnd@kernel.org> <40217483-1b8d-28ec-bbfc-8f979773b166@redhat.com> <20210927130253.GH2083@kadam> In-Reply-To: From: Linus Torvalds Date: Mon, 27 Sep 2021 11:33:00 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] vboxsf: fix old signature detection To: Arnd Bergmann Cc: Dan Carpenter , Hans de Goede , Luc Van Oostenryck , Sparse Mailing-list , Nathan Chancellor , Nick Desaulniers , Al Viro , Arnd Bergmann , Linux FS-devel Mailing List , Linux Kernel Mailing List , llvm@lists.linux.dev Content-Type: multipart/mixed; boundary="0000000000009a84d405ccfe541b" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --0000000000009a84d405ccfe541b Content-Type: text/plain; charset="UTF-8" On Mon, Sep 27, 2021 at 6:22 AM Arnd Bergmann wrote: > > More specifically, ' think '\377' may be either -1 or 255 depending on > the architecture. > On most architectures, 'char' is implicitly signed, but on some others > it is not. Yeah. That code is just broken. And Arnd, your patch may be "conceptually minimal", in that it keeps thed broken code and makes it work. But it just dials up the oddity to 11. The proper patch is just this appended thing that stops playing silly games, and just uses "memcmp()". I've verified that with sane build configurations, it just generates testq %rsi, %rsi je .L25 cmpl $-33620224, (%rsi) je .L31 for that if (data && !memcmp(data, VBSF_MOUNT_SIGNATURE, 4)) { test. With a lot of crazy debug options you'll actually see the "memcmp()", but the bad code generation is the least of your options in that case. Linus --0000000000009a84d405ccfe541b Content-Type: text/x-patch; charset="US-ASCII"; name="patch.diff" Content-Disposition: attachment; filename="patch.diff" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_ku2z8brl0 IGZzL3Zib3hzZi9zdXBlci5jIHwgMTIgKystLS0tLS0tLS0tCiAxIGZpbGUgY2hhbmdlZCwgMiBp bnNlcnR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