mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Johannes Thumshirn <jthumshirn@suse.de>
To: Dan Williams <dan.j.williams@intel.com>
Cc: Jeff Moyer <jmoyer@redhat.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Vishal Verma <vishal.verma@intel.com>,
	linux-nvdimm <linux-nvdimm@lists.01.org>,
	Dmitry Vyukov <dvyukov@google.com>
Subject: Re: [PATCH] acpi/nfit: Fix bus command validation
Date: Thu, 21 Feb 2019 14:28:32 +0100	[thread overview]
Message-ID: <cb6d55e7-8544-ce28-55e5-f4c0361a256f@suse.de> (raw)
In-Reply-To: <fcbf4a2c-a4c4-556e-f2dc-c22663997de5@suse.de>

[-- Attachment #1: Type: text/plain, Size: 833 bytes --]

[+CC dvyukov ]

On 20/02/2019 18:21, Johannes Thumshirn wrote:
> On 20/02/2019 17:15, Dan Williams wrote:> I wouldn't be opposed to
> syzkaller fuzzing the nvdimm-ioctl path.
> As a heads up, I've started adding the ioctl() definitions to syzcaller.
> Just so we don't duplicate any efforts.

So AFAICS this (see attachment) should do the trick.

@dvyukov is there something I'm missing, or can syzkaller pick up the
/dev/ndctl devices and start fuzzing the ioctl path with this?

Thanks,
	Johannes
-- 
Johannes Thumshirn                            SUSE Labs Filesystems
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

[-- Attachment #2: dev_ndctl.txt --]
[-- Type: text/plain, Size: 3090 bytes --]

# Copyright 2019 syzkaller project authors. All rights reserved.
# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.

#include <asm/ioctl.h>
#include <linux/types.h>
#include <uapi/linux/ndctl.h>

resource fd_ndctl[fd]

syz_open_dev$ndctl(dev ptr[in, string["/dev/ndctl#"]], id intptr, flags flags[open_flags]) fd_ndctl

ioctl$ND_IOCTL_DIMM_FLAGS(fd fd_ndctl, cmd const[ND_IOCTL_DIMM_FLAGS], arg ptr[in, nd_cmd_dimm_flags])
ioctl$ND_IOCTL_GET_CONFIG_SIZE(fd fd_ndctl, cmd const[ND_IOCTL_GET_CONFIG_SIZE], arg ptr[in, nd_cmd_get_config_size])
ioctl$ND_IOCTL_GET_CONFIG_DATA(fd fd_ndctl, cmd const[ND_IOCTL_GET_CONFIG_DAT], arg ptr[in, nd_cmd_get_config_data_hdr])
ioctl$ND_IOCTL_SET_CONFIG_DATA(fd fd_ndctl, cmd const[ND_IOCTL_SET_CONFIG_DATA], arg ptr[in, nd_cmd_set_config_hdr])
ioctl$ND_IOCTL_VENDOR(fd fd_ndctl, cmd const[ND_IOCTL_VENDOR], arg ptr[in, nd_cmd_vendor_hdr])

ioctl$ND_IOCTL_ARS_CAP(fd fd_ndctl, cmd const[ND_IOCTL_ARS_CAP], arg ptr[in, nd_cmd_ars_cap])
ioctl$ND_IOCTL_ARS_START(fd fd_ndctl, cmd const[ND_IOCTL_ARS_START], arg ptr[in, nd_cmd_ars_start])
ioctl$ND_IOCTL_ARS_STATUS(fd fd_ndctl, cmd const[ND_IOCTL_ARS_STATUS], arg ptr[in, nd_cmd_ars_status])
ioctl$ND_IOCTL_CLEAR_ERROR(fd fd_ndctl, cmd const[ND_IOCTL_CLEAR_ERROR], arg ptr[in, nd_cmd_clear_error])
ioctl$ND_IOCTL_CALL(fd fd_ndctl, cmd const[ND_IOCTL_CALL], arg ptr[in, nd_cmd_pkg])

nd_cmd_dimm_flags {
	status	int32
	flags	int32
} [packed]

nd_cmd_get_config_size {
	status		int32
	config_size	int32
	max_xfer	int32
} [packed]

nd_cmd_get_config_data_hdr {
	in_offset	int32
	in_length	len[out_buf, int32]
	status		int32
	out_buf		ptr[out, array[int8]
} [packed]

struct nd_cmd_set_config_hdr {
	in_offset	int32
	in_length	len[in_buf, int32]
	in_buf		ptr[in, array[int8]
} [packed]

struct nd_cmd_vendor_hdr {
	opcode		int32
	in_length	len[in_buf, int32]
	in_buf		ptr[in, array[int8]
} [packed]

nd_cmd_ars_cap {
	address		int64
        length		int64
        status		int32
        max_ars_out	int32
        clear_err_unit	int32
        flags		int16
        reserved	int16
} [packed]

nd_cmd_ars_start {
        address		int64
        length		int64
        type		int16
        flags		int8
        reserved	array[const[0, int8], 5]
        status		int32
        scrub_time	int32
} [packed]

type nd_ars_record {
	handle		int32
	reserved	int32
	err_address	int64
	length		int64
} [packed]

nd_cmd_ars_status {
        status		int32
        out_length	int32
        address		int64
        length		int64
        restart_address int64
        restart_length	int64
        type		int16
        flags		int16
        num_records	len[records, int32]
	records		ptr[out, array[nd_ars_records]
} [packed]

nd_cmd_clear_error {
        address		int64
        length		int64
        status		int32
        reserved	array[const[0, int8], 4]
        cleared		int64
} [packed]

nd_cmd_pkg {
	nd_family	int64
	nd_command	int64
	nd_size_in 	len[nd_payload, int32]
	nd_size_out	int32
	nd_reserved2	array[const[0, int32], 9]
	nd_fw_size	int32
	nd_payload	ptr [in, array[int8]]

} [packed]

      reply	other threads:[~2019-02-21 13:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-07 23:57 Dan Williams
2019-02-08  0:41 ` Verma, Vishal L
2019-02-20  1:56 ` Jeff Moyer
2019-02-20  2:58   ` Dan Williams
2019-02-20  8:29     ` Johannes Thumshirn
2019-02-20 16:15       ` Dan Williams
2019-02-20 17:21         ` Johannes Thumshirn
2019-02-21 13:28           ` Johannes Thumshirn [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cb6d55e7-8544-ce28-55e5-f4c0361a256f@suse.de \
    --to=jthumshirn@suse.de \
    --cc=dan.j.williams@intel.com \
    --cc=dvyukov@google.com \
    --cc=jmoyer@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvdimm@lists.01.org \
    --cc=vishal.verma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®