Commit Graph

60815 Commits

Author SHA1 Message Date
Adrien Destugues
16fca25e27 runtime_loader: fix crash because of missing initialization
The "versions" table is populated from two sources: the elf
"needed_version" and "version_definitions" tables. Both populate
specific index in the version table. Each index has an hash, and one or
two strings.

The algorithm to find data in this table is to compare by hash, and then
do an strcmp on the strings when the hash matches.

However, nothing guarantees that all the indices in the version array
will be used. Indeed, libavutil does not use the first two. These were
left uninitialized.

It could happen that one of these would accidentally have its hash equal
to one of the actual hashes we need to lookup, and invalid string
pointers. This would of course lead to a crash. This was reproductible
easily with WebKit when loading the fmpeg add-on. I guess that hit just
the right allocation/deallocation pattern to make the runtime_loader
reuse memory from a block where it had previously stored the same hash.

Anyway, just clear the whole version table after allocating, so that
unused entries have an hash of 0 and NULL string pointers, this way they
can't accidentally trigger a hash collision and crash everything.
2019-12-07 16:05:11 +01:00
Murai Takashi
2a49e094a6 Tracker kit: Fix memory leak
Like moveList and copyList, duplicateList could be deleted here.
Pointed out by Clang static analyzer.

Change-Id: Ic80181af960bc8eb759449ea5719e9a439a877a0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1996
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-12-07 09:32:09 +00:00
Autocomitter
d30c60446a Update translations from Pootle 2019-12-07 08:47:19 +00:00
Adrien Destugues
74db79d587 intel_extreme: Fix swapping of p2 values for 9xx cards
This would lead to no valid PLL combination being found, and
uninitialized stack memory eventually used to set the PLL. Add a memset
and a debugger() call to make this easier to notice.

Should fix #14368

Change-Id: Iff307439dc82a8b81bb46c1b73b63c21ee1c8279
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1898
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-12-05 19:55:57 +00:00
Adrien Destugues
af3d90a597 Attempt to fix gcc8 build. 2019-12-05 20:14:08 +01:00
Adrien Destugues
b819569ef4 usb_video.h: build fixes
- Remove duplicate and otherwise unused lendian_bitfield.h
- Adjust listusb jamfile to use lendian_bitfield.h
- Fix various typos in usb_video.h and restore some fields to make
  listusb happy
2019-12-05 18:28:12 +01:00
brjhaiku
f57d609e9b USB_Video.h: add more definitions from the spec.
fixes #5940

Change-Id: Idb9ae8dfdaa9f0fab43be3767bf97e1c87245940
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1022
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-12-05 10:55:29 +00:00
Ynoga
09b40d1634 ppc: Minor tweaks to get the arch compile again (WIP)
- Factor in types changes (introduction of intptr_t)
- Align JamFiles syntax with in progress architectures (arm/sparc)
- Xorriso doesn't support much of the mkisofs options (anymore ?)
- (After a correct bootstrap) one should be able to build @minimum-raw and haiku-boot-cd again
Change-Id: I4f779ad8f2210389fa9b7f7c0a98c3652a64c257
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1983
Reviewed-by: François Revol <revol@free.fr>
2019-12-04 18:34:31 +00:00
Adrien Destugues
4236826da6 BGeolocation: build fix 2019-12-04 17:42:53 +01:00
Augustin Cavalier
caef66c2cd freebsd_network: Return to allocating the segments in dmamap_load.
It seems some drivers do not create dmamaps for all their bustags,
so we can't allocate the segments there. And of course, some also
do not go through dmamem_alloc, so the only option then is to revert
to where FreeBSD allocates them, inside dmamap_load.
2019-12-03 17:52:23 -05:00
Adrien Destugues
edc5a2174e BGeolocation: add position to country mapping
Using the geonames.org API, so we will need an API key for it (similar
to the one used for MLS, deployed by the buildbot)

The unit tests uses the "demo" user, which is restricted to 20000 API
call credits and often expired. But we cannot use our secret key here as
it would need to be available to anyone running the test. If we ever get
to automate running the tests on a buildserver we could probably make it
use the secret username known by our buildbot instead.

Change-Id: Ia16880db82555ce85505ad28e1c623f692f46be0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1873
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2019-12-03 08:01:14 +00:00
waddlesplash
7100b1e1f5 freebsd_network: Move segment array allocation in bus_dma to dmamap_create().
It seems that some drivers (e.g. broadcom43xx) create a parent DMA tag
with nsegments set to BUS_SPACE_UNRESTRICTED, i.e. MAX_INT, which of
course fails allocation, expecting to never allocate memory for this
tag, only for child tags. So in order to handle this, we have to
delay allocating the segment array until we are certain that the nsegments
value is the "real deal".

Doing it in dmamap_load would be fine, but as there is more than one
entry point to that, we would have to allocate this in multiple places.
dmamap_create() must be called and there is only one way through it,
so put the allocation there.

Fixes #15500 (i.e. both the KDL and the underlying problem that
led to it; it only crashed because the wrong pointer was passed
to kernel_free, whoops.)
2019-12-02 20:37:52 -05:00
Adrien Destugues
70cdd7d4f5 BCountry: add SetTo and InitCheck.
Change-Id: I5fbc2a1c0e735d6edeb23672017bb64d1b3f4390
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1872
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-12-02 12:32:15 +00:00
Joachim Mairböck
b4c187b004 hda: add necessary quirk for SiS Azalia Audio Controller
Fixes #15499.

Change-Id: I8bc6df5770f902b6b43e54d80bcfee4afc42f0bd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1981
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-11-30 17:26:42 +00:00
Autocomitter
e1d1ce10bd Update translations from Pootle 2019-11-30 08:47:21 +00:00
Andrej Antunovikj
e41c35ae56 kernel/elf: Replace sprintf with snprintf
In two places in elf.cpp, sprintf is used which does not check for buffer overflows. This could potentially lead to malicious executables trying to reach memory
they are not supposed to. Instead, it's possible to use snprintf with a sizeof() call.
I'm not very well-versed into C/C++, so this is just based on what I've learned. Please do provide feedback, I would like to get into more useful contributions :)

Change-Id: I9c36a9938f9c99b3849e77aa9cd2eab313f5bb95
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1975
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-11-28 07:44:28 +00:00
Alexander von Gluck IV
1f8acf0862 HaikuPorts: Bump gnu_efi_kernel build-package for arm
Change-Id: I0e0791ebf06a2455896196d1cf0ed41979822619
2019-11-27 13:57:54 -06:00
Alexander von Gluck IV
b482adb1bc kernel/boot/efi: Continue breaking apart arch-specific code; hpet
* Move x86 hpet behind timer interface.
  * Add a few if x86,x86_64 macros to start.cpp.

Change-Id: I583ec1b064785182e6d48dfbcd91b1bb2ead4b44
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1929
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2019-11-26 21:34:43 +00:00
Humdinger
9e15c9f153 Adding the Quick Tour
* Add a link to the Quick Tour to the desktop.
* Remove the Welcome page from desktop. We don't want to clutter
  the user's desktop more than necessary. As "Home" page of
  WebPositive, it's still very visible.
* Mention the Quick Tour in the Welcome package description.
* Add a "quicktour" script similar to the welcome/userguide
  that opens the online version if it's not installed locally.
* Add icons to the userguide and quicktour scripts. Fixes #14706.
* Add bookmark and launcher for the Quick Tour.

Adjust the AddFileDataAttributeRule to create its temporary file in
the "common" architecture, the file is not architecture specific.

Add a rule PrepareScriptWithIcon in src/data/bin/Jamfile to assign
an icon and make the script executable.

Change-Id: Ia7604ff4715a5aaf9a645c1b3333a954d6a4dafc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1924
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-11-26 06:39:58 +00:00
Andrej Antunovikj
edfd1a7b68 Fixed minor typo in ProfileMessageSupport
Change-Id: I3ce60d4a9a1bb43bdec73ee2baebe8348a1de9b1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1974
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-11-24 19:15:27 +00:00
Adrien Destugues
cf1a78566c netresolv: enable weak symbols
It's simpler to have these around, they allow autotools to find the
functions the regular way (using AC_SEARCH_LIBS) as the autotools don't
use the include file and can't see the #define we are putting there to
redirect to the __ prefixed version of the methods.

Change-Id: I6a9743e88503fbdcba98e276375bc11f73a64411
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1889
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-11-24 15:08:18 +00:00
Adrien Destugues
1f391e37ea Switch back to hoard2 for now.
We'll reconsider rpmalloc when it has less overhead.
2019-11-24 15:35:51 +01:00
Adrien Destugues
dd2676821a Revert "hoard2: Remove."
This reverts commit 3a2175926b.

A single week is clearly not enough to test a new memory allocator.
Bring back hoard2 for the time being, we'll consider rpmalloc when it
actually works better.
2019-11-24 15:12:43 +01:00
Adrien Destugues
cc7e3a0522 app_server: fix another unchecked out-of-memory case
BString initialization can fail, even when it's allocated on the stack.
Use a const char* to make this code simpler. We lose the ability to
differenciate unknown opcodes, but these should not happen, or the
function should be extended to handle them all.
2019-11-24 13:38:15 +01:00
Adrien Destugues
a5483ebd76 sparc: add some development notes 2019-11-24 13:38:15 +01:00
Adrien Destugues
32bc3e2c0f ProcessController: fix bars height computation
The previous code used a fixed margin, which would lead to too small
bars with small font sizes (the bar content would not even be visible).

Instead, use the font height as the base for the bar height, which
allows us to use the same code everywhere, no matter the menu item
height (which can vary depending on if there is an icon, etc)

Fixes #15391.
2019-11-24 13:11:36 +01:00
Augustin Cavalier
5de2f989bc Network: Remove TODO and "(---)" in device interface display view.
The current network is already displayed in the next field, so
displaying it here would be redundant.
2019-11-23 19:25:00 -05:00
Augustin Cavalier
a3dc96a3a2 freebsd_network: Use ifmedia_baudrate to compute the link speed.
This is much more accurate than testing only 2 IFM_* types.
2019-11-23 16:28:40 -05:00
Augustin Cavalier
12ca36741e kernel/port: Do not leave the main port pointer in the local scope.
Only the reference. No functional change intended.
2019-11-23 16:02:16 -05:00
Augustin Cavalier
072b9ed0ac kernel/port: Properly release the first reference to the Port object.
Creating a BReferenceable sets its reference count to 1.
create_port() was then acquiring 2 references for the two lists
it inserts the port object into, and subsequently delete_port()
releases those.

But that "reference 0" never was released anywhere, and so
despite being removed from hashes, etc. port objects were
just leaked, along with whatever messages remained in their
queue, never to be freed. This of course can add up pretty
quickly in systems that created and deleted ports frequently,
for instance, in long-running media playback, opening/closing
applications, etc.

As far as I can tell, this bug was introduced in the fix to
#8007 (7f64b301b1), which introduced
the ref-counting system to the port heap, so it has been with us
since 2013 (!).

Fixes #15489, and probably some of the other "media playback
memory leak" tickets.
2019-11-23 15:13:24 -05:00
Augustin Cavalier
057719ef90 kernel/port: Handle mutex_lock returning an error status code.
This can occur if the mutex in question is destroyed while
we are waiting for it.
2019-11-23 15:08:27 -05:00
Augustin Cavalier
3c47c28a67 kernel/port: Let the mutex take care of cloning the name.
This way, we can just call mutex_destroy to take care of
freeing it. No functional change intended.
2019-11-23 14:05:17 -05:00
Augustin Cavalier
0bf9e7cb16 bfs: Use StackOrHeapArray in Journal::_WriteTransactionToLog().
The number of iovecs is usually < 8 (64 bytes), so this avoids
a lot of unnecessary heap traffic. Plus, we don't have to call
free() manually anymore.
2019-11-23 12:58:06 -05:00
Augustin Cavalier
cb29eafe25 headers/build: Replace StackOrHeapArray with a reference to the main one.
The files were identical. No functional change.
2019-11-23 12:57:03 -05:00
Autocomitter
f1304c1a4e Update translations from Pootle 2019-11-23 08:43:15 +00:00
Augustin Cavalier
26b95c15f2 freebsd_network: Completely overhaul bus_dma implementation.
The old implementation was based on an ancient copy of the FreeBSD
busdma code for x86, and did not make a bunch of assumptions that
we make basically everywhere else (for instance, that we can request
arbitrarily-aligned contiguous physical memory from the VM.)

As a consequence, it had a significant amount of code devoted to
bounce pages, which are just a waste of resources on x86, and
for that matter, probably any other architecture Haiku will ever
be ported to. (Even if we do need to run on some system where
only a small portion of system memory can be accessed by devices,
likely we would reserve that memory for just this occasion anyway.)

I was initially under the impression that the bounce-pages code
never turned on, but apparently due to the "alignment" check
(and also the "Maxmem" check, which was to defined to 32KB...?!)
it does indeed activate on a variety of systems, and maybe
(in the case of drivers that do not call sync() properly) even
is the cause of some of our ported driver breakage.

The new implementation is pretty much optimized for Haiku,
and shares almost no code or structure with the old one (save
for a few functions that really only have one proper implementation.)

Tested with ipro1000 and rtl81xx. Regressions are more than possible,
so please don't hesitate to file bugs if your network driver now
fails to come up (or you get KDLs.)
2019-11-22 22:19:43 -05:00
Augustin Cavalier
56cb682b80 freebsd_network: Moderate reorganization.
* Rename device.c to device_hooks.c, as this is what it really contains.
 * Rename compat.c to device.c, as it implements the generic "device"
   related functions, both for compat layer internals and FreeBSD
   public ones.
 * Move malloc and related operations out of the now-device.c,
   and place them in a new "malloc.cpp", which also incorporates
   compat_cpp.cpp.

No functional change intended.
2019-11-22 22:19:43 -05:00
John Scipione
a70e506a80 Locale prefs: Select items after drag and drop
in the Preferred Languages ListView.

Change-Id: I423263ba0c6753a278f70e479eb2b711ca1d7670
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1959
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-11-22 23:27:53 +00:00
John Scipione
354649f120 Terminal: Add semantic + shortcut to increase font size
See bug #7428 and hrev46251 for details.

Fixes #15452

Change-Id: I3bc8871c83e714ff624827d96c0b594fef1f1ae1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1957
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-11-22 23:27:12 +00:00
John Scipione
ea5c088d09 Tracker: fix fall back to bitmap icon
We can convert a bitmap icon to B_RGBA32 and scale it at the same
time if we pass in the right size to IconUtils. Don't error out,
force the icon_size to be either B_LARGE_ICON or B_MINI_ICON,
grab the bitmap at that size then convert and scale it.

Implement a second fallback. If the scaling and converting fails
then use ImportBits to convert the icon from B_CMAP8 to B_RGBA32
then center it without scaling.

Fill with transparent before drawing bitmap to prevent artifacting.

Fixes #9554

Change-Id: I827589236fa4f1521e3139ec29b7d60d51d2f879
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1960
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-11-22 23:25:51 +00:00
John Scipione
e9fa1debf5 Deskbar: Don't allow calendar window to be manipulated
By setting B_NOT_MOVABLE and B_NOT_RESIZABLE flags the calendar window
can't be moved or resized by holding ctrl + alt + left/right mouse button.

Change-Id: If7f280ab6595b32a6c9521051540ffba0c76d211
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1965
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-11-22 23:24:55 +00:00
John Scipione
2659cdba83 ScreenSaver prefs: Invoke list item runs test
This copies the behavior of BeOS R5 ScreenSaver prefs.

Don't invoke the listview on AllAttached() anymore, this would make
the selected screensaver start when the pref window opens.

Horizontally center the Test button.

Change-Id: I65471112d37d9efd17945f05bce485ff2fece9dd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1958
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-11-22 23:24:22 +00:00
John Scipione
fb3493dfef BControlLook: Move tab frame drawing into DrawTabFrame()
The tab frame is drawn behind the tabs.

Create a new DrawTabFrame method in BControlLook and HaikuControlLook
that draws the tab frame background.

Until now we've been reusing the DrawInactiveTab method to draw the tab frame
in BTabView. While this works on HaikuControlLook, it doesn't work on other
ControlLook's (such as BeControlLook) that draw their tab frame differently.

Add FBC method to preserve binary compatibility on gcc2 and gcc4.

Move DrawTabFrame method to where _ReservedControlLook1 was in header.

Set rect to area of tab frame in TabView instead of doing the
calculation in HaikuControlLook so that others may benefit.

Change-Id: I513e238914f6d680f495659b6ec902df15555015
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1936
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-11-22 23:24:05 +00:00
John Scipione
7e27cd8e6f Deskbar: Update window resize size limits
With B_NOT_V_RESIZABLE ctrl+alt+rmb can be used to resize the window
in undesired ways. Set window size limits to prevent user from resizing
the window beyond the set size limits.

Update window size limits on ScreenChanged()

Fixes #15067

Change-Id: Ia10eafb9860009019be35ec5c244d034861eeae9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1968
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-11-22 23:21:44 +00:00
John Scipione
7586efaf07 PowerStatus: Draw battery without BControlLook
Drawing the battery using BControlLook:DrawButtonBackground does not
work as expected with alternative ControlLook installed. Instead
draw the bevel and gradient without using BControlLook.

Renamed empty to unfilled. Replace single base color with unfilledColor
and fillColor.

unfilledColor appears to have change but it is the same #4c4c4c
(75, 75, 75) color just untinted. Specify the color using hex values.

Put all battery drawing inside the fHasBattery conditional block.

Copy rect to fill and use it to draw the filled area.

Use make_color() to make the unfilled color.

Change-Id: I615c4dc1b9e0206b4ac0259d3183fe691584209b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1967
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-11-22 23:21:29 +00:00
Adrien Destugues
56cddb517d intel_extreme: fix vblank interrupt for Ironlake
Ironlake and SandyBridge use the same layout for the interrupt register.
Previous generations don't use PCH so the interrupt register is
different. Next generations shuffle the bits again to make space for a
3rd display pipe.

Thanks to D3ant for letting me test this on his computer!
2019-11-21 21:11:54 +01:00
Axel Dörfler
b240f0ad50 net_server: Fixed overwriting wrong interface config
* When the "interfaces" file contains a configuration for a missing
  device, the first interface found would be overwritten, irregardless
  of its status.
* Now, _ConfigureDevices() properly honours the
  "devicesAlreadyConfigured" list.
* This fixes bug #14908.
2019-11-21 08:06:33 +01:00
Axel Dörfler
f1271b6454 BPath: Removed superfluous term 2019-11-19 17:35:19 +01:00
Autocomitter
c8deb11d5d Update translations from Pootle 2019-11-16 08:44:40 +00:00
CodeforEvolution
89fc6d6aa2 [hey] - Fix overflow issue found by LGTM
LGTM issue: "gets does not guard against buffer overflow"

Change-Id: I502428f167865ac81301aa72d20c91b4480fb3dc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1926
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-11-14 16:57:06 +00:00