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] [thread-next>] [day] [month] [year] [list]
Message-ID: <ca55d0ac-3127-9993-5d43-3bc97738cfbb@kylinos.cn>
Date:   Mon, 27 Sep 2021 11:06:38 +0800
From:   李真能 <lizhenneng@...inos.cn>
To:     Krzysztof Wilczyński <kw@...ux.com>
Cc:     Bjorn Helgaas <bhelgaas@...gle.com>,
        Huacai Chen <chenhuacai@...ngson.cn>,
        Kai-Heng Feng <kai.heng.feng@...onical.com>,
        linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] PCI/sysfs: add write attribute for boot_vga


在 2021/9/27 上午4:00, Krzysztof Wilczyński 写道:
> [+cc Huacai and Kai-Heng as they are working in this area]
>
> Hi,
>
> Thank you for sending the patch over.
>
> I assume this is simply a resend (rather than a v2), as I see no code
> changes from the previous version you sent some time ago.
Sorry, I haven't receive any reply about this email, so I resend this.
>
>> Add writing attribute for boot_vga sys node,
>> so we can config default video display
>> output dynamically when there are two video
>> cards on a machine.
> That's OK, but why are you adding this?  What problem does it solve and
> what is the intended user here?  Might be worth adding a little bit more
> details about why this new sysfs attribute is needed.
Xorg will detemine which graphics is prime output device according 
boot_vga, if there are two graphics card, and we want xorg output 
display to diffent graphics card, we can echo 1 to boot_vga.
>
> I also need to ask, as I am not sure myself, whether this is OK to do after
> booting during runtime?  What do you think Bjorn, Huacai and Kai-Heng?

I have test this function, during runtime, if xorg's graphics output 
device is card A, then we echo 1 to boot_vga of card B, and then restart 
xorg, xorg will output to card B, if we want xorg always output to card 
B, we can echo 1 to boot_vga of card B before xorg started in daemon 
process.

> Also, please correctly capitalise the subject - have a look at previous
> commit messages to see how it should look like.
>
>> +static ssize_t boot_vga_store(struct device *dev, struct device_attribute *attr,
>> +			      const char *buf, size_t count)
>> +{
>> +	unsigned long val;
>> +	struct pci_dev *pdev = to_pci_dev(dev);
>> +	struct pci_dev *vga_dev = vga_default_device();
>> +
>> +	if (kstrtoul(buf, 0, &val) < 0)
>> +		return -EINVAL;
>> +
>> +	if (val != 1)
>> +		return -EINVAL;
> Since this is a completely new API have a look at kstrtobool() over
> kstrtoul() as the former was created to handle user input more
> consistently.
As I want restrict available value  to 1, if we use  kstrtobool(), it 
will be available when user input other value.
>
>> +	if (!capable(CAP_SYS_ADMIN))
>> +		return -EPERM;
>> +
> Check for CAP_SYS_ADMIN is a good idea, but it has to take place before you
> attempt to accept and parse a input from the user.
>
> 	Krzysztof

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ