Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp168031ybg; Tue, 9 Jun 2020 19:58:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8RxmtURDfdTJGVHsimUqBjiY0PnLnKXlVUWGbdOOA3FZ9uOsAifPBDDhKVwFflZYFj8a2 X-Received: by 2002:a50:fa8d:: with SMTP id w13mr694087edr.324.1591757883058; Tue, 09 Jun 2020 19:58:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591757883; cv=none; d=google.com; s=arc-20160816; b=pvV3M1x408MD8k2VcaFFviqkpo+amt9C+G9OM2xTRofkvfnraSa3PkNgRZZCsS1FD+ xA6jn0MdVJuXhsqIXqLqjb7FCfVZ5awseNTud9B0u02vEr52E12eXm7KoGy0z5bgNm7h GHV6Yu/i+SDZakS4O7ejd/heLXYY4ldIK8t9A+POr/vAmqsBCRgzPvUnOCd9vlZ2N2b7 SUZ35FbJHfDTTPPGCvu9YbHlLJk+JR6e8qEBzumX69p4d62/6NO5o3fOFX4ujIeNoYwQ bTVgvlj+91+Kw/SGR/2KJaSYOyU7crVnX8mOvlTDLX/RLkuL9PyldII8oDtQxC0JNvHd eGOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=AQnKaUQ/OQPQeuoWDvqhJ4LnPS/F2P1eOCc70anF8Rk=; b=Hw3ffL+MCj8oLEEFqEbaG0RuJrPJw6m/ZvXqGvf6gH4ksmsUnF/fFRtJ5VN29+zkgO qhpDlB1LeD4hnuOWL4vckMQdTv1mSj3DbxKKam77xtCbW2RqJ4qsL4qoJ32L2NyC2RAI AiJeq4XLeK40yc3IRvd6/NyomniwkFRV5UG/nJzLICYo7HQeu1ameUElXH0P1jsjPbUh JKCOt1A/oCapQcGCB8evuyO/gyJHjrXnOJVUHSbEWgbRxLke857cm1CIhdWEUD6jacKu Jw310/UYmYQ+u6OUd20OHla4uwnEjbuxsXKTNKm8LUxcVssNkYhFYkTECK/97mvp6sEM qgzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cnNSV5ma; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bk19si11454287ejb.669.2020.06.09.19.57.39; Tue, 09 Jun 2020 19:58:03 -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=@kernel.org header.s=default header.b=cnNSV5ma; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726017AbgFJCxn (ORCPT + 99 others); Tue, 9 Jun 2020 22:53:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:41588 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725798AbgFJCxn (ORCPT ); Tue, 9 Jun 2020 22:53:43 -0400 Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 471282083E for ; Wed, 10 Jun 2020 02:53:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591757622; bh=D8hQc4Kxyap6WmQAGeRc6/yANnD6rhyaGMOxHLKk8qY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=cnNSV5maGjn/ERbZkPdiqXXFRR475ELKK4IHPhaEirALbWQxilgVgLfnl3tdpOjFv 8luYQI5I0umFVp2BX1rdmvLJ/CW8v5JX82lQsG+MQTsfmJ6FutciHLWXLXQ9PeDB4E zmbdldmg7cC+KztIakdROB03A6+cUdHD9xrEu1Q0= Received: by mail-lj1-f179.google.com with SMTP id n23so567352ljh.7 for ; Tue, 09 Jun 2020 19:53:42 -0700 (PDT) X-Gm-Message-State: AOAM533c2+Fyx7tHcbP26FTmWWiCzq60DwFpQLOovATlrgjF6Csui26S zrpmSjcsArOufKiJjv7HlMg/+/WVFLnPMUqqmuw= X-Received: by 2002:a2e:2a42:: with SMTP id q63mr613929ljq.265.1591757620450; Tue, 09 Jun 2020 19:53:40 -0700 (PDT) MIME-Version: 1.0 References: <20200428091149.GB19958@linux.vnet.ibm.com> <20200428123914.GA27920@redhat.com> <20200504164724.GA28697@redhat.com> In-Reply-To: From: Guo Ren Date: Wed, 10 Jun 2020 10:53:29 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] uprobes: ensure that uprobe->offset and ->ref_ctr_offset are properly aligned To: Christian Borntraeger Cc: Oleg Nesterov , Srikar Dronamraju , "David S. Miller" , Linus Torvalds , Steven Rostedt , "Eric W. Biederman" , Peter Zijlstra , Ingo Molnar , Jann Horn , Al Viro , Jens Axboe , Security Officers , Andrea Arcangeli , Ananth N Mavinakayanahalli , Naveen Rao , Andrew Morton , Linux Kernel Mailing List , Vasily Gorbik , Sven Schnelle Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 5, 2020 at 2:41 AM Christian Borntraeger wrote: > > > > On 04.05.20 18:47, Oleg Nesterov wrote: > > uprobe_write_opcode() must not cross page boundary; prepare_uprobe() > > relies on arch_uprobe_analyze_insn() which should validate "vaddr" but > > some architectures (csky, s390, and sparc) don't do this. > > I think the idea was that the uprobe instruction is 2 bytes and instructions > are always aligned to 2 bytes on s390. (we can have 2,4 or 6 bytes). Agree, csky has two length-types of instructions (2,4 bytes). > > > > > We can remove the BUG_ON() check in prepare_uprobe() and validate the > > offset early in __uprobe_register(). The new IS_ALIGNED() check matches > > the alignment check in arch_prepare_kprobe() on supported architectures, > > so I think that all insns must be aligned to UPROBE_SWBP_INSN_SIZE. > > Not sure if it would have been possible to try to create a uprobe on an > odd address. If yes, then the new IS_ALIGNED check certainly makes this > better for s390, so the patch looks sane. Adding Vasily and Sven to double > check. Also good to csky. -- Best Regards Guo Ren ML: https://lore.kernel.org/linux-csky/