Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp698776pxu; Thu, 3 Dec 2020 10:21:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJzA921ktSJqWdZF1ejHxPpxgtwAl1QpB3b99qB/Lb4u8Se7/ikBIs6ASDJHDZiel47BmdKv X-Received: by 2002:a17:906:3c11:: with SMTP id h17mr3628164ejg.20.1607019662986; Thu, 03 Dec 2020 10:21:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607019662; cv=none; d=google.com; s=arc-20160816; b=mksiwgeKSZ95HJWlBZtg5Dft+yJRbYWt/Gdy2CEIqSzY4BeeuyJP0yzaY0OHYXNtVO ChS0u0dK6KvIXUp9+QSpbdtuOU0pXtD0Ihe5GPMo7i1rzJJeRFZogJ8v8huseYxLwnQz ZdxLQUCNin0uMacpJN0NT6L11a+dVhYr1MB5s4SI5JRYwGXdQ40vMOU0nv2RXSMDsFJA 6+q9GmoJLh9YMoiGacoy2N5fZFebV4euJM5EGxqCmJBwN0s4VIeRiHPPGuDninTjcz6X 7+UBRqgjLW95o0avS0Okpv5FnY3fmpCG5eq73q7jG2XItZh3wP+fx/mmBCEP/bBsvyZf /Usw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=9m4NiydVLFvnOy0kDRZckdmjd5apIRy2SjVNb1/3aEo=; b=tEu3jBcsnjA0fOziRv09DKpi40Dn4IOOZhmake7djN57+FnT5vu0z0N6VLfMLrCBB/ 8XhQT0NQPPt1Wl8nCQvTxUcatM+F5XHF2ETjX71C8K97YLt5RIPdxNThFXXoiaDKc60B Ky8VadZHdngEffPEmMi4pSyN1e7rKKIkLujvuH3MJx2itDMJGp8/lk3ut9yhghXCYjly yy0yyC3asjVvV5QQLfP+kyhK3TXBDu0a/VALoJU7A2El8pN8L/Y+ZCNn4JW5eu5H79t4 1yoEKqnlvhXM2jFrNuJo5vp06ThrEy3SUfyzvQRka3gIm0172HEweLTEiC85L2OOkEuT k1Mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=L9SK4kv3; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r4si1376270edi.504.2020.12.03.10.20.38; Thu, 03 Dec 2020 10:21:02 -0800 (PST) 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=@alien8.de header.s=dkim header.b=L9SK4kv3; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727457AbgLCSR7 (ORCPT + 99 others); Thu, 3 Dec 2020 13:17:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727004AbgLCSR7 (ORCPT ); Thu, 3 Dec 2020 13:17:59 -0500 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D366C061A4E for ; Thu, 3 Dec 2020 10:17:19 -0800 (PST) Received: from zn.tnic (p200300ec2f0dc5004496c992b512bfd2.dip0.t-ipconnect.de [IPv6:2003:ec:2f0d:c500:4496:c992:b512:bfd2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 98FD31EC0283; Thu, 3 Dec 2020 19:17:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1607019437; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=9m4NiydVLFvnOy0kDRZckdmjd5apIRy2SjVNb1/3aEo=; b=L9SK4kv3O3iy+1vcp5dZkf5JxWogEHm2opxaAwUWVuLJ3p6xkNJvEu6jdspHq+jrRv54lf k5v3Hblo9NP/CnKuE1FG9/roLs1X/3FvHq0DWr/EgFkRZL+3fwF9VXO93n/5Yym6ed0fp7 n330h3Khj1okcJSQWq9ZnGSB9Od3+tI= Date: Thu, 3 Dec 2020 19:17:12 +0100 From: Borislav Petkov To: Tom Lendacky Cc: Masami Hiramatsu , x86@kernel.org, Thomas Gleixner , Ingo Molnar , Kees Cook , "H . Peter Anvin" , Joerg Roedel , "Gustavo A . R . Silva" , Jann Horn , Srikar Dronamraju , Ricardo Neri , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/3] x86/uprobes: Fix not using prefixes.nbytes for loop over prefixes.bytes Message-ID: <20201203181712.GN3059@zn.tnic> References: <160697102582.3146288.10127018634865687932.stgit@devnote2> <160697103739.3146288.7437620795200799020.stgit@devnote2> <20201203123757.GH3059@zn.tnic> <20201203124121.GI3059@zn.tnic> <20201203124820.GJ3059@zn.tnic> <1c1b265f-34e3-f5cc-0e7b-186dc26c94b7@amd.com> <20201203165420.GL3059@zn.tnic> <20201203170140.GM3059@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 03, 2020 at 12:10:10PM -0600, Tom Lendacky wrote: > Since that struct is used in multiple places, I think basing it on the array > size is the best way to go. The main point of the check is just to be sure > you don't read outside of the array. Well, what happens if someone increases the array size of: struct insn_field { union { insn_byte_t bytes[4]; ^^^^ ? That's why a separate array only for legacy prefixes would be better in the long run. The array size check is good as a short-term fix for stable. I'd say. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette