lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Thu, 7 Mar 2024 10:13:33 +0800
From: Jason Yan <yanaijie@...wei.com>
To: John Garry <john.g.garry@...cle.com>, Xingui Yang <yangxingui@...wei.com>,
	<jejb@...ux.ibm.com>, <martin.petersen@...cle.com>,
	<damien.lemoal@...nsource.wdc.com>
CC: <linux-scsi@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	<linuxarm@...wei.com>, <prime.zeng@...ilicon.com>,
	<chenxiang66@...ilicon.com>, <kangfenglong@...wei.com>
Subject: Re: [PATCH v2] scsi: libsas: Fix disk not being scanned in after
 being removed

On 2024/3/7 2:43, John Garry wrote:
> As an aside, could libsas - and your changes here - be simpler if we 
> changed smp_execute_task() like this:
> 
> static int smp_execute_task(struct domain_device *dev, void *req /* can 
> be on the stack */, int req_size,
>                  void *resp /* can be on the stack */, int resp_size)
> {
>      struct scatterlist req_sg;
>      struct scatterlist resp_sg;
>      int ret;
>      void *_req = kmemdup(req, req_size, GFP_KERNEL);
>      void *_resp = alloc_smp_resp(resp_size);
>      if (!_req || !resp)
>          return -ENOMEM;
> 
>      sg_init_one(&req_sg, _req, req_size);
>      sg_init_one(&resp_sg, _resp, resp_size);
>      ret = smp_execute_task_sg(dev, &req_sg, &resp_sg);
>      memcpy(resp, _resp, resp_size);
>      kfree(_req);
>      kfree(_resp);
>      return ret;
> }
> 
> We need to use alloc_smp_resp() and alloc_smp_req() as we can't allocate 
> these memories on the stack for calling sg_init_one(). But if we changed 
> smp_execute_task() to memcpy from/to data on the stack, it might make 
> callers simpler. I'm not sure.

Maybe simpler. I have not check all the length of these buffers, but 
there is still a risk of stack overflow if the buffer on stack is too 
large.

Thanks,
Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ