commit 5342282981206c6b9e13457bf55530cef4cbf06b Author: MSVSphere Packaging Team Date: Fri Oct 25 16:31:08 2024 +0300 import libpciaccess-0.16-15.el10 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0ed2402 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/libpciaccess-0.16.tar.bz2 diff --git a/.libpciaccess.metadata b/.libpciaccess.metadata new file mode 100644 index 0000000..2c3cb17 --- /dev/null +++ b/.libpciaccess.metadata @@ -0,0 +1 @@ +ffaa13f2df5f822da1089b55223b217c142ef919 SOURCES/libpciaccess-0.16.tar.bz2 diff --git a/SOURCES/0001-vgaarb-Check-snprintf-return-value.patch b/SOURCES/0001-vgaarb-Check-snprintf-return-value.patch new file mode 100644 index 0000000..43f3686 --- /dev/null +++ b/SOURCES/0001-vgaarb-Check-snprintf-return-value.patch @@ -0,0 +1,69 @@ +From c4af0f3ab992977d7fde65240a15481a1adc859c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= +Date: Tue, 19 Mar 2024 13:45:19 +0100 +Subject: [PATCH] vgaarb: Check snprintf return value +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +snprintf() might return a negative value if an error occurs. +Check its return value before using it in vgaarb_write(). + +Signed-off-by: José Expósito +--- + src/common_vgaarb.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/src/common_vgaarb.c b/src/common_vgaarb.c +index 515275f..a1edfab 100644 +--- a/src/common_vgaarb.c ++++ b/src/common_vgaarb.c +@@ -238,6 +238,8 @@ pci_device_vgaarb_set_target(struct pci_device *dev) + + len = snprintf(buf, BUFSIZE, "target PCI:%04x:%02x:%02x.%x", + dev->domain, dev->bus, dev->dev, dev->func); ++ if (len < 0 || len >= BUFSIZE) ++ return -1; + + ret = vgaarb_write(pci_sys->vgaarb_fd, buf, len); + if (ret) +@@ -268,6 +270,9 @@ pci_device_vgaarb_decodes(int new_vgaarb_rsrc) + return 0; + + len = snprintf(buf, BUFSIZE, "decodes %s", rsrc_to_str(new_vgaarb_rsrc)); ++ if (len < 0 || len >= BUFSIZE) ++ return -1; ++ + ret = vgaarb_write(pci_sys->vgaarb_fd, buf, len); + if (ret == 0) + dev->vgaarb_rsrc = new_vgaarb_rsrc; +@@ -297,6 +302,8 @@ pci_device_vgaarb_lock(void) + return 0; + + len = snprintf(buf, BUFSIZE, "lock %s", rsrc_to_str(dev->vgaarb_rsrc)); ++ if (len < 0 || len >= BUFSIZE) ++ return -1; + + return vgaarb_write(pci_sys->vgaarb_fd, buf, len); + } +@@ -315,6 +322,8 @@ pci_device_vgaarb_trylock(void) + return 0; + + len = snprintf(buf, BUFSIZE, "trylock %s", rsrc_to_str(dev->vgaarb_rsrc)); ++ if (len < 0 || len >= BUFSIZE) ++ return -1; + + return vgaarb_write(pci_sys->vgaarb_fd, buf, len); + } +@@ -333,6 +342,8 @@ pci_device_vgaarb_unlock(void) + return 0; + + len = snprintf(buf, BUFSIZE, "unlock %s", rsrc_to_str(dev->vgaarb_rsrc)); ++ if (len < 0 || len >= BUFSIZE) ++ return -1; + + return vgaarb_write(pci_sys->vgaarb_fd, buf, len); + } +-- +2.44.0 + diff --git a/SOURCES/libpciaccess-rom-size.patch b/SOURCES/libpciaccess-rom-size.patch new file mode 100644 index 0000000..baf8026 --- /dev/null +++ b/SOURCES/libpciaccess-rom-size.patch @@ -0,0 +1,73 @@ +diff --git a/src/linux_sysfs.c b/src/linux_sysfs.c +index 8c3cf67..2ea78c1 100644 +--- a/src/linux_sysfs.c ++++ b/src/linux_sysfs.c +@@ -227,6 +227,7 @@ pci_device_linux_sysfs_probe( struct pci_device * dev ) + pciaddr_t bytes; + unsigned i; + int err; ++ struct stat st; + + + err = pci_device_linux_sysfs_read( dev, config, 0, 256, & bytes ); +@@ -293,11 +294,28 @@ pci_device_linux_sysfs_probe( struct pci_device * dev ) + flags = strtoull( next, & next, 16 ); + if ( low_addr != 0 ) { + priv->rom_base = low_addr; +- dev->rom_size = (high_addr - low_addr) + 1; + } + } + } + ++ snprintf( name, 255, "%s/%04x:%02x:%02x.%1u/rom", ++ SYS_BUS_PCI, ++ dev->domain, ++ dev->bus, ++ dev->dev, ++ dev->func ); ++ ++ fd = open( name, O_RDWR ); ++ if ( fd == -1 ) { ++ dev->rom_size = 0x10000; ++ } else if ( fstat( fd, & st ) == -1 ) { ++ close( fd ); ++ dev->rom_size = 0x10000; ++ } else { ++ close( fd ); ++ dev->rom_size = st.st_size == 0 ? 0x10000 : st.st_size; ++ } ++ + return err; + } + +@@ -309,7 +327,6 @@ pci_device_linux_sysfs_read_rom( struct pci_device * dev, void * buffer ) + int fd; + struct stat st; + int err = 0; +- size_t rom_size; + size_t total_bytes; + + +@@ -334,10 +351,6 @@ pci_device_linux_sysfs_read_rom( struct pci_device * dev, void * buffer ) + return errno; + } + +- rom_size = st.st_size; +- if ( rom_size == 0 ) +- rom_size = 0x10000; +- + /* This is a quirky thing on Linux. Even though the ROM and the file + * for the ROM in sysfs are read-only, the string "1" must be written to + * the file to enable the ROM. After the data has been read, "0" must be +@@ -346,9 +359,9 @@ pci_device_linux_sysfs_read_rom( struct pci_device * dev, void * buffer ) + write( fd, "1", 1 ); + lseek( fd, 0, SEEK_SET ); + +- for ( total_bytes = 0 ; total_bytes < rom_size ; /* empty */ ) { ++ for ( total_bytes = 0 ; total_bytes < dev->rom_size ; /* empty */ ) { + const int bytes = read( fd, (char *) buffer + total_bytes, +- rom_size - total_bytes ); ++ dev->rom_size - total_bytes ); + if ( bytes == -1 ) { + err = errno; + break; diff --git a/SOURCES/make-libpciaccess-snapshot.sh b/SOURCES/make-libpciaccess-snapshot.sh new file mode 100755 index 0000000..a265c3f --- /dev/null +++ b/SOURCES/make-libpciaccess-snapshot.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +DATE=$( date +%Y%m%d ) +DIRNAME=libpciaccess +REV=${1:-master} + +if test -e $DIRNAME.git; then + GIT_DIR=$DIRNAME.git git fetch git://git.freedesktop.org/git/xorg/lib/libpciaccess +else + git clone --bare git://git.freedesktop.org/git/xorg/lib/libpciaccess $DIRNAME.git + GIT_DIR=$DIRNAME.git git archive --prefix=$DIRNAME-$DATE/ --format=tar $REV | \ + bzip2 -c > $DIRNAME-$DATE.tar.bz2 +fi + +HASH=$(GIT_DIR=$DIRNAME.git git show-ref -s $REV) + +echo $HASH + +exit + +# the rest of this is supposed to work? i guess. + +version=$(sed -n -e "s/^Version: *\(.*\)/\1/p" < libpciaccess.spec) +release=$(sed -n -e "s/^Release: *\([^.]*\).*/\1/p" < libpciaccess.spec) +release=$(($release + 1)) + +user=$(id -un) +IFS=: info=($(grep ^$user: /etc/passwd)) + +msg="* $(date +'%a %b %d %Y') ${info[4]} <$user@redhat.com> $version-$release.$DATE\\ +- New snapshot, git revision $HASH.\\ +" + +sed -i -e "s/^%define gitdate.*/%define gitdate $DATE/" \ + -e "s/^%define gitrev.*/%define gitrev $HASH/" \ + -e "s/^Source0:.*/Source0: $DIRNAME-$DATE.tar.bz2/" \ + -e "s/^Release:.*/Release: $release.%{gitdate}%{?dist}/" \ + -e "/%changelog/ a $msg" \ + libpciaccess.spec + +make new-sources FILES=$DIRNAME-$DATE.tar.bz2 diff --git a/SPECS/libpciaccess.spec b/SPECS/libpciaccess.spec new file mode 100644 index 0000000..53138e7 --- /dev/null +++ b/SPECS/libpciaccess.spec @@ -0,0 +1,304 @@ +Name: libpciaccess +Version: 0.16 +Release: 15%{?dist} +Summary: PCI access library + +License: HPND AND MIT +URL: https://www.x.org/ + +# git snapshot. To recreate, run +# % ./make-libpciaccess-snapshot.sh %{gitrev} +#Source0: libpciaccess-%{gitdate}.tar.bz2 +Source0: https://www.x.org/archive/individual/lib/%{name}-%{version}.tar.bz2 +Source1: make-libpciaccess-snapshot.sh + +Patch2: libpciaccess-rom-size.patch +Patch3: 0001-vgaarb-Check-snprintf-return-value.patch + +BuildRequires: autoconf automake libtool pkgconfig xorg-x11-util-macros +BuildRequires: make +Requires: hwdata + +%description +libpciaccess is a library for portable PCI access routines across multiple +operating systems. + +%package devel +Summary: PCI access library development package +Requires: %{name} = %{version}-%{release} +Requires: pkgconfig + +%description devel +Development package for libpciaccess. + +%prep +%autosetup -p1 + +%build +autoreconf -v --install +%configure --disable-static +%make_build + +%install +%make_install +rm -f $RPM_BUILD_ROOT/%{_libdir}/*.la + +%ldconfig_scriptlets + +%files +%license COPYING +%doc AUTHORS +%{_libdir}/libpciaccess.so.0 +%{_libdir}/libpciaccess.so.0.11.* + +%files devel +%{_includedir}/pciaccess.h +%{_libdir}/libpciaccess.so +%{_libdir}/pkgconfig/pciaccess.pc + +%changelog +* Fri Oct 25 2024 MSVSphere Packaging Team - 0.16-15 +- Rebuilt for MSVSphere 10 + +* Mon Jun 24 2024 Troy Dawson - 0.16-15 +- Bump release for June 2024 mass rebuild + +* Wed Mar 20 2024 José Expósito - 0.16-14 +- Add gating.yaml + +* Wed Mar 20 2024 José Expósito - 0.16-13 +- Fix findings from static application security testing (SAST) + Resolves: https://issues.redhat.com/browse/RHEL-29742 + +* Thu Jan 25 2024 Fedora Release Engineering - 0.16-12 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Sun Jan 21 2024 Fedora Release Engineering - 0.16-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Fri Sep 15 2023 Dave Airlie - 0.16-10 +- migrate to SPDX license + +* Thu Jul 20 2023 Fedora Release Engineering - 0.16-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Thu Jan 19 2023 Fedora Release Engineering - 0.16-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Thu Jul 21 2022 Fedora Release Engineering - 0.16-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Thu Jan 20 2022 Fedora Release Engineering - 0.16-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Thu Jul 22 2021 Fedora Release Engineering - 0.16-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Tue Jan 26 2021 Fedora Release Engineering - 0.16-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Tue Jul 28 2020 Fedora Release Engineering - 0.16-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Wed Jan 29 2020 Fedora Release Engineering - 0.16-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Wed Oct 30 2019 Adam Jackson - 0.16-1 +- libpciaccess 0.16 + +* Thu Jul 25 2019 Fedora Release Engineering - 0.15-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Thu Jul 11 2019 Adam Jackson - 0.15-1 +- libpciaccess 0.15 + +* Fri Feb 01 2019 Fedora Release Engineering - 0.14-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Fri Jul 13 2018 Fedora Release Engineering - 0.14-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Wed Apr 04 2018 Adam Jackson - 0.14-1 +- libpciaccess 0.14 + +* Wed Feb 07 2018 Fedora Release Engineering - 0.13.4-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Sat Feb 03 2018 Igor Gnatenko - 0.13.4-7 +- Switch to %%ldconfig_scriptlets + +* Thu Aug 03 2017 Fedora Release Engineering - 0.13.4-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Wed Jul 26 2017 Fedora Release Engineering - 0.13.4-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Fri Feb 10 2017 Fedora Release Engineering - 0.13.4-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Thu Feb 04 2016 Fedora Release Engineering - 0.13.4-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Wed Jun 17 2015 Fedora Release Engineering - 0.13.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Fri May 01 2015 Adam Jackson 0.13.4-1 +- libpciaccess 0.13.4 + +* Sun Aug 17 2014 Fedora Release Engineering - 0.13.3-0.3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Sat Jun 07 2014 Fedora Release Engineering - 0.13.3-0.2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Fri Apr 11 2014 Adam Jackson 0.13.3-0.1 +- New git snapshot. + +* Mon Dec 09 2013 Adam Jackson 0.13.2-1 +- libpciaccess 0.13.2 (#987367) + +* Sat Aug 03 2013 Fedora Release Engineering - 0.13.1-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Thu Feb 14 2013 Fedora Release Engineering - 0.13.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Thu Jul 19 2012 Fedora Release Engineering - 0.13.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Tue Apr 10 2012 Adam Jackson 0.13.1-1 +- libpciaccess 0.13.1 + +* Wed Mar 28 2012 Adam Jackson 0.13-2 +- libpciaccess-macros.patch: Fix out* macros again + +* Wed Mar 28 2012 Adam Jackson 0.13-1 +- libpciaccess 0.13 + +* Wed Feb 29 2012 Dan Horák - 0.12.902-6 +- fix the out[bwl] compatibility macros + +* Thu Feb 16 2012 Peter Robinson - 0.12.902-5 +- Add ARM arch to libpciaccess-lol-dev-port patch + +* Wed Feb 08 2012 Adam Jackson 0.12.902-4 +- libpciaccess-lol-dev-port.patch: Don't use /dev/port since the kernel insists + that it remain unusably broken. + +* Fri Jan 13 2012 Fedora Release Engineering - 0.12.902-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Mon Nov 28 2011 Daniel Drake 0.12.902-2 +- Add upstream patch to fix ios deletion; fixes X crash on OLPC XO-1.5 + +* Wed Nov 09 2011 Adam Jackson 0.12.902-1 +- libpciaccess 0.12.902 + +* Wed Nov 09 2011 Peter Hutterer 0.12.901-1 +- Today's git snapshot + +* Wed Feb 09 2011 Adam Jackson 0.12.1-1 +- libpciaccess 0.12.1 + +* Tue Feb 08 2011 Fedora Release Engineering - 0.12.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Wed Jul 21 2010 Dave Airlie 0.12.0-1 +- libpciaccess 0.12 + +* Tue Mar 16 2010 Adam Jackson 0.11.0-1 +- libpciaccess 0.11 + +* Wed Dec 09 2009 Adam Jackson 0.10.9-2.20091209 +- New git snapshot +- Drop the fd cache patch + +* Fri Sep 25 2009 Dave Airlie 0.10.9-1 +- rebase to latest upstream release - drop patches + +* Thu Aug 06 2009 Dave Airlie 0.10.6-7 +- disable rom reading fallbacks + +* Wed Aug 05 2009 Adam Jackson 0.10.6-6 +- D'oh. Fix obvious sense inversion in the previous patch. + +* Wed Aug 05 2009 Adam Jackson 0.10.6-5 +- libpciaccess-0.10.6-rom-sanity.patch: If we hit the /dev/mem path for + reading a device's ROM, verify that it looks like it at least might belong + to the device in question by checking vendor and device ID match. Fixes + vbetool post hanging forever (and thus blocking boot) on some dual-gpu + laptops. + +* Mon Aug 03 2009 Dave Airlie 0.10.6-4 +- Add support for default vga arb device selection +- Update libpciaccess VGA arb code for newer kernel API + +* Fri Jul 31 2009 Dave Airlie 0.10.6-3 +- enable autoreconf to rebuild configure properly + +* Fri Jul 31 2009 Dave Airlie 0.10.6-2 +- libpciaccess-vga-arbiter.patch: add vga arbiter support to libpciaccess + +* Mon Jul 27 2009 Dave Airlie 0.10.6-1 +- rebase to latest release (will do release with VGA bits later) +- libpciaccess-boot-vga.patch: add boot vga patch from upstream + +* Fri Jul 24 2009 Fedora Release Engineering - 0.10.5-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Tue Apr 21 2009 Adam Jackson 0.10.5-1 +- libpciaccess 0.10.5 + +* Wed Feb 25 2009 Fedora Release Engineering - 0.10.3-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Sun Feb 15 2009 Kristian Høgsberg - 0.10.3-5 +- Unbreak the rom-size patch. + +* Sun Feb 15 2009 Kristian Høgsberg - 0.10.3-4 +- Don't read more than the advertised rom_size. + +* Thu Aug 28 2008 Adam Jackson 0.10.3-3 +- Rediff for --fuzz=0 + +* Wed Jul 02 2008 Adam Jackson 0.10.3-2 +- Fix file access mode in config fd cache. (#452910) + +* Tue Jul 01 2008 Adam Jackson 0.10.3-1 +- libpciaccess 0.10.3 + +* Tue May 20 2008 Adam Jackson 0.10-3 +- libpciaccess-no-pci-fix.patch: Fix init when /sys/bus/pci is empty or + nonexistent. + +* Mon Apr 21 2008 Dave Airlie 0.10-2 +- fix major problem with libpciaccess and write combining. + +* Thu Mar 06 2008 Adam Jackson 0.10-1 +- libpciaccess 0.10 + +* Mon Feb 18 2008 Fedora Release Engineering - 0.9.1-4.20071031 +- Autorebuild for GCC 4.3 + +* Wed Jan 23 2008 Adam Jackson 0.9.1-3.20071031 +- libpciaccess-fd-cache.patch: Cache sysfs PCI config space file + descriptors for great boot speed justice. + +* Wed Oct 31 2007 Kristian Høgsberg 0.9.1-2.20071031 +- New snapshot, git revision e392082abb5696c8837224da86cc0af4f21d7010. +- Pick up new .so file. + +* Mon Sep 24 2007 Adam Jackson 0.9.1-1 +- libpciaccess 0.9.1 + +* Mon Aug 27 2007 Adam Jackson 0.8-0.4.20070827git +- New snapshot. + +* Fri Aug 24 2007 Adam Jackson 0.8-0.3.20070712git +- Rebuild for PPC toolchain bug + +* Thu Jul 12 2007 Adam Jackson 0.8-0.2.20070712git +- New snapshot. Adds VGA ROM support. + +* Thu May 24 2007 Adam Jackson 0.8-0.1.20070524git +- Initial revision.